"default", "bind_to" => "all", "personality" => "IDS", "request-body-limit" => 4096, "response-body-limit" => 4096, "double-decode-path" => "no", "double-decode-query" => "no" ); $pconfig['libhtp_policy']['item'] = array(); $pconfig['libhtp_policy']['item'][] = $default; if (!is_array($a_nat[$id]['libhtp_policy']['item'])) $a_nat[$id]['libhtp_policy']['item'] = array(); $a_nat[$id]['libhtp_policy']['item'][] = $default; write_config(); $libhtp_engine_next_id++; } else $pconfig['libhtp_policy'] = $a_nat[$id]['libhtp_policy']; } // Check for "import alias mode" and set flag if TRUE if ($_POST['import_alias']) { $importalias = true; $title = "HTTP Server Policy"; } else $importalias = false; if ($_POST['add_libhtp_policy']) { header("Location: suricata_libhtp_policy_engine.php?id={$id}&eng_id={$libhtp_engine_next_id}"); exit; } elseif ($_POST['del_libhtp_policy']) { $natent = array(); $natent = $pconfig; if ($_POST['eng_id'] != "") { unset($natent['libhtp_policy']['item'][$_POST['eng_id']]); $pconfig = $natent; } if (isset($id) && $a_nat[$id]) { $a_nat[$id] = $natent; write_config(); } } elseif ($_POST['ResetAll']) { /* Reset all the settings to defaults */ $pconfig['asn1_max_frames'] = "256"; /* Log a message at the top of the page to inform the user */ $savemsg = gettext("All flow and stream settings have been reset to their defaults."); } elseif ($_POST['save_import_alias']) { $engine = array( "name" => "", "bind_to" => "", "personality" => "IDS", "request-body-limit" => "4096", "response-body-limit" => "4096", "double-decode-path" => "no", "double-decode-query" => "no" ); // See if anything was checked to import if (is_array($_POST['aliastoimport']) && count($_POST['aliastoimport']) > 0) { foreach ($_POST['aliastoimport'] as $item) { $engine['name'] = strtolower($item); $engine['bind_to'] = $item; $a_nat[$id]['libhtp_policy']['item'][] = $engine; } } else { $input_errors[] = gettext("No entries were selected for import. Please select one or more Aliases for import and click SAVE."); $importalias = true; } // if no errors, write new entry to conf if (!$input_errors) { // Reorder the engine array to ensure the // 'bind_to=all' entry is at the bottom if // the array contains more than one entry. if (count($a_nat[$id]['libhtp_policy']['item']) > 1) { $i = -1; foreach ($a_nat[$id]['libhtp_policy']['item'] as $f => $v) { if ($v['bind_to'] == "all") { $i = $f; break; } } // Only relocate the entry if we // found it, and it's not already // at the end. if ($i > -1 && ($i < (count($a_nat[$id]['libhtp_policy']['item']) - 1))) { $tmp = $a_nat[$id]['libhtp_policy']['item'][$i]; unset($a_nat[$id]['libhtp_policy']['item'][$i]); $a_nat[$id]['libhtp_policy']['item'][] = $tmp; } $pconfig['libhtp_policy']['item'] = $a_nat[$id]['libhtp_policy']['item']; } // Write the new engine array to config file write_config(); $importalias = false; } } elseif ($_POST['cancel_import_alias']) { $importalias = false; } elseif ($_POST['save']) { $natent = array(); $natent = $pconfig; // TODO: validate input values if (!is_numeric($_POST['asn1_max_frames'] ) || $_POST['asn1_max_frames'] < 1) $input_errors[] = gettext("The value for 'ASN1 Max Frames' must be all numbers and greater than 0."); /* if no errors write to conf */ if (!$input_errors) { if ($_POST['asn1_max_frames'] != "") { $natent['asn1_max_frames'] = $_POST['asn1_max_frames']; }else{ $natent['asn1_max_frames'] = "256"; } /**************************************************/ /* If we have a valid rule ID, save configuration */ /* then update the suricata.conf file and rebuild */ /* the rules for this interface. */ /**************************************************/ if (isset($id) && $a_nat[$id]) { $a_nat[$id] = $natent; write_config(); $rebuild_rules = true; suricata_generate_yaml($natent); $rebuild_rules = false; } header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); header( 'Cache-Control: no-store, no-cache, must-revalidate' ); header( 'Cache-Control: post-check=0, pre-check=0', false ); header( 'Pragma: no-cache' ); header("Location: suricata_app_parsers.php?id=$id"); exit; } } $if_friendly = convert_friendly_interface_to_friendly_descr($pconfig['interface']); $pgtitle = gettext("Suricata: Interface {$if_friendly} - Layer 7 Application Parsers"); include_once("head.inc"); ?>
'; echo '
'; $menu_iface=($if_friendly?substr($if_friendly,0,5)." ":"Iface "); $tab_array = array(); $tab_array[] = array($menu_iface . gettext("Settings"), false, "/suricata/suricata_interfaces_edit.php?id={$id}"); $tab_array[] = array($menu_iface . gettext("Categories"), false, "/suricata/suricata_rulesets.php?id={$id}"); $tab_array[] = array($menu_iface . gettext("Rules"), false, "/suricata/suricata_rules.php?id={$id}"); $tab_array[] = array($menu_iface . gettext("Flow/Stream"), false, "/suricata/suricata_flow_stream.php?id={$id}"); $tab_array[] = array($menu_iface . gettext("App Parsers"), true, "/suricata/suricata_app_parsers.php?id={$id}"); $tab_array[] = array($menu_iface . gettext("Variables"), false, "/suricata/suricata_define_vars.php?id={$id}"); $tab_array[] = array($menu_iface . gettext("Barnyard2"), false, "/suricata/suricata_barnyard.php?id={$id}"); display_top_tabs($tab_array); ?>
  " . gettext("256") . "" . gettext(" frames."); ?>

$v): ?>
"/> ">
"> "all") : ?> "> ">
  ">      >