From 785bc1f02d8f73694cf100378f2a6da1afc70f8d Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 6 Oct 2006 18:47:25 +0000 Subject: Add a few more comments --- packages/snort/snort.inc | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'packages/snort/snort.inc') diff --git a/packages/snort/snort.inc b/packages/snort/snort.inc index 96a97d7b..fa55b735 100644 --- a/packages/snort/snort.inc +++ b/packages/snort/snort.inc @@ -3,6 +3,7 @@ /* snort.inc Copyright (C) 2006 Scott Ullrich + part of pfSense All rights reserved. Redistribution and use in source and binary forms, with or without @@ -44,6 +45,7 @@ function sync_package_snort_reinstall() { function sync_package_snort() { global $config, $g; conf_mount_rw(); + /* create a few directories and ensure the sample files are in place */ exec("/bin/mkdir -p /usr/local/etc/snort"); exec("/bin/mkdir -p /var/log/snort"); exec("/bin/cp /usr/local/etc/snort/unicode.map-sample /usr/local/etc/snort/unicode.map"); @@ -82,6 +84,7 @@ function sync_package_snort() { if($_POST['blockoffenders']) $start .= ";/usr/bin/killall snort2c; snort2c -w /var/db/whitelist -a /var/log/snort/alert"; + /* write out rc.d start/stop file */ write_rcfile(array( "file" => "snort.sh", "start" => $start, @@ -115,6 +118,7 @@ function create_snort_conf() { function snort_deinstall() { $text_ww = "*/60\t* \t 1\t *\t *\t root\t /usr/bin/nice -n20 /usr/local/pkg/snort_check_for_rule_updates.php"; $filenamea = "/etc/crontab"; + /* remove auto rules update helper */ remove_text_from_file($filenamea, $text_ww); /* remove custom sysctl */ remove_text_from_file("/etc/sysctl.conf", "sysctl net.bpf.bufsize=20480"); @@ -142,6 +146,7 @@ function generate_snort_conf() { /* should we install a automatic update crontab entry? */ $automaticrulesupdate = $config['installedpackages']['snort']['config'][0]['automaticrulesupdate']; + /* if user is on pppoe, we really want to use ng0 interface */ if($config['interfaces'][$snort_ext_int]['ipaddr'] == "pppoe") $snort_ext_int = "ng0"; @@ -171,8 +176,8 @@ function generate_snort_conf() { else $ssh_port = "22"; - /* iterate through interface list and write out whitelist items - * and also compile a home_net list for snort. + /* iterate through interface list and write out whitelist items + * and also compile a home_net list for snort. */ foreach($int_array as $int) { /* calculate interface subnet information */ @@ -233,11 +238,11 @@ function generate_snort_conf() { /* build snort configuration file */ $snort_conf_text = <<parent.scrollTo(0,1500);\n"; } +/* ensure downloaded file looks sane */ function verify_downloaded_file($filename) { global $snort_filename, $snort_filename_md5, $console_mode; ob_flush(); @@ -402,6 +413,7 @@ function verify_downloaded_file($filename) { update_all_status("Verifyied {$filename}."); } +/* extract rules */ function extract_snort_rules_md5($tmpfname) { global $snort_filename, $snort_filename_md5, $console_mode; ob_flush(); @@ -419,6 +431,7 @@ function extract_snort_rules_md5($tmpfname) { } } +/* verify MD5 against downloaded item */ function verify_snort_rules_md5($tmpfname) { global $snort_filename, $snort_filename_md5, $console_mode; ob_flush(); @@ -441,6 +454,7 @@ function verify_snort_rules_md5($tmpfname) { } } +/* hide progress bar */ function hide_progress_bar_status() { global $snort_filename, $snort_filename_md5, $console_mode; ob_flush(); @@ -448,6 +462,7 @@ function hide_progress_bar_status() { echo "\n"; } +/* update both top and bottom text box during an operation */ function update_all_status($status) { global $snort_filename, $snort_filename_md5, $console_mode; ob_flush(); -- cgit v1.2.3