diff options
author | Renato Botelho <renato.botelho@bluepex.com> | 2010-08-03 10:59:34 -0300 |
---|---|---|
committer | Renato Botelho <renato.botelho@bluepex.com> | 2010-08-03 10:59:34 -0300 |
commit | 270f81d9607be5f372a4bb89bbb53dd1e45a1f82 (patch) | |
tree | b9511afa10dfd1b311606a74af707f000b50e9e4 /usr/local | |
parent | 416686be4caf89487f98f6bade2c6a72887e9157 (diff) | |
parent | 073a2697dd86a8dece8dafa28b71084a547ba31e (diff) | |
download | pfsense-270f81d9607be5f372a4bb89bbb53dd1e45a1f82.zip pfsense-270f81d9607be5f372a4bb89bbb53dd1e45a1f82.tar.gz |
Merge remote branch 'mainline/master' into 2_firewall
Conflicts:
usr/local/www/diag_nanobsd.php
usr/local/www/diag_packet_capture.php
usr/local/www/firewall_shaper.php
Diffstat (limited to 'usr/local')
56 files changed, 847 insertions, 302 deletions
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php index 7d432e2..5a089e5 100755 --- a/usr/local/captiveportal/index.php +++ b/usr/local/captiveportal/index.php @@ -318,7 +318,7 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut } } } else { - portal_reply_page($redirurl, "error", "Username: {$username} is known with another mac address.", + portal_reply_page($redirurl, "error", "Username: {$username} is already authenticated using another MAC address.", $clientmac, $clientip, $username, $password); exit; } diff --git a/usr/local/pkg/carp_settings.xml b/usr/local/pkg/carp_settings.xml index 97aee7a..0ebe98d 100644 --- a/usr/local/pkg/carp_settings.xml +++ b/usr/local/pkg/carp_settings.xml @@ -77,6 +77,12 @@ </description> </field> <field> + <fielddescr>Synchronize Users and Groups</fielddescr> + <fieldname>synchronizeusers</fieldname> + <description>When this option is enabled, this system will automatically sync the users and groups over to the other CARP host when changes are made.</description> + <type>checkbox</type> + </field> + <field> <fielddescr>Synchronize rules</fielddescr> <fieldname>synchronizerules</fieldname> <description>When this option is enabled, this system will automatically sync the firewall rules to the other CARP host when changes are made..</description> @@ -192,3 +198,4 @@ filter_configure(); </custom_add_php_command_late> </packagegui> + diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php index 793a9ae..8693625 100755 --- a/usr/local/www/carp_status.php +++ b/usr/local/www/carp_status.php @@ -55,18 +55,41 @@ if($_POST['disablecarp'] <> "") { if($status == true) { $carp_ints = get_all_carp_interfaces(); mwexec("/sbin/sysctl net.inet.carp.allow=0"); - $carp_counter = find_number_of_created_carp_interfaces(); - if (is_array($carp_ints)) { - foreach($carp_ints as $int) { - mwexec("/sbin/ifconfig $int down"); - mwexec("/sbin/ifconfig $int destroy"); - } - } + if(is_array($config['virtualip']['vip'])) { + $viparr = &$config['virtualip']['vip']; + foreach ($viparr as $vip) { + switch ($vip['mode']) { + case "carp": + interface_vip_bring_down($vip); + sleep(1); + break; + case "carpdev-dhcp": + interface_vip_bring_down($vip); + sleep(1); + break; + } + } + } $savemsg = "{$carp_counter} IPs have been disabled."; } else { $savemsg = "CARP has been enabled."; mwexec("/sbin/sysctl net.inet.carp.allow=1"); interfaces_carp_setup(); + if(is_array($config['virtualip']['vip'])) { + $viparr = &$config['virtualip']['vip']; + foreach ($viparr as $vip) { + switch ($vip['mode']) { + case "carp": + interface_carp_configure($vip); + sleep(1); + break; + case "carpdev-dhcp": + interface_carpdev_configure($vip); + sleep(1); + break; + } + } + } } } @@ -107,7 +130,7 @@ include("head.inc"); <p> <table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td class="listhdrr"><b><center>Carp Interface</center></b></td> + <td class="listhdrr"><b><center>CARP Interface</center></b></td> <td class="listhdrr"><b><center>Virtual IP</center></b></td> <td class="listhdrr"><b><center>Status</center></b></td> </tr> diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index 2e9e8b2..882240f 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -86,7 +86,7 @@ function add_base_packages_menu_items() { } function remove_bad_chars($string) { - return preg_replace('/[^a-z|_|0-9]/i','',$string); + return preg_replace('/[^a-z_0-9]/i','',$string); } function check_and_returnif_section_exists($section) { diff --git a/usr/local/www/diag_dns.php b/usr/local/www/diag_dns.php index d1392d3..c286d44 100644 --- a/usr/local/www/diag_dns.php +++ b/usr/local/www/diag_dns.php @@ -38,6 +38,54 @@ require("guiconfig.inc"); if ($_GET['host']) $_POST = $_GET; +if($_GET['createalias'] == "true") { + $host = trim($_POST['host']); + if($_GET['override']) + $override = true; + $a_aliases = &$config['aliases']['alias']; + $type = "hostname"; + $resolved = gethostbyname($host); + if($resolved) { + $host = trim($_POST['host']); + $dig=`dig "$host" A | grep "$host" | grep -v ";" | awk '{ print $5 }'`; + $resolved = split("\n", $dig); + $isfirst = true; + foreach($resolved as $re) { + if($re <> "") { + if(!$isfirst) + $addresses .= " "; + $addresses .= $re . "/32"; + $isfirst = false; + } + } + $newalias = array(); + $aliasname = str_replace(array(".","-"), "_", $host); + $alias_exists = false; + $counter=0; + foreach($a_aliases as $a) { + if($a['name'] == $aliasname) { + $alias_exists = true; + $id=$counter; + } + $counter++; + } + if($override) + $alias_exists = false; + if($alias_exists == false) { + $newalias['name'] = $aliasname; + $newalias['type'] = "network"; + $newalias['address'] = $addresses; + $newalias['descr'] = "Created from Diagnostics-> DNS Lookup"; + if($override) + $a_aliases[$id] = $newalias; + else + $a_aliases[] = $newalias; + write_config(); + $createdalias = true; + } + } +} + if ($_POST) { unset($input_errors); @@ -82,9 +130,13 @@ if ($_POST) { } elseif (is_hostname($host)) { $type = "hostname"; $resolved = gethostbyname($host); + if($resolved) { + $dig=`dig "$host" A | grep "$host" | grep -v ";" | awk '{ print $5 }'`; + $resolved = split("\n", $dig); + } $hostname = $host; if ($host != $resolved) - $ipaddr = $resolved; + $ipaddr = $resolved[0]; } if ($host == $resolved) { @@ -108,10 +160,42 @@ include("head.inc"); ?> <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("Hostname or IP");?></td> <td width="78%" class="vtable"> - <?=$mandfldhtml;?><input name="host" type="text" class="formfld" id="host" size="20" value="<?=htmlspecialchars($host);?>"> + <?=$mandfldhtml;?> + <table> + <tr><td valign="top"> + <input name="host" type="text" class="formfld" id="host" size="20" value="<?=htmlspecialchars($host);?>"> + </td> + <td> <? if ($resolved && $type) { ?> - = <font size="+1"><?php echo $resolved; ?><font size="-1>"> + = <font size="+1"> +<?php + $found = 0; + if(is_array($resolved)) { + foreach($resolved as $hostitem) { + if($hostitem <> "") { + echo $hostitem . "<br/>"; + $found++; + } + } + } else { + echo $resolved; + } + if($found > 0) { + if($alias_exists) { + echo "<br/><font size='-2'>An alias already exists for the hostname {$host}. To overwrite, click <a href='diag_dns.php?host=" . trim(urlencode($host)) . "&createalias=true&override=true'>here</a>."; + } else { + if(!$createdalias) { + echo "<br/><font size='-2'><a href='diag_dns.php?host=" . trim(urlencode($host)) . "&createalias=true'>Create alias</a> out of these entries."; + } else { + echo "<br/><font size='-2'>Alias created with name {$newalias['name']}"; + } + } + } +?> + <font size="-1>"> + <? } ?> + </td></tr></table> </td> </tr> <?php if($_POST): ?> diff --git a/usr/local/www/diag_logs_relayd.php b/usr/local/www/diag_logs_relayd.php index f267c74..7bf67bf 100755 --- a/usr/local/www/diag_logs_relayd.php +++ b/usr/local/www/diag_logs_relayd.php @@ -5,7 +5,7 @@ part of pfSense Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>. - Copyright (C) 2008 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2008 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/diag_nanobsd.php b/usr/local/www/diag_nanobsd.php index 3e9bed1..4e64c8f 100755 --- a/usr/local/www/diag_nanobsd.php +++ b/usr/local/www/diag_nanobsd.php @@ -67,10 +67,11 @@ nanobsd_detect_slice_info(); $NANOBSD_SIZE = nanobsd_get_size(); if($_POST['bootslice']) { + $statusmsg = gettext("Setting slice information, please wait..."); echo <<<EOF <div id="loading"> <img src="/themes/metallic/images/misc/loader.gif"> - Setting slice information, please wait... + $statusmsg <p/> </div> EOF; @@ -82,10 +83,11 @@ EOF; } if($_POST['destslice']) { + $statusmsg = gettext("Duplicating slice. Please wait, this will take a moment..."); echo <<<EOF <div id="loading"> <img src="/themes/metallic/images/misc/loader.gif"> - Duplicating slice. Please wait, this will take a moment... + $statusmsg <p/> </div> EOF; diff --git a/usr/local/www/diag_overload_tables.php b/usr/local/www/diag_overload_tables.php index 235e868..7b0ffe1 100644 --- a/usr/local/www/diag_overload_tables.php +++ b/usr/local/www/diag_overload_tables.php @@ -48,12 +48,9 @@ require_once("guiconfig.inc"); // Set default table $tablename = "sshlockout"; -if($_REQUEST['type'] == "sshlockout") - $tablename = "sshlockout"; +if($_REQUEST['type']) + $tablename = $_REQUEST['type']; -if($_REQUEST['type'] == "virusprot") - $tablename = "virusprot"; - if($_REQUEST['delete']) { if(is_ipaddr($_REQUEST['delete'])) { exec("/sbin/pfctl -t " . escapeshellarg($_REQUEST['type']) . " -T delete " . escapeshellarg($_REQUEST['delete']), $delete); @@ -73,6 +70,7 @@ if($_REQUEST['deleteall']) { } exec("/sbin/pfctl -t $tablename -T show", $entries); +exec("/sbin/pfctl -sT", $tables); include("head.inc"); include("fbegin.inc"); @@ -98,9 +96,13 @@ include("fbegin.inc"); Table: <select id='type' onChange='method_change($F("type"));' name='type'> - <option name='<?=$tablename?>' value='<?=$tablename?>'><?=$tablename?></option> - <option name='virusprot' value='virusprot'>virusprot</option> - <option name='sshlockout' value='sshlockout'>sshlockout</option> + <?php foreach ($tables as $table) { + echo "<option name='{$table}' value='{$table}'"; + if ($tablename == $table) + echo " selected "; + echo ">{$table}</option>\n"; + } + ?> </select> <p/> diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php index 68248ea..bfdb52d 100644 --- a/usr/local/www/diag_packet_capture.php +++ b/usr/local/www/diag_packet_capture.php @@ -41,7 +41,7 @@ require_once("pfsense-utils.inc"); $fp = "/root/"; $fn = "packetcapture.cap"; -$snaplen = 1500;//default packet length +$snaplen = 0;//default packet length $count = 100;//default number of packets to capture if ($_POST) { @@ -71,8 +71,8 @@ if ($_POST) { unlink ($fp.$fn); } elseif ($_POST['stopbtn']!= "") { - $action = "Stop"; - $processes_running = trim(shell_exec('/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep $fn | /usr/bin/grep -v pflog')); + $action = gettext("Stop"); + $processes_running = trim(shell_exec('/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep '.$fn.' | /usr/bin/grep -v pflog')); //explode processes into an array, (delimiter is new line) $processes_running_array = explode("\n", $processes_running); @@ -120,12 +120,12 @@ include("fbegin.inc"); $interfaces = get_configured_interface_with_descr(); foreach ($interfaces as $iface => $ifacename): ?> - <option value="<?=$iface;?>" <?php if (!link_interface_to_bridge($iface) && $selectedif == $iface) echo "selected"; ?>> + <option value="<?=$iface;?>" <?php if ($selectedif == $iface) echo "selected"; ?>> <?php echo $ifacename;?> </option> <?php endforeach;?> </select> - <br/>Select the interface the traffic will be passing through. Typically this will be the WAN interface. + <br/><?=gettext("Select the interface on which to capture traffic. ");?> </td> </tr> <tr> @@ -149,7 +149,7 @@ include("fbegin.inc"); <td width="17%" valign="top" class="vncellreq">Packet Length</td> <td width="83%" class="vtable"> <input name="snaplen" type="text" class="formfld unknown" id="snaplen" size="5" value="<?=$snaplen;?>"> - <br/>The Packet length is the number of bytes the packet will capture for each payload. Default value is 1500. + <br/><?=gettext("The Packet length is the number of bytes of each packet that will be captured. Default value is 0, which will capture the entire frame regardless of its size.");?> </td> </tr> <tr> diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 488a313..9bcc8b5 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -105,8 +105,7 @@ $interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfac // Firewall $firewall_menu = array(); $firewall_menu[] = array("Aliases", "/firewall_aliases.php"); -if(count($config['interfaces']) > 1) - $firewall_menu[] = array("NAT", "/firewall_nat.php"); +$firewall_menu[] = array("NAT", "/firewall_nat.php"); $firewall_menu[] = array("Rules", "/firewall_rules.php"); $firewall_menu[] = array("Schedules", "/firewall_schedule.php"); $firewall_menu[] = array("Traffic Shaper", "/firewall_shaper.php"); diff --git a/usr/local/www/firewall_aliases.php b/usr/local/www/firewall_aliases.php index c06f6fa..8bcfcf6 100755 --- a/usr/local/www/firewall_aliases.php +++ b/usr/local/www/firewall_aliases.php @@ -87,26 +87,29 @@ if ($_GET['act'] == "del") { if($is_alias_referenced == false) { if(is_array($config['filter']['rule'])) { foreach($config['filter']['rule'] as $rule) { - if($rule['source']['address'] && $rule['source']['address'] == $alias_name) { - $is_alias_referenced = true; - $referenced_by = $rule['descr']; - break; - } - if($rule['source']['port'] && $rule['source']['port'] == $alias_name) { - $is_alias_referenced = true; - $referenced_by = $rule['descr']; - break; - } - if($rule['destination']['address'] && $rule['destination']['address'] == $alias_name) { - $is_alias_referenced = true; - $referenced_by = $rule['descr']; - break; - } - if($rule['destination']['port'] && $rule['destination']['port'] == $alias_name) { - $is_alias_referenced = true; - $referenced_by = $rule['descr']; - break; + if($rule['source']) { + if($rule['source']['address'] && $rule['source']['address'] == $alias_name) { + $is_alias_referenced = true; + $referenced_by = $rule['descr']; + break; + } + if($rule['source']['port'] && $rule['source']['port'] == $alias_name) { + $is_alias_referenced = true; + $referenced_by = $rule['descr']; + break; + } + if($rule['destination']['address'] && $rule['destination']['address'] == $alias_name) { + $is_alias_referenced = true; + $referenced_by = $rule['descr']; + break; + } } + if($rule['destination']) + if($rule['destination']['port'] && $rule['destination']['port'] == $alias_name) { + $is_alias_referenced = true; + $referenced_by = $rule['descr']; + break; + } } } } diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index 22479dc..27b0e5c 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -46,7 +46,7 @@ // Keywords not allowed in names -$reserved_keywords = array("pass", "out", "queue", "max", "min", "pptp", "pppoe", "l2tp", "openvpn"); +$reserved_keywords = array("pass", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec"); require("guiconfig.inc"); require_once("functions.inc"); diff --git a/usr/local/www/firewall_aliases_import.php b/usr/local/www/firewall_aliases_import.php index 1902fd1..39311c4 100755 --- a/usr/local/www/firewall_aliases_import.php +++ b/usr/local/www/firewall_aliases_import.php @@ -38,7 +38,7 @@ ##|-PRIV -$reserved_keywords = array("pass", "out", "queue", "max", "min", "pptp"); +$reserved_keywords = array("pass", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec"); require("guiconfig.inc"); require_once("util.inc"); diff --git a/usr/local/www/firewall_nat.php b/usr/local/www/firewall_nat.php index 4cab5d6..9646f52 100755 --- a/usr/local/www/firewall_nat.php +++ b/usr/local/www/firewall_nat.php @@ -261,12 +261,10 @@ echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript <td class="listlr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';"> <?=$textss;?> <?php - if (!$natent['interface'] || ($natent['interface'] == "wan")) - echo "WAN"; - else if(strtolower($natent['interface']) == "lan") - echo "LAN"; + if (!$natent['interface']) + echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan")); else - echo strtoupper($config['interfaces'][$natent['interface']]['descr']); + echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?> <?=$textse;?> </td> diff --git a/usr/local/www/firewall_nat_1to1.php b/usr/local/www/firewall_nat_1to1.php index 1472146..74e0ce8 100755 --- a/usr/local/www/firewall_nat_1to1.php +++ b/usr/local/www/firewall_nat_1to1.php @@ -117,10 +117,10 @@ include("head.inc"); <tr> <td class="listlr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';"> <?php - if (!$natent['interface'] || ($natent['interface'] == "wan")) - echo "WAN"; + if (!$natent['interface']) + echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan")); else - echo htmlspecialchars($config['interfaces'][$natent['interface']]['descr']); + echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?> </td> <td class="listr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';"> diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php index 7c248b7..2039848 100755 --- a/usr/local/www/firewall_nat_out.php +++ b/usr/local/www/firewall_nat_out.php @@ -361,14 +361,10 @@ include("head.inc"); <td class="listt" align="center"></td> <td class="listlr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';"> <?php - if (!$natent['interface'] || ($natent['interface'] == "wan")) - echo "WAN"; - else if (!$natent['interface'] || ($natent['interface'] == "lan")) - echo "LAN"; - else if ($natent['interface'] == "openvpn") - echo "OpenVPN"; + if (!$natent['interface']) + echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan")); else - echo htmlspecialchars($config['interfaces'][$natent['interface']]['descr']); + echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?> </td> diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php index 7382c7e..26954c2 100755 --- a/usr/local/www/firewall_shaper.php +++ b/usr/local/www/firewall_shaper.php @@ -341,9 +341,9 @@ $tree .= "</ul>"; if (!$dontshow || $newqueue) { -$output_form .= "<tr><td width=\"22%\" valign=\"top\" class=\"vncellreq\">"; -$output_form .= gettext("Queue Actions"); -$output_form .= "</td><td valign=\"top\" class=\"vncellreq\" width=\"78%\">"; +$output_form .= "<tr><td width=\"22%\" valign=\"center\" class=\"vncellreq\">"; +$output_form .= "<br />" . gettext("Queue Actions") . "<br />"; +$output_form .= "</td><td valign=\"center\" class=\"vncellreq\" width=\"78%\"><br />"; $output_form .= "<input type=\"submit\" name=\"Submit\" value=\"" . gettext("Save") . "\" class=\"formbtn\" />"; if ($can_add || $addnewaltq) { @@ -368,9 +368,9 @@ if ($can_add || $addnewaltq) { $output_form .= " value=\"" . gettext("Disable shaper on interface") . "\">"; $output_form .= "</a>"; } -$output_form .= "</td></tr>"; +$output_form .= "<br /></td></tr>"; $output_form .= "</div>"; -} +} else $output_form .= "</div>"; diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 1125312..605705e 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -206,11 +206,12 @@ $wkports = array( /* TCP flags */ $tcpflags = array("fin", "syn", "rst", "psh", "ack", "urg"); -$specialnets = array("wanip" => "WAN address", "lanip" => "LAN address", "lan" => "LAN net", "pptp" => "PPTP clients", "pppoe" => "PPPoE clients", "l2tp" => "L2TP clients"); +$specialnets = array("pptp" => "PPTP clients", "pppoe" => "PPPoE clients", "l2tp" => "L2TP clients"); -$spiflist = get_configured_interface_with_descr(true, true); +$spiflist = get_configured_interface_with_descr(false, true); foreach ($spiflist as $ifgui => $ifdesc) { $specialnets[$ifgui] = $ifdesc . " net"; + $specialnets[$ifgui . 'ip'] = $ifdesc . " address"; } $medias = array("auto" => "autoselect", "100full" => "100BASE-TX full-duplex", @@ -422,11 +423,7 @@ function pprint_address($adr) { if (isset($adr['any'])) { $padr = "*"; } else if ($adr['network']) { - if (preg_match("/opt[0-999]ip/", $adr['network'])) { - $padr = "Interface IP address"; - } else { - $padr = $specialnets[$adr['network']]; - } + $padr = $specialnets[$adr['network']]; } else { $padr = $adr['address']; } diff --git a/usr/local/www/head.inc b/usr/local/www/head.inc index 3b1f028..076f274 100755 --- a/usr/local/www/head.inc +++ b/usr/local/www/head.inc @@ -76,4 +76,17 @@ $pagetitle = gentitle( $pgtitle ); if (!isset($closehead)) echo "</head>"; + +/* If this page is being remotely managed then do not allow the loading of the contents. */ +if($config['remote_managed_pages']['item']) { + foreach($config['remote_managed_pages']['item'] as $rmp) { + if($rmp == $_SERVER['SCRIPT_NAME']) { + include("fbegin.inc"); + print_info_box_np("This page is currently being managed by a remote machine."); + include("fend.inc"); + exit; + } + } +} + ?>
\ No newline at end of file diff --git a/usr/local/www/installer.php b/usr/local/www/installer.php index f988d02..f5e37e0 100644 --- a/usr/local/www/installer.php +++ b/usr/local/www/installer.php @@ -27,8 +27,15 @@ POSSIBILITY OF SUCH DAMAGE. */ +require("globals.inc"); require("guiconfig.inc"); +// Handle other type of file systems +if($_REQUEST['fstype']) + $fstype = strtoupper($_REQUEST['fstype']); +else + $fstype = "UFS+S"; + if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") { Header("Location: /index.php"); exit; @@ -42,13 +49,12 @@ switch ($_REQUEST['state']) { case "update_installer_status": update_installer_status(); exit; - case "quickeasyinstall": - begin_quick_easy_install(); default: installer_main(); } function write_out_pc_sysinstaller_config($disk) { + global $fstype; $fd = fopen("/PCBSD/pc-sysinstall/examples/pfSense-install.cfg", "w"); if(!$fd) { return true; @@ -71,7 +77,7 @@ commitDiskPart # All sizes are expressed in MB # Avail FS Types, UFS, UFS+S, UFS+J, ZFS, SWAP # Size 0 means use the rest of the slice size -disk0-part=UFS+S 0 / +disk0-part={$fstype} 0 / # Do it now! commitDiskLabel @@ -83,7 +89,7 @@ packageType=cpdup # Optional Components cpdupPaths=boot,COPYRIGHT,bin,conf,conf.default,dev,etc,home,kernels,libexec,lib,root,sbin,sys,usr,var -runExtCommand=chmod a+rx /usr/local/bin/after_installation_routines.sh && cd / && /usr/local/bin/after_installation_routines.sh +# runExtCommand=chmod a+rx /usr/local/bin/after_installation_routines.sh && cd / && /usr/local/bin/after_installation_routines.sh EOF; fwrite($fd, $config); fclose($fd); @@ -91,40 +97,140 @@ EOF; } function start_installation() { + global $g, $fstype; + if(file_exists("/tmp/install_complete")) + return; + $ps_running = exec("ps awwwux | grep -v grep | grep 'sh /tmp/installer.sh'"); + if($ps_running) + return; $fd = fopen("/tmp/installer.sh", "w"); if(!$fd) { die("Could not open /tmp/installer.sh for writing"); exit; - } - fwrite($fd, "/PCBSD/pc-sysinstall/pc-sysinstall -c /PCBSD/pc-sysinstall/examples/pfSense-install.cfg && touch /tmp/install_complete"); + } + fwrite($fd, "rm /tmp/.pc-sysinstall/pc-sysinstall.log 2>/dev/null\n"); + fwrite($fd, "/PCBSD/pc-sysinstall/pc-sysinstall -c /PCBSD/pc-sysinstall/examples/pfSense-install.cfg \n"); + fwrite($fd, "chmod a+rx /usr/local/bin/after_installation_routines.sh\n"); + fwrite($fd, "cd / && /usr/local/bin/after_installation_routines.sh\n"); + fwrite($fd, "mkdir /mnt/tmp\n"); + fwrite($fd, "umount /mnt\n"); + fwrite($fd, "touch /tmp/install_complete\n"); fclose($fd); exec("chmod a+rx /tmp/installer.sh"); mwexec_bg("sh /tmp/installer.sh"); } function installer_find_first_disk() { + global $g, $fstype; $disk = `/PCBSD/pc-sysinstall/pc-sysinstall disk-list | head -n1 | cut -d':' -f1`; return $disk; } function update_installer_status() { - if(!file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) + global $g, $fstype; + // Ensure status files exist + if(!file_exists("/tmp/installer_installer_running")) + touch("/tmp/installer_installer_running"); + $status = `cat /tmp/.pc-sysinstall/pc-sysinstall.log`; + $status = str_replace("\n", "\\n", $status); + $status = str_replace("\n", "\\r", $status); + echo "this.document.forms[0].installeroutput.value='$status';\n"; + echo "this.document.forms[0].installeroutput.scrollTop = this.document.forms[0].installeroutput.scrollHeight;\n"; + // Find out installer progress + $progress = "5"; + if(strstr($status, "Running: dd")) + $progress = "6"; + if(strstr($status, "Running: gpart create -s GPT")) + $progress = "7"; + if(strstr($status, "Running: gpart bootcode")) + $progress = "7"; + if(strstr($status, "Running: newfs -U")) + $progress = "8"; + if(strstr($status, "Running: sync")) + $progress = "9"; + if(strstr($status, "/boot /mnt/boot")) + $progress = "10"; + if(strstr($status, "/COPYRIGHT /mnt/COPYRIGHT")) + $progress = "11"; + if(strstr($status, "/bin /mnt/bin")) + $progress = "12"; + if(strstr($status, "/conf /mnt/conf")) + $progress = "15"; + if(strstr($status, "/conf.default /mnt/conf.default")) + $progress = "20"; + if(strstr($status, "/dev /mnt/dev")) + $progress = "25"; + if(strstr($status, "/etc /mnt/etc")) + $progress = "30"; + if(strstr($status, "/home /mnt/home")) + $progress = "35"; + if(strstr($status, "/kernels /mnt/kernels")) + $progress = "40"; + if(strstr($status, "/libexec /mnt/libexec")) + $progress = "50"; + if(strstr($status, "/lib /mnt/lib")) + $progress = "60"; + if(strstr($status, "/root /mnt/root")) + $progress = "70"; + if(strstr($status, "/sbin /mnt/sbin")) + $progress = "75"; + if(strstr($status, "/sys /mnt/sys")) + $progress = "80"; + if(strstr($status, "/usr /mnt/usr")) + $progress = "95"; + if(strstr($status, "/usr /mnt/usr")) + $progress = "90"; + if(strstr($status, "/var /mnt/var")) + $progress = "95"; + if(strstr($status, "cap_mkdb /etc/login.conf")) + $progress = "96"; + if(strstr($status, "Setting hostname")) + $progress = "97"; + if(strstr($status, "umount -f /mnt")) + $progress = "98"; + if(strstr($status, "umount -f /mnt")) + $progress = "99"; + if(strstr($status, "Installation finished")) + $progress = "100"; + // Check for error and bail if we see one. + if(stristr($status, "error")) { + $error = true; + echo "\$('installerrunning').innerHTML='<img class=\"infoboxnpimg\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\"> <font size=\"2\"><b>An error occurred. Aborting installation.'; "; + echo "\$('progressbar').style.width='100%';\n"; + unlink("/tmp/install_complete"); return; - echo `tail -n20 /tmp/.pc-sysinstall/pc-sysinstall.log`; + } + $running_old = trim(file_get_contents("/tmp/installer_installer_running")); + if($installer_running <> "running") { + $ps_running = exec("ps awwwux | grep -v grep | grep 'sh /tmp/installer.sh'"); + if($ps_running) { + $running = "\$('installerrunning').innerHTML='<table><tr><td valign=\"middle\"><img src=\"/themes/{$g['theme']}/images/misc/loader.gif\"></td><td valign=\"middle\"> <font size=\"2\"><b>Installer running ({$progress}% completed)...</td></tr></table>'; "; + if($running_old <> $running) { + echo $running; + file_put_contents("/tmp/installer_installer_running", "$running"); + } + } + } + if($progress) + echo "\$('progressbar').style.width='{$progress}%';\n"; if(file_exists("/tmp/install_complete")) { - echo "Installation completed."; + echo "\$('installerrunning').innerHTML='<img class=\"infoboxnpimg\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\"> <font size=\"+1\">Installation completed. Please <a href=\"reboot.php\">reboot</a> to continue';\n"; unlink_if_exists("/tmp/installer.sh"); + file_put_contents("/tmp/installer_installer_running", "finished"); } } function update_installer_status_win($status) { + global $g, $fstype; echo "<script type=\"text/javascript\">\n"; - echo "\$('installeroutput').value = '" . str_replace(htmlentities($status), "\n", "") . "';\n"; - echo "installeroutput.scroll = installeroutput.maxScroll;\n"; + echo " \$('installeroutput').value = '" . str_replace(htmlentities($status), "\n", "") . "';\n"; echo "</script>"; } function begin_quick_easy_install() { + global $g, $fstype; + if(file_exists("/tmp/install_complete")) + return; unlink_if_exists("/tmp/install_complete"); $disk = installer_find_first_disk(); if(!$disk) { @@ -138,37 +244,69 @@ function begin_quick_easy_install() { start_installation(); } +function head_html() { + global $g, $fstype; + echo <<<EOF +<html> + <head> + <style type='text/css'> + a:link { + color: #000000; + text-decoration:underline; + font-size:14; + } + a:visited { + color: #000000; + text-decoration:underline; + font-size:14; + } + a:hover { + color: #FFFF00; + text-decoration: none; + font-size:14; + } + a:active { + color: #FFFF00; + text-decoration:underline; + font-size:14; + } + </style> + </head> +EOF; + +} + function body_html() { + global $g, $fstype; $pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); if(strstr($pfSversion, "1.2")) $one_two = true; - $pgtitle = "pfSense: Installer"; + $pgtitle = "{$g['product_name']}: Installer"; include("head.inc"); echo <<<EOF <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script> - <script type="text/javascript"> - function getinstallerprogress() { - url = 'installer.php'; - pars = 'state=update_installer_status'; - callajax(url, pars, installcallback); - } - function callajax(url, pars, activitycallback) { - var myAjax = new Ajax.Request( - url, - { - method: 'post', - parameters: pars, - onComplete: activitycallback - }); - } - function installcallback(transport) { - this.document.forms[0].installeroutput.value=transport.responseText; - setTimeout('getinstallerprogress()', 1000); - } + <script type="text/javascript"> + function getinstallerprogress() { + url = 'installer.php'; + pars = 'state=update_installer_status'; + callajax(url, pars, installcallback); + } + function callajax(url, pars, activitycallback) { + var myAjax = new Ajax.Request( + url, + { + method: 'post', + parameters: pars, + onComplete: activitycallback + }); + } + function installcallback(transport) { + setTimeout('getinstallerprogress()', 2000); + eval(transport.responseText); + } </script> EOF; - include("fbegin.inc"); if($one_two) echo "<p class=\"pgtitle\">{$pgtitle}</font></p>"; @@ -177,13 +315,15 @@ EOF; } function end_html() { + global $g, $fstype; echo "</form>"; - include("fend.inc"); echo "</body>"; echo "</html>"; } function template() { + global $g, $fstype; + head_html(); body_html(); echo <<<EOF <div id="mainlevel"> @@ -212,64 +352,158 @@ EOF; } function quickeasyinstall_gui() { + global $g, $fstype; + head_html(); body_html(); + echo "<form action=\"installer.php\" method=\"post\" state=\"step1_post\">"; + page_table_start(); echo <<<EOF - <div id="mainlevel"> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabcont" > - <form action="installer.php" method="post" state="step1_post"> - <div id="pfsenseinstaller"> - Starting Installer... Please wait...<p/> - {{ Insert progressbar here }}<p/> - <textarea name='installeroutput' id='installeroutput' rows="20" cols="80"> - </textarea> - </div> - </td> - </tr> - </table> - </div> - </td> - </tr> + <center> + <table width="100%"> + <tr><td> + <div id="mainlevel"> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div id="mainarea"> + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div id="pfsenseinstaller" width="100%"> + <div id='installerrunning' width='100%' style="padding:8px; border:1px dashed #000000"> + <table> + <tr> + <td valign="middle"> + <img src="/themes/{$g['theme']}/images/misc/loader.gif"> + </td> + <td valign="middle"> + <font size="2"><b>Starting Installer... Please wait... + </td> + </tr> + </table> + </div> + <br/> + <center> + <table height='15' width='640' border='0' colspacing='0' cellpadding='0' cellspacing='0'> + <tr> + <td background="./themes/the_wall/images/misc/bar_left.gif" height='15' width='5'> + </td> + <td> + <table id="progholder" name="progholder" height='15' width='630' border='0' colspacing='0' cellpadding='0' cellspacing='0'> + <td background="./themes/the_wall/images/misc/bar_gray.gif" valign="top" align="left"> + <img src='./themes/the_wall/images/misc/bar_blue.gif' width='0' height='15' name='progressbar' id='progressbar'> + </td> + </table> + </td> + <td background="./themes/the_wall/images/misc/bar_right.gif" height='15' width='5'> + </td> + </tr> + </table> + <br/> + <textarea name='installeroutput' id='installeroutput' rows="31" cols="90"> + </textarea> + </div> + </td> + </tr> + </table> + </div> + </td> + </tr> + </table> + </div> + </td></tr> </table> - </div> + </center> <script type="text/javascript">setTimeout('getinstallerprogress()', 250);</script> + EOF; + page_table_end(); end_html(); + begin_quick_easy_install(); +} + +function page_table_start() { + global $g, $fstype; + echo <<<EOF + <center> + <img border="0" src="./themes/{$g['theme']}/images/logo.gif"></a><br/> + <table cellpadding="6" cellspacing="0" width="640" height="480" style="border:1px solid #000000"> + <tr height="10" bgcolor="#990000"> + <td style="border-bottom:1px solid #000000"> + <font color='white'> + <b> + {$g['product_name']} installer + </b> + </font> + </td> + </tr> + <tr> + <td> + +EOF; + +} + +function page_table_end() { + global $g, $fstype; + echo <<<EOF + </td> + </tr> + </table> + </center> + +EOF; + } function installer_main() { + global $g, $fstype; + if(file_exists("/tmp/.pc-sysinstall/pc-sysinstall.log")) + unlink("/tmp/.pc-sysinstall/pc-sysinstall.log"); + head_html(); body_html(); + // Only enable ZFS if this exists. The install will fail otherwise. + if(file_exists("/boot/gptzfsboot")) + $zfs_enabled = "or <a href=\"installer.php?state=quickeasyinstall&fstype=ZFS\">ZFS</a> "; $disk = installer_find_first_disk(); if(!$disk) echo "WARNING: Could not find any suitable disks for installation."; + page_table_start(); echo <<<EOF - <div id="mainlevel"> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td class="tabcont" > - <form action="installer.php" method="post" state="step1_post"> - <div id="pfsenseinstaller"> - <a onclick="return confirm('Are you sure you want to install pfSense to $disk?')"> href='installer.php?state=quickeasyinstall'>Quick/Easy installation</a> - </p> - </div> - </td> - </tr> - </table> - </div> - </td> - </tr> - </table> - </div> + <form action="installer.php" method="post" state="step1_post"> + <div id="mainlevel"> + <center> + <b><font face="arial" size="+2">Welcome to the {$g['product_name']} PCSysInstaller!</b></font><p/> + <font face="arial" size="+1">This utility will install {$g['product_name']} to a hard disk, flash drive, etc.</font> + <table width="100%" border="0" cellpadding="5" cellspacing="0"> + <tr> + <td> + <center> + <div id="mainarea"> + <br/> + <center> + Please select an installer option to begin: + <table width="100%" border="0" cellpadding="5" cellspacing="5"> + <tr> + <td> + <div id="pfsenseinstaller"> + <center> + Rescue config.xml<p/> + Install {$g['product_name']} using the <a href="installer.php?state=quickeasyinstall">UFS</a> + {$zfs_enabled} + filesystem. + </p> + </div> + </td> + </tr> + </table> + </div> + </td> + </tr> + </table> + </div> EOF; + page_table_end(); end_html(); } diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 7d3a548..340a6f8 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -71,7 +71,7 @@ if (!is_array($config['ppps']['ppp'])) $a_ppps = &$config['ppps']['ppp']; function remove_bad_chars($string) { - return preg_replace('/[^a-z|_|0-9]/i','',$string); + return preg_replace('/[^a-z_0-9]/i','',$string); } if (!is_array($config['gateways']['gateway_item'])) @@ -215,6 +215,8 @@ $pconfig['mtu'] = $wancfg['mtu']; /* Wireless interface? */ if (isset($wancfg['wireless'])) { + /* Sync first to be sure it displays the actual settings that will be used */ + interface_sync_wireless_clones($wancfg, false); /* Get wireless modes */ $wlanif = get_real_interface($if); if (!does_interface_exist($wlanif)) @@ -228,6 +230,7 @@ if (isset($wancfg['wireless'])) { $wl_regdomains_attr = &$wl_regdomain_xml_attr['regulatory-domains']['rd']; $wl_countries = &$wl_regdomain_xml['country-codes']['country']; $wl_countries_attr = &$wl_regdomain_xml_attr['country-codes']['country']; + $pconfig['persistcommonwireless'] = isset($config['wireless']['interfaces'][$wlanbaseif]); $pconfig['standard'] = $wancfg['wireless']['standard']; $pconfig['mode'] = $wancfg['wireless']['mode']; $pconfig['protmode'] = $wancfg['wireless']['protmode']; @@ -666,7 +669,7 @@ if ($_POST) { } // end if($_POST) function handle_wireless_post() { - global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr; + global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr, $wlanbaseif; if (!is_array($wancfg['wireless'])) $wancfg['wireless'] = array(); $wancfg['wireless']['standard'] = $_POST['standard']; @@ -702,6 +705,11 @@ function handle_wireless_post() { $wancfg['wireless']['auth_server_addr'] = $_POST['auth_server_addr']; $wancfg['wireless']['auth_server_port'] = $_POST['auth_server_port']; $wancfg['wireless']['auth_server_shared_secret'] = $_POST['auth_server_shared_secret']; + if ($_POST['persistcommonwireless'] == "yes") { + if (!is_array($config['wireless']['interfaces'][$wlanbaseif])) + $config['wireless']['interfaces'][$wlanbaseif] = array(); + } else if (isset($config['wireless']['interfaces'][$wlanbaseif])) + unset($config['wireless']['interfaces'][$wlanbaseif]); if ($_POST['hidessid_enable'] == "yes") $wancfg['wireless']['hidessid']['enable'] = true; else if (isset($wancfg['wireless']['hidessid']['enable'])) @@ -1454,12 +1462,12 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" = <?php if (isset($pconfig['pppid'])): ?> <td width="78%" class="vtable"> <a href="/interfaces_ppps_edit.php?id=<?=htmlspecialchars($pconfig['pppid']);?>" class="navlnk">Click here</a> - for additional PPtP and L2tP configuration options. Save first if you made changes. + for additional PPTP and L2TP configuration options. Save first if you made changes. </td> <? else: ?> <td width="78%" class="vtable"> <a href="/interfaces_ppps_edit.php" class="navlnk">Click here</a> - for advanced PPtP and L2tP configuration options. + for advanced PPTP and L2TP configuration options. </td> <? endif; ?> </tr> @@ -1477,6 +1485,13 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" = <td colspan="2" valign="top" class="listtopic">Common wireless configuration - Settings apply to all wireless networks on <?=$wlanbaseif;?>.</td> </tr> <tr> + <td valign="top" class="vncell">Persist common settings</td> + <td class="vtable"> + <input name="persistcommonwireless" type="checkbox" value="yes" class="formfld" id="persistcommonwireless" <? if ($pconfig['persistcommonwireless']) echo "checked";?>> + <br/>Enabling this preserves the common wireless configuration through interface deletions and reassignments. + </td> + </tr> + <tr> <td valign="top" class="vncellreq">Standard</td> <td class="vtable"> <select name="standard" class="formselect" id="standard"> @@ -1615,7 +1630,7 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" = <td colspan="2" valign="top" height="16"></td> </tr> <tr> - <td colspan="2" valign="top" class="listtopic">Wireless configuration</td> + <td colspan="2" valign="top" class="listtopic">Network-specific wireless configuration</td> </tr> <tr> <td valign="top" class="vncellreq">Mode</td> @@ -1979,10 +1994,7 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "ppp" = } } <?php - if ($if == "wan" || $if == "lan") - echo "\$('allcfg').show();\n"; - else - echo "show_allcfg(document.iform.enable);"; + echo "show_allcfg(document.iform.enable);"; echo "updateType('{$pconfig['type']}');\n"; ?> </script> diff --git a/usr/local/www/interfaces_groups_edit.php b/usr/local/www/interfaces_groups_edit.php index 51feffd..430bd7b 100755 --- a/usr/local/www/interfaces_groups_edit.php +++ b/usr/local/www/interfaces_groups_edit.php @@ -71,6 +71,11 @@ if ($_POST) { if (preg_match("/([^a-zA-Z])+/", $_POST['ifname'], $match)) $input_errors[] = "Only letters A-Z are allowed as the group name."; + $ifaces = get_configured_interface_with_descr(); + foreach ($ifaces as $gif => $gdescr) { + if ($gdescr == $_POST['ifname'] || $gif == $_POST['ifname']) + $input_errors[] = "The specified group name is already used by an interface. Please choose another name."; + } $ifgroupentry = array(); $ifgroupentry['ifname'] = $_POST['ifname']; $members = ""; diff --git a/usr/local/www/services_captiveportal_ip.php b/usr/local/www/services_captiveportal_ip.php index 29acb1c..171f583 100755 --- a/usr/local/www/services_captiveportal_ip.php +++ b/usr/local/www/services_captiveportal_ip.php @@ -59,10 +59,16 @@ if ($_GET['act'] == "del") { $ipent = $a_allowedips[$_GET['id']]; if (isset($config['captiveportal']['enable'])) { + if (!empty($ipent['sn'])) + $ipent['ip'] .= "/{$ipent['sn']}"; mwexec("/sbin/ipfw table 3 delete " . $ipent['ip']); mwexec("/sbin/ipfw table 4 delete " . $ipent['ip']); mwexec("/sbin/ipfw table 5 delete " . $ipent['ip']); mwexec("/sbin/ipfw table 6 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 7 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 8 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 9 delete " . $ipent['ip']); + mwexec("/sbin/ipfw table 10 delete " . $ipent['ip']); } unset($a_allowedips[$_GET['id']]); @@ -109,13 +115,23 @@ include("head.inc"); <?php $i = 0; foreach ($a_allowedips as $ip): ?> <tr ondblclick="document.location='services_captiveportal_ip_edit.php?id=<?=$i;?>'"> <td class="listlr"> - <?php if($ip['dir'] == "to") - echo "any <img src=\"in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\">"; + <?php + if($ip['dir'] == "to") { + echo "any <img src=\"/themes/{$g['theme']}/images/icons/icon_in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> "; + } + if($ip['dir'] == "both") { + echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> "; + } + echo strtolower($ip['ip']); + if($ip['sn'] != "32" && is_numeric($ip['sn'])) { + $sn = $ip['sn']; + echo "/$sn"; + } + if($ip['dir'] == "from") { + echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> any"; + } + ?> - <?=strtolower($ip['ip']);?> - <?php if($ip['dir'] == "from") - echo "<img src=\"in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> any"; - ?> </td> <td class="listbg"> <?=htmlspecialchars($ip['descr']);?> @@ -152,6 +168,10 @@ include("head.inc"); <td>x.x.x.x <span class="vexpl"><img src="/themes/<?=$g['theme'];?>/images/icons/icon_in.gif" width="11" height="11" align="absmiddle"></span> any </td> <td><span class="vexpl">All connections <strong>from</strong> the IP address are allowed </span></td> </tr> + <tr> + <td><span class="vexpl"><img src="/themes/<?=$g['theme'];?>/images/icons/icon_pass.gif" width="11" height="11" align="right"></span> </td> + <td><span class="vexpl"> All connections <strong>to</strong> and <strong>from</strong> the IP address are allowed </span></td> + </tr> </table></td> <td class="list"> </td> </tr> diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php index 419327d..e6eab55 100755 --- a/usr/local/www/services_captiveportal_ip_edit.php +++ b/usr/local/www/services_captiveportal_ip_edit.php @@ -70,6 +70,7 @@ if (isset($_POST['id'])) if (isset($id) && $a_allowedips[$id]) { $pconfig['ip'] = $a_allowedips[$id]['ip']; + $pconfig['sn'] = $a_allowedips[$id]['sn']; $pconfig['dir'] = $a_allowedips[$id]['dir']; $pconfig['bw_up'] = $a_allowedips[$id]['bw_up']; $pconfig['bw_down'] = $a_allowedips[$id]['bw_down']; @@ -108,6 +109,7 @@ if ($_POST) { if (!$input_errors) { $ip = array(); $ip['ip'] = $_POST['ip']; + $ip['sn'] = $_POST['sn']; $ip['dir'] = $_POST['dir']; $ip['descr'] = $_POST['descr']; if ($_POST['bw_up']) @@ -116,9 +118,13 @@ if ($_POST) { $ip['bw_down'] = $_POST['bw_down']; if (isset($id) && $a_allowedips[$id]) { $oldip = $a_allowedips[$id]['ip']; + if (!empty($a_allowedips[$id]['sn'])) + $oldip .= "/{$a_allowedips[$id]['sn']}"; $a_allowedips[$id] = $ip; } else { $oldip = $ip['ip']; + if (!empty($$ip['sn'])) + $oldip .= "/{$$ip['sn']}"; $a_allowedips[] = $ip; } allowedips_sort(); @@ -168,8 +174,13 @@ include("head.inc"); <td width="22%" valign="top" class="vncellreq">IP address</td> <td width="78%" class="vtable"> <?=$mandfldhtml;?><input name="ip" type="text" class="formfld unknown" id="ip" size="17" value="<?=htmlspecialchars($pconfig['ip']);?>"> + /<select name='sn' class="formselect" id='sn'> + <?php for ($i = 32; $i >= 1; $i--): ?> + <option value="<?=$i;?>" <?php if ($i == $pconfig['sn']) echo "selected"; ?>><?=$i;?></option> + <?php endfor; ?> + </select> <br> - <span class="vexpl">IP address</span></td> + <span class="vexpl">IP address and subnet mask. Use /32 for a single IP.</span></td> </tr> <tr> <td width="22%" valign="top" class="vncell">Description</td> diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php index b55e750..d5dace5 100755 --- a/usr/local/www/services_captiveportal_mac_edit.php +++ b/usr/local/www/services_captiveportal_mac_edit.php @@ -131,11 +131,12 @@ if ($_POST) { captiveportal_free_ipfw_ruleno($ruleno); $rules = "delete {$ruleno}\n"; $rules .= "delete " . ++$ruleno . "\n"; - $rules .= captiveportal_passthrumac_configure_entry($mac); - file_put_contents("{$g['tmp_path']}/tmpmacedit{$id}", $rules); - mwexec("/sbin/ipfw -q {$g['tmp_path']}/tmpmacedit{$id}"); - @unlink("{$g['tmp_path']}/tmpmacedit{$id}"); } + + $rules .= captiveportal_passthrumac_configure_entry($mac); + file_put_contents("{$g['tmp_path']}/tmpmacedit{$id}", $rules); + mwexec("/sbin/ipfw -q {$g['tmp_path']}/tmpmacedit{$id}"); + @unlink("{$g['tmp_path']}/tmpmacedit{$id}"); header("Location: services_captiveportal_mac.php"); exit; diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 79fd1d8..9f4d9d6 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -252,6 +252,13 @@ if ($_POST) { } } + $noip = false; + foreach ($a_maps as $map) + if (empty($map['ipaddr'])) + $noip = true; + if ($_POST['staticarp'] && $noip) + $input_errors[] = "Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again."; + if (!$input_errors) { /* make sure the range lies within the current subnet */ $subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn))); @@ -330,9 +337,6 @@ if ($_POST) { write_config(); - /* static arp configuration */ - interfaces_staticarp_configure($if); - $retval = 0; $retvaldhcp = 0; $retvaldns = 0; diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index 02a7315..dd98fa4 100755 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -72,7 +72,7 @@ if (!is_array($config['dhcpd'][$if]['staticmap'])) { $config['dhcpd'][$if]['staticmap'] = array(); } -$static_map_enabled=isset($config['dhcpd'][$if]['staticarp']); +$static_arp_enabled=isset($config['dhcpd'][$if]['staticarp']); $a_maps = &$config['dhcpd'][$if]['staticmap']; $ifcfgip = get_interface_ip($if); @@ -123,8 +123,8 @@ if ($_POST) { if (($_POST['mac'] && !is_macaddr($_POST['mac']))) { $input_errors[] = "A valid MAC address must be specified."; } - if($static_map_enabled && !$_POST['ipaddr']) { - $input_errors[] = "Static map is enabled. You must specify an IP address."; + if($static_arp_enabled && !$_POST['ipaddr']) { + $input_errors[] = "Static ARP is enabled. You must specify an IP address."; } /* check for overlaps */ diff --git a/usr/local/www/services_rfc2136.php b/usr/local/www/services_rfc2136.php index 80edc0b..a8e9913 100644 --- a/usr/local/www/services_rfc2136.php +++ b/usr/local/www/services_rfc2136.php @@ -48,7 +48,7 @@ if ($_GET['act'] == "del") { write_config(); - header("Location: services_dyndns.php"); + header("Location: services_rfc2136.php"); exit; } @@ -105,9 +105,9 @@ include("head.inc"); </tr> <tr> <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong> - Note:<br> + <br> </strong></span> - Add something meaningful here. + </td> <td class="list"> </td> </tr> diff --git a/usr/local/www/services_rfc2136_edit.php b/usr/local/www/services_rfc2136_edit.php index 97f8770..a7d9e7b 100644 --- a/usr/local/www/services_rfc2136_edit.php +++ b/usr/local/www/services_rfc2136_edit.php @@ -81,7 +81,7 @@ if ($_POST) { if (!$input_errors) { $rfc2136 = array(); - $rfc2136['enable'] = $_POST['enable'] ? false : true; + $rfc2136['enable'] = $_POST['enable'] ? true : false; $rfc2136['host'] = $_POST['host']; $rfc2136['ttl'] = $_POST['ttl']; $rfc2136['keyname'] = $_POST['keyname']; diff --git a/usr/local/www/services_snmp.php b/usr/local/www/services_snmp.php index 9540d98..a9f8b7b 100755 --- a/usr/local/www/services_snmp.php +++ b/usr/local/www/services_snmp.php @@ -290,7 +290,7 @@ function enable_change(whichone) { <td width="22%" valign="top" class="vncellreq">Read Community String</td> <td width="78%" class="vtable"> <input name="rocommunity" type="text" class="formfld unknown" id="rocommunity" size="40" value="<?=htmlspecialchars($pconfig['rocommunity']);?>"> - <br>In most cases, "public" is used here</br> + <br>The community string is like a password, restricting access to querying SNMP to hosts knowing the community string. Use a strong value here to protect from unauthorized information disclosure.</br> </td> </tr> diff --git a/usr/local/www/status.php b/usr/local/www/status.php index bc2656d..d1985e3 100755 --- a/usr/local/www/status.php +++ b/usr/local/www/status.php @@ -168,7 +168,7 @@ defCmdT("pftop -w 150 -a -b -v speed","/usr/local/sbin/pftop -w 150 -a -b -v spe defCmdT("resolv.conf","cat /etc/resolv.conf"); defCmdT("Processes","ps xauww"); -defCmdT("dhcpd.conf","cat /var/etc/dhcpd.conf"); +defCmdT("dhcpd.conf","cat /var/dhcpd/etc/dhcpd.conf"); defCmdT("ez-ipupdate.cache","cat /conf/ez-ipupdate.cache"); defCmdT("df","/bin/df"); diff --git a/usr/local/www/status_gateway_groups.php b/usr/local/www/status_gateway_groups.php index 5ed4aa9..2a91b77 100755 --- a/usr/local/www/status_gateway_groups.php +++ b/usr/local/www/status_gateway_groups.php @@ -4,7 +4,7 @@ status_gateway_groups.php part of pfSense (http://pfsense.com) - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/status_gateways.php b/usr/local/www/status_gateways.php index 72e14b2..bffdb3b 100755 --- a/usr/local/www/status_gateways.php +++ b/usr/local/www/status_gateways.php @@ -4,7 +4,7 @@ status_gateways.php part of pfSense (http://www.pfsense.com/) - Copyright (C) 2006 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/status_lb_pool.php b/usr/local/www/status_lb_pool.php index 18b4c57..5a87e35 100755 --- a/usr/local/www/status_lb_pool.php +++ b/usr/local/www/status_lb_pool.php @@ -4,7 +4,7 @@ status_lb_pool.php part of pfSense (http://www.pfsense.com/) - Copyright (C) 2006 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/status_lb_vs.php b/usr/local/www/status_lb_vs.php index 0589425..5d74cf3 100755 --- a/usr/local/www/status_lb_vs.php +++ b/usr/local/www/status_lb_vs.php @@ -4,7 +4,7 @@ status_lb_vs.php part of pfSense (http://www.pfsense.com/) - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index 115d12c..97454c9 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -3,7 +3,7 @@ /* status_rrd_graph.php Part of pfSense - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl> + Copyright (C) 2007 Seth Mos <seth.mos@dds.nl> All rights reserved. Redistribution and use in source and binary forms, with or without @@ -28,7 +28,6 @@ POSSIBILITY OF SUCH DAMAGE. */ /* - pfSense_BUILDER_BINARIES: /usr/bin/find pfSense_MODULE: system */ @@ -50,8 +49,9 @@ if(! isset($config['rrd']['enable'])) { } $rrddbpath = "/var/db/rrd/"; -/* XXX: (billm) do we have an exec() type function that does this type of thing? */ -exec("cd $rrddbpath;/usr/bin/find -name *.rrd", $databases); +chdir($rrddbpath); +$databases = glob("*.rrd"); + if ($_GET['cat']) { $curcat = $_GET['cat']; @@ -109,12 +109,46 @@ if ($_GET['option']) { continue 2; } } + case "vpnusers": + foreach($databases as $database) { + if(preg_match("/[-]vpnusers\.rrd/i", $database)) { + /* pick off the 1st database we find that matches the VPN graphs */ + $name = explode("-", $database); + $curoption = "$name[0]"; + continue 2; + } + } default: $curoption = "wan"; break; } } +$now = time(); +if($curcat == "custom") { + if (is_numeric($_GET['start'])) { + if($start < ($now - (3600 * 24 * 365 * 5))) { + $start = $now - (4 * 3600); + } + $start = $_GET['start']; + } else { + $start = $now - (4 * 3600); + } +} + +if (is_numeric($_GET['end'])) { + $end = $_GET['end']; +} else { + $end = $now; +} + +/* this should never happen */ +if($end < $start) { + $end = $now; +} + +$seconds = $end - $start; + if ($_GET['style']) { $curstyle = $_GET['style']; } else { @@ -133,6 +167,7 @@ $dbheader = array("allgraphs-traffic.rrd", "allgraphs-quality.rrd", "allgraphs-wireless.rrd", "allgraphs-cellular.rrd", + "allgraphs-vpnusers.rrd", "allgraphs-packets.rrd", "system-allgraphs.rrd", "system-throughput.rrd", @@ -141,15 +176,18 @@ $dbheader = array("allgraphs-traffic.rrd", "outbound-traffic.rrd"); foreach($databases as $database) { - if(stristr($database, "wireless")) { + if(stristr($database, "-wireless")) { $wireless = true; } - if(stristr($database, "queues")) { + if(stristr($database, "-queues")) { $queues = true; } - if(stristr($database, "cellular")) { + if(stristr($database, "-cellular")) { $cellular = true; } + if(stristr($database, "-vpnusers")) { + $vpnusers = true; + } } /* append the existing array to the header */ $ui_databases = array_merge($dbheader, $databases); @@ -168,7 +206,7 @@ function get_dates($curperiod, $graph) { $curyear = date('Y', $now); $curmonth = date('m', $now); $curweek = date('W', $now); - $curweekday = date('w', $now); + $curweekday = date('N', $now) - 1; // We want to start on monday $curday = date('d', $now); switch($curperiod) { @@ -184,8 +222,16 @@ function get_dates($curperiod, $graph) { $end = mktime(0, 0, 0, $curmonth, (($curday + $offset) + 1), $curyear); break; case "week": - $start = mktime(0, 0, 0, $curmonth, (($curday + $curweekday) - $offset), $curyear); - $end = mktime(0, 0, 0, $curmonth, (($curday + $curweekday) + 7), $curyear); + switch($offset) { + case 0; + $weekoffset = 0; + break; + default: + $weekoffset = ($offset * 7) - 7; + break; + } + $start = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset), $curyear); + $end = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset + 7), $curyear); break; case "month": $start = mktime(0, 0, 0, ($curmonth + $offset), 0, $curyear); @@ -232,9 +278,9 @@ function get_dates($curperiod, $graph) { $tab_array[] = array("Quality", $tabactive, "status_rrd_graph.php?cat=quality"); if($queues) { if($curcat == "queues") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Queues", $tabactive, "status_rrd_graph.php?cat=queues"); + $tab_array[] = array("Queues", $tabactive, "status_rrd_graph.php?cat=queues"); if($curcat == "queuedrops") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("QueueDrops", $tabactive, "status_rrd_graph.php?cat=queuedrops"); + $tab_array[] = array("QueueDrops", $tabactive, "status_rrd_graph.php?cat=queuedrops"); } if($wireless) { if($curcat == "wireless") { $tabactive = True; } else { $tabactive = False; } @@ -244,6 +290,12 @@ function get_dates($curperiod, $graph) { if($curcat == "cellular") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array("Cellular", $tabactive, "status_rrd_graph.php?cat=cellular"); } + if($vpnusers) { + if($curcat == "vpnusers") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("VPN", $tabactive, "status_rrd_graph.php?cat=vpnusers"); + } + if($curcat == "custom") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Custom", $tabactive, "status_rrd_graph.php?cat=custom"); if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array("Settings", $tabactive, "status_rrd_graph_settings.php"); display_top_tabs($tab_array); @@ -263,6 +315,19 @@ function get_dates($curperiod, $graph) { <select name="option" class="formselect" style="z-index: -10;" onchange="document.form1.submit()"> <?php + if($curcat == "custom") { + foreach ($databases as $db => $database) { + $optionc = split("-", $database); + $search = array("-", ".rrd", $optionc); + $replace = array(" :: ", "", $friendly); + echo "<option value=\"{$database}\""; + $prettyprint = ucwords(str_replace($search, $replace, $database)); + if($curoption == $database) { + echo " selected "; + } + echo ">" . htmlspecialchars($prettyprint) . "</option>\n"; + } + } foreach ($ui_databases as $db => $database) { if(! preg_match("/($curcat)/i", $database)) { continue; @@ -270,11 +335,12 @@ function get_dates($curperiod, $graph) { $optionc = split("-", $database); $search = array("-", ".rrd", $optionc); $replace = array(" :: ", "", $friendly); + switch($curcat) { case "system": - $optionc = str_replace($search, $replace, $optionc[1]); - echo "<option value=\"$optionc\""; - $prettyprint = ucwords(str_replace($search, $replace, $optionc)); + $optioncf = str_replace($search, $replace, $optionc[1]); + echo "<option value=\"$optioncf\""; + $prettyprint = ucwords(str_replace($search, $replace, $optioncf)); break; default: /* Deduce a interface if possible and use the description */ @@ -308,65 +374,86 @@ function get_dates($curperiod, $graph) { ?> </select> - <?=gettext("Period:");?> - <select name="period" class="formselect" style="z-index: -10;" onchange="document.form1.submit()"> - <?php - foreach ($periods as $period => $value) { - echo "<option value=\"$period\""; - if ($period == $curperiod) echo " selected"; - echo ">" . htmlspecialchars($value) . "</option>\n"; + <? + if($curcat <> "custom") { + ?> + <?=gettext("Period:");?> + <select name="period" class="formselect" style="z-index: -10;" onchange="document.form1.submit()"> + <?php + foreach ($periods as $period => $value) { + echo "<option value=\"$period\""; + if ($period == $curperiod) echo " selected"; + echo ">" . htmlspecialchars($value) . "</option>\n"; + } } ?> - </select> - <?php - // echo "year $curyear, month $curmonth, week $curweek, day $curday, weekday $curweekday<br>"; - foreach($graphs as $graph) { - /* check which databases are valid for our category */ - foreach($ui_databases as $curdatabase) { - if(! preg_match("/($curcat)/i", $curdatabase)) { - continue; - } - $optionc = split("-", $curdatabase); - $search = array("-", ".rrd", $optionc); - $replace = array(" :: ", "", $friendly); - switch($curoption) { - case "outbound": - /* only show interfaces with a gateway */ - $optionc = "$optionc[0]"; - if(!interface_has_gateway($optionc)) { - if(!preg_match("/($optionc)-(quality)/", $curdatabase)) { + if($curcat == "custom") { + ?> + <?=gettext("Start:");?> + <input type="text" name="start" class="formfldunknown" length="32" value="<?php echo $start;?>"> + <?=gettext("End:");?> + <input type="text" name="end" class="formfldunknown" length="32" value="<?php echo $now;?>"> + <input type="submit" name="Submit" value="Go"> + <? + $curdatabase = $curoption; + $graph = "custom-$curdatabase"; + if(in_array($curdatabase, $databases)) { + echo "<tr><td colspan=2 class=\"list\">\n"; + echo "<IMG BORDER='0' name='{$graph}-{$curoption}-{$curdatabase}' "; + echo "id='{$graph}-{$curoption}-{$curdatabase}' ALT=\"$prettydb Graph\" "; + echo "SRC=\"status_rrd_graph_img.php?start={$start}&end={$end}&database={$curdatabase}&style={$curstyle}&graph={$graph}\" />\n"; + echo "<br /><hr><br />\n"; + echo "</td></tr>\n"; + } + } else { + foreach($graphs as $graph) { + /* check which databases are valid for our category */ + foreach($ui_databases as $curdatabase) { + if(! preg_match("/($curcat)/i", $curdatabase)) { + continue; + } + $optionc = split("-", $curdatabase); + $search = array("-", ".rrd", $optionc); + $replace = array(" :: ", "", $friendly); + switch($curoption) { + case "outbound": + /* only show interfaces with a gateway */ + $optionc = "$optionc[0]"; + if(!interface_has_gateway($optionc)) { + if(!preg_match("/($optionc)-(quality)/", $curdatabase)) { + continue 2; + } + } + if(! preg_match("/($optionc)[-.]/i", $curdatabase)) { continue 2; } - } - if(! preg_match("/($optionc)[-.]/i", $curdatabase)) { - continue 2; - } - break; - case "allgraphs": - /* make sure we do not show the placeholder databases in the all view */ - if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { - continue 2; - } - break; - default: - /* just use the name here */ - if(! preg_match("/($curoption)[-.]/i", $curdatabase)) { - continue 2; - } - } - if(in_array($curdatabase, $databases)) { - $dates = get_dates($curperiod, $graph); - $start = $dates['start']; - $end = $dates['end']; - echo "<tr><td colspan=2 class=\"list\">\n"; - echo "<IMG BORDER='0' name='{$graph}-{$curoption}-{$curdatabase}' "; - echo "id='{$graph}-{$curoption}-{$curdatabase}' ALT=\"$prettydb Graph\" "; - echo "SRC=\"status_rrd_graph_img.php?start={$start}&end={$end}&database={$curdatabase}&style={$curstyle}&graph={$graph}\" />\n"; - echo "<br /><hr><br />\n"; - echo "</td></tr>\n"; + break; + case "allgraphs": + /* make sure we do not show the placeholder databases in the all view */ + if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { + continue 2; + } + break; + default: + /* just use the name here */ + if(! preg_match("/($curoption)[-.]/i", $curdatabase)) { + continue 2; + } + } + if(in_array($curdatabase, $databases)) { + $dates = get_dates($curperiod, $graph); + $start = $dates['start']; + $end = $dates['end']; + echo "<tr><td colspan=2 class=\"list\">\n"; + echo "<IMG BORDER='0' name='{$graph}-{$curoption}-{$curdatabase}' "; + echo "id='{$graph}-{$curoption}-{$curdatabase}' ALT=\"$prettydb Graph\" "; + echo "SRC=\"status_rrd_graph_img.php?start={$start}&end={$end}&database={$curdatabase}&style={$curstyle}&graph={$graph}\" />\n"; + echo "<br /><hr><br />\n"; + echo "</td></tr>\n"; + } } } } diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 567d272..c559d3d 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -3,7 +3,7 @@ /* status_rrd_graph_img.php Part of pfSense - Copyright (C) 2009 Seth Mos <seth.mos@xs4all.nl> + Copyright (C) 2009 Seth Mos <seth.mos@dds.nl> All rights reserved. Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE. */ /* - pfSense_BUILDER_BINARIES: /usr/bin/find /bin/rm /usr/local/bin/rrdtool + pfSense_BUILDER_BINARIES: /bin/rm /usr/local/bin/rrdtool pfSense_MODULE: system */ @@ -40,7 +40,7 @@ require_once("rrd.inc"); $pgtitle = array("System","RRD Graphs","Image viewer"); if ($_GET['database']) { - $curdatabase = $_GET['database']; + $curdatabase = basename($_GET['database']); } else { $curdatabase = "wan-traffic.rrd"; } @@ -146,8 +146,9 @@ $havg = timeDiff($average, $defOptions); $hperiod = timeDiff($seconds, $defOptions); $data = true; -/* XXX: (billm) do we have an exec() type function that does this type of thing? */ -exec("cd $rrddbpath;/usr/bin/find -name *.rrd", $databases); +$rrddbpath = "/var/db/rrd/"; +chdir($rrddbpath); +$databases = glob("*.rrd"); rsort($databases); /* compare bytes/sec counters, divide bps by 8 */ @@ -205,6 +206,7 @@ if(file_exists($rrdcolors)) { $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); + $colorvpnusers = array('990000'); } switch ($curstyle) { @@ -570,6 +572,25 @@ elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curda $graphcmd .= "COMMENT:\"\\n\" "; $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; } +elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { + /* define graphcmd for vpn users stats */ + $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; + $graphcmd .= "--start $start --end $end "; + $graphcmd .= "--vertical-label \"users\" "; + $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; + $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; + $graphcmd .= "--height 200 --width 620 "; + $graphcmd .= "DEF:\"$curif-users=$rrddbpath$curdatabase:users:AVERAGE\" "; + $graphcmd .= "LINE2:\"$curif-users#{$colorvpnusers[0]}:$curif-users\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t maximum\t\t average\t current\\n\" "; + $graphcmd .= "COMMENT:\"Users Online\t\" "; + $graphcmd .= "GPRINT:\"$curif-users:MAX:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-users:AVERAGE:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-users:LAST:%7.2lf \" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" "; +} elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { /* define graphcmd for states stats */ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; diff --git a/usr/local/www/status_rrd_graph_settings.php b/usr/local/www/status_rrd_graph_settings.php index d1398c4..b173e00 100755 --- a/usr/local/www/status_rrd_graph_settings.php +++ b/usr/local/www/status_rrd_graph_settings.php @@ -3,7 +3,7 @@ /* status_rrd_graph.php Part of pfSense - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl> + Copyright (C) 2007 Seth Mos <seth.mos@dds.nl> All rights reserved. Redistribution and use in source and binary forms, with or without @@ -77,9 +77,11 @@ if ($_POST) { } } + + $rrddbpath = "/var/db/rrd/"; -/* XXX: (billm) do we have an exec() type function that does this type of thing? */ -exec("cd $rrddbpath;/usr/bin/find -name *.rrd", $databases); +chdir($rrddbpath); +$databases = glob("*.rrd"); foreach($databases as $database) { if(stristr($database, "wireless")) { @@ -91,6 +93,9 @@ foreach($databases as $database) { if(stristr($database, "cellular")) { $cellular = true; } + if(stristr($database, "-vpnusers")) { + $vpnusers = true; + } } $pgtitle = array("Status","RRD Graphs"); @@ -106,32 +111,39 @@ include("head.inc"); <tr> <td> <?php - $tab_array = array(); - if($curcat == "system") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("System", $tabactive, "status_rrd_graph.php?cat=system"); - if($curcat == "traffic") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Traffic", $tabactive, "status_rrd_graph.php?cat=traffic"); - if($curcat == "packets") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Packets", $tabactive, "status_rrd_graph.php?cat=packets"); - if($curcat == "quality") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Quality", $tabactive, "status_rrd_graph.php?cat=quality"); + $tab_array = array(); + if($curcat == "system") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("System", $tabactive, "status_rrd_graph.php?cat=system"); + if($curcat == "traffic") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Traffic", $tabactive, "status_rrd_graph.php?cat=traffic"); + if($curcat == "packets") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Packets", $tabactive, "status_rrd_graph.php?cat=packets"); + if($curcat == "quality") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Quality", $tabactive, "status_rrd_graph.php?cat=quality"); if($queues) { - if($curcat == "queues") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Queues", $tabactive, "status_rrd_graph.php?cat=queues"); + if($curcat == "queues") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Queues", $tabactive, "status_rrd_graph.php?cat=queues"); if($curcat == "queuedrops") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("QueueDrops", $tabactive, "status_rrd_graph.php?cat=queuedrops"); + $tab_array[] = array("QueueDrops", $tabactive, "status_rrd_graph.php?cat=queuedrops"); } if($wireless) { - if($curcat == "wireless") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Wireless", $tabactive, "status_rrd_graph.php?cat=wireless"); + if($curcat == "wireless") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Wireless", $tabactive, "status_rrd_graph.php?cat=wireless"); } if($cellular) { if($curcat == "cellular") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Cellular", $tabactive, "status_rrd_graph.php?cat=cellular"); + $tab_array[] = array("Cellular", $tabactive, "status_rrd_graph.php?cat=cellular"); + } + if($vpnusers) { + if($curcat == "vpnusers") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("VPN", $tabactive, "status_rrd_graph.php?cat=vpnusers"); } - if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } - $tab_array[] = array("Settings", $tabactive, "status_rrd_graph_settings.php"); - display_top_tabs($tab_array); + if($curcat == "custom") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Custom", $tabactive, "status_rrd_graph.php?cat=custom"); + if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Settings", $tabactive, "status_rrd_graph_settings.php"); + + display_top_tabs($tab_array); ?> </td> </tr> diff --git a/usr/local/www/status_upnp.php b/usr/local/www/status_upnp.php index 024633f..e5908d3 100644 --- a/usr/local/www/status_upnp.php +++ b/usr/local/www/status_upnp.php @@ -4,7 +4,7 @@ status_upnp.php part of pfSense (http://www.pfsense.com/) - Copyright (C) 2006 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/status_wireless.php b/usr/local/www/status_wireless.php index 751810a..0ec7e6a 100755 --- a/usr/local/www/status_wireless.php +++ b/usr/local/www/status_wireless.php @@ -50,8 +50,10 @@ if(empty($if)) { /* Find the first interface that is wireless */ foreach($ciflist as $interface => $ifdescr) { - if(is_interface_wireless(get_real_interface($interface))) + if(is_interface_wireless(get_real_interface($interface))) { $if = $interface; + break; + } } } ?> diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php index 41f0979..1bdefe9 100644 --- a/usr/local/www/system_advanced_misc.php +++ b/usr/local/www/system_advanced_misc.php @@ -224,7 +224,7 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Security Assocications"); ?></td> <td width="78%" class="vtable"> - <input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> /> + <input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if (isset($pconfig['preferoldsa_enable'])) echo "checked"; ?> /> <strong><?=gettext("Prefer older IPsec SAs"); ?></strong> <br /> <?=gettext("By default, if several SAs match, the newest one is " . diff --git a/usr/local/www/system_advanced_notifications.php b/usr/local/www/system_advanced_notifications.php index cdd8b2d..0ee67c7 100644 --- a/usr/local/www/system_advanced_notifications.php +++ b/usr/local/www/system_advanced_notifications.php @@ -111,13 +111,13 @@ if ($_POST) { if($config['notifications']['growl']['ipaddress'] && $config['notifications']['growl']['password'] = $_POST['password']) { register_via_growl(); - notify_via_growl(gettext("This is a test message form pfSense. It is safe to ignore this message.")); + notify_via_growl(gettext("This is a test message from pfSense. It is safe to ignore this message.")); } // Send test message via smtp if(file_exists("/var/db/notices_lastmsg.txt")) unlink("/var/db/notices_lastmsg.txt"); - $savemsg = notify_via_smtp(gettext("This is a test message form pfSense. It is safe to ignore this message.")); + $savemsg = notify_via_smtp(gettext("This is a test message from pfSense. It is safe to ignore this message.")); pfSenseHeader("system_advanced_notifications.php"); exit; diff --git a/usr/local/www/system_gateway_groups.php b/usr/local/www/system_gateway_groups.php index 43dfea7..f767aff 100755 --- a/usr/local/www/system_gateway_groups.php +++ b/usr/local/www/system_gateway_groups.php @@ -4,7 +4,7 @@ system_gateway_groups.php part of pfSense (http://pfsense.com) - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/system_gateway_groups_edit.php b/usr/local/www/system_gateway_groups_edit.php index 1a504c5..268a5da 100755 --- a/usr/local/www/system_gateway_groups_edit.php +++ b/usr/local/www/system_gateway_groups_edit.php @@ -4,7 +4,7 @@ system_gateway_groups_edit.php part of pfSense (http://pfsense.com) - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/system_gateways.php b/usr/local/www/system_gateways.php index 82004a7..d789d76 100755 --- a/usr/local/www/system_gateways.php +++ b/usr/local/www/system_gateways.php @@ -4,7 +4,7 @@ system_gateways.php part of pfSense (http://pfsense.com) - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 98d1e81..e679b90 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -4,7 +4,7 @@ system_gateways_edit.php part of pfSense (http://pfsense.com) - Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>. + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/system_groupmanager.php b/usr/local/www/system_groupmanager.php index a167790..37c5ec3 100644 --- a/usr/local/www/system_groupmanager.php +++ b/usr/local/www/system_groupmanager.php @@ -152,10 +152,12 @@ if ($_POST) { local_group_set($group); /* Refresh users in this group since their privileges may have changed. */ - $a_user = &$config['system']['user']; - foreach ($a_user as & $user) { - if (in_array($user['uid'], $group['member'])) - local_user_set($user); + if (is_array($group['member'])) { + $a_user = &$config['system']['user']; + foreach ($a_user as & $user) { + if (in_array($user['uid'], $group['member'])) + local_user_set($user); + } } write_config(); @@ -410,8 +412,11 @@ function presubmit() { $grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png"; else $grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png"; + $groupcount = count($group['member']); + if ($group["name"] == "all") + $groupcount = count($config['system']['user']); ?> - <tr> + <tr ondblclick="document.location='system_groupmanager.php?act=edit&id=<?=$i;?>'"> <td class="listlr"> <table border="0" cellpadding="0" cellspacing="0"> <tr> @@ -429,7 +434,7 @@ function presubmit() { <?=htmlspecialchars($group['description']);?> </td> <td class="listbg"> - <?=count($group['member'])?> + <?=$groupcount;?> </td> <td valign="middle" nowrap class="list"> <a href="system_groupmanager.php?act=edit&id=<?=$i;?>"> diff --git a/usr/local/www/system_usermanager_settings.php b/usr/local/www/system_usermanager_settings.php index 352d5cc..0a52028 100755 --- a/usr/local/www/system_usermanager_settings.php +++ b/usr/local/www/system_usermanager_settings.php @@ -136,8 +136,6 @@ if(!$pconfig['backend']) <?php $auth_servers = auth_get_authserver_list(); foreach ($auth_servers as $auth_server): - if ($auth_server['type'] == 'radius') - continue; $selected = ""; if ($auth_server['name'] == $pconfig['authmode']) $selected = "selected"; diff --git a/usr/local/www/themes/code-red/rrdcolors.inc.php b/usr/local/www/themes/code-red/rrdcolors.inc.php index cbd6a8d..1ab0fd0 100755 --- a/usr/local/www/themes/code-red/rrdcolors.inc.php +++ b/usr/local/www/themes/code-red/rrdcolors.inc.php @@ -46,5 +46,6 @@ $colorqualityloss = "ee0000"; $colorwireless = array('990000','a83c3c','b36666');
$colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066');
$colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600');
+$colorvpnusers = array('990000');
?>
diff --git a/usr/local/www/themes/metallic/rrdcolors.inc.php b/usr/local/www/themes/metallic/rrdcolors.inc.php index e3153fd..8e74545 100644 --- a/usr/local/www/themes/metallic/rrdcolors.inc.php +++ b/usr/local/www/themes/metallic/rrdcolors.inc.php @@ -46,5 +46,6 @@ $colorqualityloss = "ee0000"; $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); +$colorvpnusers = array('990000'); ?> diff --git a/usr/local/www/themes/nervecenter/rrdcolors.inc.php b/usr/local/www/themes/nervecenter/rrdcolors.inc.php index e3153fd..8e74545 100644 --- a/usr/local/www/themes/nervecenter/rrdcolors.inc.php +++ b/usr/local/www/themes/nervecenter/rrdcolors.inc.php @@ -46,5 +46,6 @@ $colorqualityloss = "ee0000"; $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); +$colorvpnusers = array('990000'); ?> diff --git a/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php b/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php index e3153fd..8e74545 100644 --- a/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php @@ -46,5 +46,6 @@ $colorqualityloss = "ee0000"; $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); +$colorvpnusers = array('990000'); ?> diff --git a/usr/local/www/themes/pfsense/rrdcolors.inc.php b/usr/local/www/themes/pfsense/rrdcolors.inc.php index e3153fd..8e74545 100644 --- a/usr/local/www/themes/pfsense/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense/rrdcolors.inc.php @@ -46,5 +46,6 @@ $colorqualityloss = "ee0000"; $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); +$colorvpnusers = array('990000'); ?> diff --git a/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php b/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php index e3153fd..8e74545 100644 --- a/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php @@ -46,5 +46,6 @@ $colorqualityloss = "ee0000"; $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); +$colorvpnusers = array('990000'); ?> diff --git a/usr/local/www/themes/the_wall/rrdcolors.inc.php b/usr/local/www/themes/the_wall/rrdcolors.inc.php index e3153fd..8e74545 100644 --- a/usr/local/www/themes/the_wall/rrdcolors.inc.php +++ b/usr/local/www/themes/the_wall/rrdcolors.inc.php @@ -46,5 +46,6 @@ $colorqualityloss = "ee0000"; $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); +$colorvpnusers = array('990000'); ?> diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index 6e1e242..5daa29a 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -229,6 +229,8 @@ function filter_configure_xmlrpc($raw_params) { require_once("openvpn.inc"); openvpn_resync_all(); services_dhcpd_configure(); + services_dnsmasq_configure(); + local_sync_accounts(); return $xmlrpc_g['return']['true']; } |