Esempio n. 1
0
function modsec_conf_edit($post, $db)
{
    $conf = ModSecConfiguration::getModSecConfById($post['id']);
    $conf->setName($post['cname']);
    $conf->setDescription($post['cdescription']);
    $conf->setActive($post['validity']);
    $conf->setSecArgumentSperator($post['SecArgumentSperator']);
    $conf->setSecAuditEngine($post['SecAuditEngine']);
    //$conf->setSecAuditLogParts($post['SecAuditLogParts']);
    $conf->setSecAuditLog($post['audit_log']);
    //$conf->setSecAuditLog2($post['audit_log2']);
    $conf->setSecAuditLogRelevantStatus($post['alog_rstatus']);
    $conf->setSecAuditLogStorageDir($post['alog_storegadir']);
    //$conf->setSecAuditLogType($post['SecAuditLogType']);
    //$conf->setSecCacheTransformations($post['SecCacheTransformations']);
    $conf->setSecChrootDir($post['chroot_dir']);
    //$conf->setSecComponentSignature($post['comp_signature']);
    $conf->setSecContentInjection($post['SecContentInjection']);
    $conf->setSecCookieFormat($post['SecCookieFormat']);
    $conf->setSecDataDir($post['data_dir']);
    //$conf->setSecDebugLog($post['debug_log']);
    //$conf->setSecDebugLogLevel($post['SecDebugLogLevel']);
    $conf->setSecGuardianLog($post['guardian_log']);
    $conf->setSecPdfProtect($post['SecPdfProtect']);
    $conf->setSecPdfProtectMethod($post['SecPdfProtectMethod']);
    $conf->setSecPdfProtectTimeout($post['SecPdfProtectTimeout']);
    //$conf->setSecRequestBodyAccess($post['SecRequestBodyAccess']);
    $conf->setSecRequestBodyLimit($post['req_body_limit']);
    $conf->setSecRequestBodyNoFilesLimit($post['req_body_no_files_limit']);
    $conf->setSecRequestBodyInMemoryLimit($post['req_body_in_memo_limit']);
    $conf->setSecResponseBodyLimit($post['resp_body_limit']);
    $conf->setSecResponseBodyLimitAction($post['SecResponseBodyLimitAction']);
    $conf->setSecResponseBodyMimeType(implode(',', $post['SecResponseBodyMimeType']));
    //$conf->setSecResponseBodyAccess($post['SecResponseBodyAccess']);
    $conf->setSecRuleInheritance($post['SecRuleInheritance']);
    $conf->setSecRuleEngine($post['SecRuleEngine']);
    $conf->setSecTmpDir($post['tmp_dir']);
    //$conf->setSecUploadDir($post['upload_dir']);
    //$conf->setSecUploadKeepFiles($post['SecUploadKeepFiles']);
    $conf->setSecWebAppId($post['web_app_id']);
    $conf->setFilled(true);
    $db->editModSecConfiguration($conf);
}
Esempio n. 2
0
 public function getAllModSecConfigurations($where = '')
 {
     $str = "SELECT C.ConfID,C.ConfName,C.Description,C.Validity\n            FROM modsec_conf C {$where}";
     $result = $this->dbh->query($str);
     if (PEAR::isError($result)) {
         echo $result->getMessage() . ' - ' . $result->getUserinfo();
         exit;
     }
     $array = $result->fetchAll();
     $result->free();
     $msec_conf_a = array();
     foreach ($array as $el) {
         $msec_conf = new ModSecConfiguration();
         $msec_conf->setID($el[0]);
         $msec_conf->setName($el[1]);
         $msec_conf->setDescription($el[2]);
         $msec_conf->setActive($el[3]);
         $msec_conf->setFilled(true);
         $msec_conf_a[] = $msec_conf;
     }
     return $msec_conf_a;
 }