diff options
Diffstat (limited to 'config/snort-dev')
22 files changed, 212 insertions, 164 deletions
diff --git a/config/snort-dev/bin/oinkmaster_contrib/snort_rename.pl b/config/snort-dev/bin/oinkmaster_contrib/snort_rename.pl new file mode 100644 index 00000000..e5f0d39e --- /dev/null +++ b/config/snort-dev/bin/oinkmaster_contrib/snort_rename.pl @@ -0,0 +1,100 @@ +#!/usr/bin/perl -w + +#usage: rename perl_expression [files] +my $usage = qq{rename [-v] s/pat/repl/ [filenames...]\t (c)2001 hellweg\@snark.de +rename files read from the commandline or stdin + +License to use, modify and redistribute granted to each and every lifeform on +this planet (as long as credit to hellweg\@snark.de remains). No guarantee that +'rename' does or does not perform the way you want... + +} ; +$verbose = 0 ; +$quiet = 0 ; + +$op=shift || 0 ; +if($op eq "-v") { + $verbose++ ; $quiet = 0 ; + $op=shift || 0 ; +} +if($op eq "-q") { + $quiet++ ; $verbose = 0 ; + $op=shift || 0 ; +} +if($op =~ /^-h/) { + print $usage; exit(0) ; +} + +if(! $op) { + print $usage; exit(-1) ; +} + +if (!@ARGV) { + @ARGV = <STDIN>; +} + +$count=0 ; +my($m, $d, $y, $T) ; +for (@ARGV) { + chomp ; + if(-e $_) { + $was = $_; + if($op =~ /\$[Tdym]/) { + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime((stat($_))[9]); + $m = sprintf("%0.2i", $mon+1); + $d = sprintf("%0.2i", $mday); + $y = $year + 1900 ; + $T = "$y$m$d" ; + } + eval $op; + die $@ if $@; + if(-f $_) { print("! exists already: $was -> $_ \n") unless $quiet ; } + else { + if(rename($was, $_)) { + print("$was -> $_\n") if $verbose ; + $count++; + } else { + if(/\//) { + # maybe we need to create dirs? + my $createRes = createDirs($_) ; + if($createRes) { + print("! fauled to create $createRes for $_\n") + unless $quiet ; + } + else { # try again + if(rename($was, $_)) { + print("$was -> $_\n") if $verbose ; + $count++; + } else { + print("! failed to rename $was -> $_ \n") + unless $quiet ; + } + } + } + else { + print("! failed to rename $was -> $_ \n") unless $quiet ; + } + } + } + } + else { print("! not found: $_ \n") ; } +} +print("renamed $count files\n") if $verbose ; + + +sub createDirs { # return the dir we failed to create or 0 + my $file = shift ; + my @dirs = split /\//, $file ; + pop @dirs ; # don't try to mkdir the file itself + my $current = "" ; + $current = "/" if ($file =~ /^\//) ; + foreach (@dirs) { + $current .= $_ ; + if(! -d $current) { + mkdir $current, 0700 || return $current ; + print "mkdir $current\n" if ($verbose) ; + } + $current .= "/" ; + } + return 0 ; # success +} diff --git a/config/snort-dev/style.css b/config/snort-dev/css/style.css index f7d2136b..f7d2136b 100644 --- a/config/snort-dev/style.css +++ b/config/snort-dev/css/style.css diff --git a/config/snort-dev/help_and_info.html b/config/snort-dev/help_and_info.html index 894d647f..d3875940 100644 --- a/config/snort-dev/help_and_info.html +++ b/config/snort-dev/help_and_info.html @@ -4,7 +4,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Help & Info</title>
<base target="main">
-<link href="style.css" rel="stylesheet" type="text/css" />
+<link href="/snort/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body class="textstyle">
diff --git a/config/snort-dev/images/down.gif b/config/snort-dev/images/down.gif Binary files differnew file mode 100644 index 00000000..2b3c99fc --- /dev/null +++ b/config/snort-dev/images/down.gif diff --git a/config/snort-dev/images/down2.gif b/config/snort-dev/images/down2.gif Binary files differnew file mode 100644 index 00000000..71bf92eb --- /dev/null +++ b/config/snort-dev/images/down2.gif diff --git a/config/snort-dev/images/icon-table-sort-asc.png b/config/snort-dev/images/icon-table-sort-asc.png Binary files differnew file mode 100644 index 00000000..330b3c1f --- /dev/null +++ b/config/snort-dev/images/icon-table-sort-asc.png diff --git a/config/snort-dev/images/icon-table-sort-desc.png b/config/snort-dev/images/icon-table-sort-desc.png Binary files differnew file mode 100644 index 00000000..dc8a92bb --- /dev/null +++ b/config/snort-dev/images/icon-table-sort-desc.png diff --git a/config/snort-dev/images/icon-table-sort.png b/config/snort-dev/images/icon-table-sort.png Binary files differnew file mode 100644 index 00000000..389169ab --- /dev/null +++ b/config/snort-dev/images/icon-table-sort.png diff --git a/config/snort-dev/images/up.gif b/config/snort-dev/images/up.gif Binary files differnew file mode 100644 index 00000000..89596771 --- /dev/null +++ b/config/snort-dev/images/up.gif diff --git a/config/snort-dev/images/up2.gif b/config/snort-dev/images/up2.gif Binary files differnew file mode 100644 index 00000000..21c5a254 --- /dev/null +++ b/config/snort-dev/images/up2.gif diff --git a/config/snort-dev/jquery-1.3.2.js b/config/snort-dev/javascript/jquery-1.3.2.js index ac191058..ac191058 100644 --- a/config/snort-dev/jquery-1.3.2.js +++ b/config/snort-dev/javascript/jquery-1.3.2.js diff --git a/config/snort-dev/jquery.blockUI.js b/config/snort-dev/javascript/jquery.blockUI.js index 99e7211d..99e7211d 100644 --- a/config/snort-dev/jquery.blockUI.js +++ b/config/snort-dev/javascript/jquery.blockUI.js diff --git a/config/snort-dev/mootools.js b/config/snort-dev/javascript/mootools.js index e058db83..e058db83 100644 --- a/config/snort-dev/mootools.js +++ b/config/snort-dev/javascript/mootools.js diff --git a/config/snort-dev/sortableTable.js b/config/snort-dev/javascript/sortableTable.js index 02c83ab5..02c83ab5 100644 --- a/config/snort-dev/sortableTable.js +++ b/config/snort-dev/javascript/sortableTable.js diff --git a/config/snort-dev/snort.inc b/config/snort-dev/snort.inc index ab93a335..bb4e201e 100644 --- a/config/snort-dev/snort.inc +++ b/config/snort-dev/snort.inc @@ -429,7 +429,32 @@ function snort_rules_up_install_cron($should_install) { } /* make sure this func on writes to files and does not start snort */ -function sync_package_snort() +function sync_snort_package() +{ + global $config, $g; + conf_mount_rw(); + + + + /* all new files are for the user snort nologin */ + if(!file_exists("/var/log/snort")) + { + exec("/bin/mkdir -p /var/log/snort"); + } + + exec("/usr/sbin/chown -R snort:snort /var/log/snort"); + exec("/usr/sbin/chown -R snort:snort /usr/local/etc/snort"); + exec("/usr/sbin/chown -R snort:snort /usr/local/lib/snort"); + exec("/bin/chmod -R 755 /var/log/snort"); + exec("/bin/chmod -R 755 /usr/local/etc/snort"); + exec("/bin/chmod -R 755 /usr/local/lib/snort"); + + conf_mount_ro(); +} + + +/* make sure this func on writes to files and does not start snort */ +function sync_snort_package_all() { global $config, $g, $id, $if_real, $interface_fake; conf_mount_rw(); @@ -904,7 +929,8 @@ function snort_deinstall() function snort_rules_up_deinstall_cron($should_install) { global $config, $g; - + conf_mount_rw(); + $is_installed = false; if(!$config['cron']['item']) diff --git a/config/snort-dev/snort.xml b/config/snort-dev/snort.xml index 7900d07a..22e9aacf 100644 --- a/config/snort-dev/snort.xml +++ b/config/snort-dev/snort.xml @@ -104,19 +104,69 @@ <item>http://www.pfsense.com/packages/config/snort-dev/snort_whitelist.xml</item> </additional_files_needed> <additional_files_needed> - <prefix>/usr/local/www/snort/</prefix> + <prefix>/usr/local/www/snort/images</prefix> <chmod>077</chmod> <item>http://www.pfsense.com/packages/config/snort-dev/images/alert.jpg</item> </additional_files_needed> <additional_files_needed> - <prefix>/usr/local/www/snort/</prefix> + <prefix>/usr/local/www/snort/images</prefix> <chmod>077</chmod> - <item>http://www.pfsense.com/packages/config/snort-dev/jquery-1.3.2.js</item> + <item>http://www.pfsense.com/packages/config/snort-dev/images/down.gif</item> </additional_files_needed> <additional_files_needed> - <prefix>/usr/local/www/snort/</prefix> + <prefix>/usr/local/www/snort/images</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/images/down2.gif</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/images</prefix> <chmod>077</chmod> - <item>http://www.pfsense.com/packages/config/snort-dev/jquery.blockUI.js</item> + <item>http://www.pfsense.com/packages/config/snort-dev/images/icon-table-sort.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/images</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/images/icon-table-sort-asc.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/images</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/images/icon-table-sort-desc.png</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/images</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/images/up.gif</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/images</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/images/up2.gif</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/javascript/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/javascript/jquery-1.3.2.js</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/javascript/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/javascript/jquery.blockUI.js</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/javascript/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/javascript/mootools.js</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/javascript/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/javascript/sortableTable.js</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/snort/css/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/snort-dev/css/style.css</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/www/snort/</prefix> @@ -161,11 +211,6 @@ <additional_files_needed> <prefix>/usr/local/www/snort/</prefix> <chmod>077</chmod> - <item>http://www.pfsense.com/packages/config/snort-dev/style.css</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/www/snort/</prefix> - <chmod>077</chmod> <item>http://www.pfsense.com/packages/config/snort-dev/snort_interfaces.php</item> </additional_files_needed> <additional_files_needed> @@ -203,7 +248,7 @@ <custom_add_php_command> </custom_add_php_command> <custom_php_resync_config_command> - sync_package_snort(); + sync_snort_package(); </custom_php_resync_config_command> <custom_php_install_command> snort_postinstall(); diff --git a/config/snort-dev/snort_alerts.php b/config/snort-dev/snort_alerts.php index fe466f6d..0a666cc1 100644 --- a/config/snort-dev/snort_alerts.php +++ b/config/snort-dev/snort_alerts.php @@ -221,9 +221,9 @@ include("head.inc"); ?> -<link rel="stylesheet" href="/snort/style.css" type="text/css" media="all"> -<script type="text/javascript" src="/snort/mootools.js"></script> -<script type="text/javascript" src="/snort/sortableTable.js"></script> +<link rel="stylesheet" href="/snort/css/style.css" type="text/css" media="all"> +<script type="text/javascript" src="/snort/javascript/mootools.js"></script> +<script type="text/javascript" src="/snort/javascript/sortableTable.js"></script> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> diff --git a/config/snort-dev/snort_download_rules.php b/config/snort-dev/snort_download_rules.php index 86bb0cac..f196a2e0 100644 --- a/config/snort-dev/snort_download_rules.php +++ b/config/snort-dev/snort_download_rules.php @@ -181,8 +181,8 @@ include("/usr/local/www/head.inc"); ?> <script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script> -<script type="text/javascript" src="/snort/jquery-1.3.2.js"></script> -<script type="text/javascript" src="/snort/jquery.blockUI.js?v2.28"></script> +<script type="text/javascript" src="/snort/javascript/jquery-1.3.2.js"></script> +<script type="text/javascript" src="/snort/javascript/jquery.blockUI.js?v2.28"></script> <script type="text/javascript"> <!-- @@ -685,9 +685,9 @@ if ($snortdownload != "off") exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$snortdir} so_rules/web-misc.rules/"); /* add prefix to all snort.org files */ /* remove this part and make it all php with the simplst code posible */ - chdir ("/usr/local/etc/snort/rules_bk/rules"); - sleep(2); - exec('/usr/local/bin/snort_rename.pl s/^/snort_/ *.rules'); + //chdir ("/usr/local/etc/snort/rules_bk/rules"); + //sleep(2); + //exec('/usr/local/bin/snort_rename.pl s/^/snort_/ *.rules'); update_status(gettext("Done extracting Rules.")); }else{ update_status(gettext("The Download rules file missing...")); diff --git a/config/snort-dev/snort_gui.inc b/config/snort-dev/snort_gui.inc index 90fc8505..d8743b43 100644 --- a/config/snort-dev/snort_gui.inc +++ b/config/snort-dev/snort_gui.inc @@ -36,7 +36,7 @@ function print_info_box_np2($msg) { echo " <td>\n"; echo " <div style='background-color:#990000' id='redbox'>\n"; echo " <table width='100%'><tr><td width='8%'>\n"; - echo " <img style='vertical-align:middle' src=\"/snort/alert.jpg\" width=\"32\" height=\"28\">\n"; + echo " <img style='vertical-align:middle' src=\"/snort/images/alert.jpg\" width=\"32\" height=\"28\">\n"; echo " </td>\n"; echo " <td width='70%'><font color='white'><b>{$msg}</b></font>\n"; echo " </td>"; diff --git a/config/snort-dev/snort_interfaces.php b/config/snort-dev/snort_interfaces.php index 20453335..2276825a 100644 --- a/config/snort-dev/snort_interfaces.php +++ b/config/snort-dev/snort_interfaces.php @@ -271,7 +271,7 @@ if ($_GET['act'] == "toggle" && $_GET['id'] != "") header("Location: snort_interfaces.php"); }else{ - sync_package_snort(); + sync_snort_package_all(); exec("/bin/sh /usr/local/etc/rc.d/snort_{$id}{$if_real2}.sh start"); header("Location: snort_interfaces.php"); } diff --git a/config/snort-dev/snort_interfaces_edit.php b/config/snort-dev/snort_interfaces_edit.php index 32fa911e..9b10bdf6 100644 --- a/config/snort-dev/snort_interfaces_edit.php +++ b/config/snort-dev/snort_interfaces_edit.php @@ -167,26 +167,26 @@ if ($_POST["Submit"]) { // if ($config['installedpackages']['snortglobal']['rule']) { - if ($_POST['descr'] == "") { - $input_errors[] = "Please enter a description for your reference."; - } +// if ($_POST['descr'] == "") { +// $input_errors[] = "Please enter a description for your reference."; +// } - if ($id == "" && $config['installedpackages']['snortglobal']['rule'][0]['interface'] != "") { +// if ($id == "" && $config['installedpackages']['snortglobal']['rule'][0]['interface'] != "") { - $rule_array = $config['installedpackages']['snortglobal']['rule']; - $id_c = -1; - foreach ($rule_array as $value) { +// $rule_array = $config['installedpackages']['snortglobal']['rule']; +// $id_c = -1; +// foreach ($rule_array as $value) { - $id_c += 1; +// $id_c += 1; - $result_lan = $config['installedpackages']['snortglobal']['rule'][$id_c]['interface']; - $if_real = convert_friendly_interface_to_real_interface_name($result_lan); +// $result_lan = $config['installedpackages']['snortglobal']['rule'][$id_c]['interface']; +// $if_real = convert_friendly_interface_to_real_interface_name($result_lan); - if ($_POST['interface'] == $result_lan) { - $input_errors[] = "Interface $result_lan is in use. Please select another interface."; - } - } - } +// if ($_POST['interface'] == $result_lan) { +// $input_errors[] = "Interface $result_lan is in use. Please select another interface."; +// } +// } +// } /* check for overlaps */ foreach ($a_nat as $natent) { @@ -278,7 +278,7 @@ if ($_POST["Submit"]) { // stop_service("snort"); if ($pconfig['interface'] != "") { - sync_package_snort(); + sync_snort_package_all(); } if ($pconfig['interface'] != "") { @@ -292,7 +292,7 @@ if ($_POST["Submit"]) { } if ($_POST["Submit2"]) { - sync_package_snort(); + sync_snort_package_all(); sleep(1); exec("/bin/sh /usr/local/etc/rc.d/snort_{$id}{$if_real}.sh restart"); header("Location: /snort/snort_interfaces_edit.php?id=$id"); diff --git a/config/snort-dev/snort_whitelists.php b/config/snort-dev/snort_whitelists.php deleted file mode 100644 index 6558ba2a..00000000 --- a/config/snort-dev/snort_whitelists.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/* - vpn_ipsec_keys.php - part of m0n0wall (http://m0n0.ch/wall) - - Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -require("guiconfig.inc"); - -if (!is_array($config['installedpackages']['snortglobal']['rule'])) { - $config['installedpackages']['snortglobal']['rule'] = array(); -} - -$a_nat = &$config['installedpackages']['snortglobal']['rule']; - -if ($_GET['act'] == "del") { - if ($a_nat[$_GET['id']]) { - unset($a_nat[$_GET['id']]); - write_config(); - touch($d_ipsecconfdirty_path); - header("Location: vpn_ipsec_keys.php"); - exit; - } -} - -$pgtitle = "Snort: Whitelists"; -include("head.inc"); - -?> - -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php include("fbegin.inc"); ?> -<p class="pgtitle"><?=$pgtitle?></p> -<form action="vpn_ipsec.php" method="post"> -<?php if ($savemsg) print_info_box($savemsg); ?> -<?php if (file_exists($d_ipsecconfdirty_path)): ?><p> -<?php print_info_box_np("The IPsec tunnel configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br> -<?php endif; ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td class="tabnavtbl"> -<?php - $tab_array = array(); - $tab_array[] = array("Snort Inertfaces", false, "/snort/snort_interfaces.php"); - $tab_array[] = array("Global Settings", true, "/snort/snort_interfaces_global.php"); - $tab_array[] = array("Rule Updates", false, "/snort/snort_download_rules.php"); - $tab_array[] = array("Alerts", false, "/snort/snort_alerts.php"); - $tab_array[] = array("Blocked", false, "/snort/snort_blocked.php"); - $tab_array[] = array("Whitelists", false, "/pkg.php?xml=/snort/snort_whitelist.xml"); - $tab_array[] = array("Help & Info", false, "/snort/snort_help_info.php"); - display_top_tabs($tab_array); -?> - </td></tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="40%" class="listhdrr">Ip</td> - <td width="60%" class="listhdr">Description</td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="20" heigth="17"></td> - <td><a href="vpn_ipsec_keys_edit.php"><img src="../themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add key" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - <?php $i = 0; foreach ($a_nat as $secretent): ?> - <tr> - <td class="listlr"> - <?=htmlspecialchars($secretent['ip']);?> - </td> - <td class="listbg"> - <?=htmlspecialchars($secretent['description']);?> - </td> - <td class="list" nowrap> <a href="vpn_ipsec_keys_edit.php?id=<?=$i;?>"><img src="../themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit key" width="17" height="17" border="0"></a> - <a href="vpn_ipsec_keys.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this pre-shared key?')"><img src="../themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="delete key" width="17" height="17" border="0"></a></td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="2"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="20" heigth="17"></td> - <td><a href="vpn_ipsec_keys_edit.php"><img src="../themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add key" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - </table> - </div> - </td> - </tr> -</table> -</form> -<?php include("fend.inc"); ?> -</body> -</html> |