From 4b9744c335eb78d2bd3b65472014bf37a52c0956 Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 19 Dec 2012 08:43:26 -0500 Subject: Normalize line endings --- config/mactovendor/bin/diag_arp.php_ | 678 +++++++++--------- config/mactovendor/bin/status_dhcp_leases.php_ | 868 ++++++++++++------------ config/mactovendor/bin/status_interfaces.php_ | 706 +++++++++---------- config/mactovendor/bin/status_wireless.php_ | 416 ++++++------ config/openvpn-client-export/source/dotnet2.nsh | 184 ++--- config/postfix/postfix_recipients.php | 6 +- config/squid-reverse/squid_reverse.inc | 374 +++++----- 7 files changed, 1616 insertions(+), 1616 deletions(-) diff --git a/config/mactovendor/bin/diag_arp.php_ b/config/mactovendor/bin/diag_arp.php_ index b72b73cd..97e9b4bc 100644 --- a/config/mactovendor/bin/diag_arp.php_ +++ b/config/mactovendor/bin/diag_arp.php_ @@ -1,339 +1,339 @@ - - - originally part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2005 Paul Taylor (paultaylor@winndixie.com) and Manuel Kasper . - 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. -*/ - -/* - pfSense_BUILDER_BINARIES: /bin/cat /usr/sbin/arp - pfSense_MODULE: arp -*/ - -##|+PRIV -##|*IDENT=page-diagnostics-arptable -##|*NAME=Diagnostics: ARP Table page -##|*DESCR=Allow access to the 'Diagnostics: ARP Table' page. -##|*MATCH=diag_arp.php* -##|-PRIV - -@ini_set('zlib.output_compression', 0); -@ini_set('implicit_flush', 1); - -require("guiconfig.inc"); - -function leasecmp($a, $b) { - return strcmp($a[$_GET['order']], $b[$_GET['order']]); -} - -function adjust_gmt($dt) { - $ts = strtotime($dt . " GMT"); - return strftime("%Y/%m/%d %H:%M:%S", $ts); -} - -function remove_duplicate($array, $field) { - foreach ($array as $sub) - $cmp[] = $sub[$field]; - $unique = array_unique($cmp); - foreach ($unique as $k => $rien) - $new[] = $array[$k]; - return $new; -} - -// Define path to AWK -$awk = "/usr/bin/awk"; - -// Read in leases file -$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"; - -/* this pattern sticks comments into a single array item */ -$cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'"; - -/* We then split the leases file by } */ -$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'"; - -/* stuff the leases file in a proper format into a array by line */ -exec("cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern}", $leases_content); -$leases_count = count($leases_content); - -$pools = array(); -$leases = array(); -$i = 0; -$l = 0; -$p = 0; -// Put everything together again -while($i < $leases_count) { - /* split the line by space */ - $data = explode(" ", $leases_content[$i]); - /* walk the fields */ - $f = 0; - $fcount = count($data); - /* with less then 20 fields there is nothing useful */ - if($fcount < 20) { - $i++; - continue; - } - while($f < $fcount) { - switch($data[$f]) { - case "failover": - $pools[$p]['name'] = $data[$f+2]; - $pools[$p]['mystate'] = $data[$f+7]; - $pools[$p]['peerstate'] = $data[$f+14]; - $pools[$p]['mydate'] = $data[$f+10]; - $pools[$p]['mydate'] .= " " . $data[$f+11]; - $pools[$p]['peerdate'] = $data[$f+17]; - $pools[$p]['peerdate'] .= " " . $data[$f+18]; - $p++; - $i++; - continue 3; - case "lease": - $leases[$l]['ip'] = $data[$f+1]; - $leases[$l]['type'] = "dynamic"; - $f = $f+2; - break; - case "starts": - $leases[$l]['start'] = $data[$f+2]; - $leases[$l]['start'] .= " " . $data[$f+3]; - $f = $f+3; - break; - case "ends": - $leases[$l]['end'] = $data[$f+2]; - $leases[$l]['end'] .= " " . $data[$f+3]; - $f = $f+3; - break; - case "tstp": - $f = $f+3; - break; - case "tsfp": - $f = $f+3; - break; - case "atsfp": - $f = $f+3; - break; - case "cltt": - $f = $f+3; - break; - case "binding": - switch($data[$f+2]) { - case "active": - $leases[$l]['act'] = "active"; - break; - case "free": - $leases[$l]['act'] = "expired"; - $leases[$l]['online'] = "offline"; - break; - case "backup": - $leases[$l]['act'] = "reserved"; - $leases[$l]['online'] = "offline"; - break; - } - $f = $f+1; - break; - case "next": - /* skip the next binding statement */ - $f = $f+3; - break; - case "hardware": - $leases[$l]['mac'] = $data[$f+2]; - /* check if it's online and the lease is active */ - if($leases[$l]['act'] == "active") { - $online = exec("/usr/sbin/arp -an |/usr/bin/awk '/{$leases[$l]['ip']}/ {print}'|wc -l"); - if ($online == 1) { - $leases[$l]['online'] = 'online'; - } else { - $leases[$l]['online'] = 'offline'; - } - } - $f = $f+2; - break; - case "client-hostname": - if($data[$f+1] <> "") { - $leases[$l]['hostname'] = preg_replace('/"/','',$data[$f+1]); - } else { - $hostname = gethostbyaddr($leases[$l]['ip']); - if($hostname <> "") { - $leases[$l]['hostname'] = $hostname; - } - } - $f = $f+1; - break; - case "uid": - $f = $f+1; - break; - } - $f++; - } - $l++; - $i++; -} - -/* remove duplicate items by mac address */ -if(count($leases) > 0) { - $leases = remove_duplicate($leases,"ip"); -} - -if(count($pools) > 0) { - $pools = remove_duplicate($pools,"name"); - asort($pools); -} - -// Put this in an easy to use form -$dhcpmac = array(); -$dhcpip = array(); - -foreach ($leases as $value) { - $dhcpmac[$value['mac']] = $value['hostname']; - $dhcpip[$value['ip']] = $value['hostname']; -} - -exec("/usr/sbin/arp -an",$rawdata); - -$i = 0; - -/* if list */ -$ifdescrs = get_configured_interface_with_descr(); - -foreach ($ifdescrs as $key =>$interface) { - $hwif[$config['interfaces'][$key]['if']] = $interface; -} - -$data = array(); -foreach ($rawdata as $line) { - $elements = explode(' ',$line); - - if ($elements[3] != "(incomplete)") { - $arpent = array(); - $arpent['ip'] = trim(str_replace(array('(',')'),'',$elements[1])); - $arpent['mac'] = trim($elements[3]); - $arpent['interface'] = trim($elements[5]); - $data[] = $arpent; - } -} - -function _getHostName($mac,$ip) -{ - global $dhcpmac, $dhcpip; - - if ($dhcpmac[$mac]) - return $dhcpmac[$mac]; - else if ($dhcpip[$ip]) - return $dhcpip[$ip]; - else if(gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip) - return gethostbyaddr($ip); - else - return ""; -} - -$pgtitle = array(gettext("Diagnostics"),gettext("ARP Table")); -include("head.inc"); - -?> - - - - - -
- -

  -

- - - - - - -
- - - - - - - - - - - - - - - - -
- " . $mac_man_ar[0] . substr($mac, 8) . ""; } - else{ print $mac; } - ?> - - -
-
- - - - + + + originally part of m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2005 Paul Taylor (paultaylor@winndixie.com) and Manuel Kasper . + 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. +*/ + +/* + pfSense_BUILDER_BINARIES: /bin/cat /usr/sbin/arp + pfSense_MODULE: arp +*/ + +##|+PRIV +##|*IDENT=page-diagnostics-arptable +##|*NAME=Diagnostics: ARP Table page +##|*DESCR=Allow access to the 'Diagnostics: ARP Table' page. +##|*MATCH=diag_arp.php* +##|-PRIV + +@ini_set('zlib.output_compression', 0); +@ini_set('implicit_flush', 1); + +require("guiconfig.inc"); + +function leasecmp($a, $b) { + return strcmp($a[$_GET['order']], $b[$_GET['order']]); +} + +function adjust_gmt($dt) { + $ts = strtotime($dt . " GMT"); + return strftime("%Y/%m/%d %H:%M:%S", $ts); +} + +function remove_duplicate($array, $field) { + foreach ($array as $sub) + $cmp[] = $sub[$field]; + $unique = array_unique($cmp); + foreach ($unique as $k => $rien) + $new[] = $array[$k]; + return $new; +} + +// Define path to AWK +$awk = "/usr/bin/awk"; + +// Read in leases file +$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"; + +/* this pattern sticks comments into a single array item */ +$cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'"; + +/* We then split the leases file by } */ +$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'"; + +/* stuff the leases file in a proper format into a array by line */ +exec("cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern}", $leases_content); +$leases_count = count($leases_content); + +$pools = array(); +$leases = array(); +$i = 0; +$l = 0; +$p = 0; +// Put everything together again +while($i < $leases_count) { + /* split the line by space */ + $data = explode(" ", $leases_content[$i]); + /* walk the fields */ + $f = 0; + $fcount = count($data); + /* with less then 20 fields there is nothing useful */ + if($fcount < 20) { + $i++; + continue; + } + while($f < $fcount) { + switch($data[$f]) { + case "failover": + $pools[$p]['name'] = $data[$f+2]; + $pools[$p]['mystate'] = $data[$f+7]; + $pools[$p]['peerstate'] = $data[$f+14]; + $pools[$p]['mydate'] = $data[$f+10]; + $pools[$p]['mydate'] .= " " . $data[$f+11]; + $pools[$p]['peerdate'] = $data[$f+17]; + $pools[$p]['peerdate'] .= " " . $data[$f+18]; + $p++; + $i++; + continue 3; + case "lease": + $leases[$l]['ip'] = $data[$f+1]; + $leases[$l]['type'] = "dynamic"; + $f = $f+2; + break; + case "starts": + $leases[$l]['start'] = $data[$f+2]; + $leases[$l]['start'] .= " " . $data[$f+3]; + $f = $f+3; + break; + case "ends": + $leases[$l]['end'] = $data[$f+2]; + $leases[$l]['end'] .= " " . $data[$f+3]; + $f = $f+3; + break; + case "tstp": + $f = $f+3; + break; + case "tsfp": + $f = $f+3; + break; + case "atsfp": + $f = $f+3; + break; + case "cltt": + $f = $f+3; + break; + case "binding": + switch($data[$f+2]) { + case "active": + $leases[$l]['act'] = "active"; + break; + case "free": + $leases[$l]['act'] = "expired"; + $leases[$l]['online'] = "offline"; + break; + case "backup": + $leases[$l]['act'] = "reserved"; + $leases[$l]['online'] = "offline"; + break; + } + $f = $f+1; + break; + case "next": + /* skip the next binding statement */ + $f = $f+3; + break; + case "hardware": + $leases[$l]['mac'] = $data[$f+2]; + /* check if it's online and the lease is active */ + if($leases[$l]['act'] == "active") { + $online = exec("/usr/sbin/arp -an |/usr/bin/awk '/{$leases[$l]['ip']}/ {print}'|wc -l"); + if ($online == 1) { + $leases[$l]['online'] = 'online'; + } else { + $leases[$l]['online'] = 'offline'; + } + } + $f = $f+2; + break; + case "client-hostname": + if($data[$f+1] <> "") { + $leases[$l]['hostname'] = preg_replace('/"/','',$data[$f+1]); + } else { + $hostname = gethostbyaddr($leases[$l]['ip']); + if($hostname <> "") { + $leases[$l]['hostname'] = $hostname; + } + } + $f = $f+1; + break; + case "uid": + $f = $f+1; + break; + } + $f++; + } + $l++; + $i++; +} + +/* remove duplicate items by mac address */ +if(count($leases) > 0) { + $leases = remove_duplicate($leases,"ip"); +} + +if(count($pools) > 0) { + $pools = remove_duplicate($pools,"name"); + asort($pools); +} + +// Put this in an easy to use form +$dhcpmac = array(); +$dhcpip = array(); + +foreach ($leases as $value) { + $dhcpmac[$value['mac']] = $value['hostname']; + $dhcpip[$value['ip']] = $value['hostname']; +} + +exec("/usr/sbin/arp -an",$rawdata); + +$i = 0; + +/* if list */ +$ifdescrs = get_configured_interface_with_descr(); + +foreach ($ifdescrs as $key =>$interface) { + $hwif[$config['interfaces'][$key]['if']] = $interface; +} + +$data = array(); +foreach ($rawdata as $line) { + $elements = explode(' ',$line); + + if ($elements[3] != "(incomplete)") { + $arpent = array(); + $arpent['ip'] = trim(str_replace(array('(',')'),'',$elements[1])); + $arpent['mac'] = trim($elements[3]); + $arpent['interface'] = trim($elements[5]); + $data[] = $arpent; + } +} + +function _getHostName($mac,$ip) +{ + global $dhcpmac, $dhcpip; + + if ($dhcpmac[$mac]) + return $dhcpmac[$mac]; + else if ($dhcpip[$ip]) + return $dhcpip[$ip]; + else if(gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip) + return gethostbyaddr($ip); + else + return ""; +} + +$pgtitle = array(gettext("Diagnostics"),gettext("ARP Table")); +include("head.inc"); + +?> + + + + + +
+ +

  +

+ + + + + + +
+ + + + + + + + + + + + + + + + +
+ " . $mac_man_ar[0] . substr($mac, 8) . ""; } + else{ print $mac; } + ?> + + +
+
+ + + + diff --git a/config/mactovendor/bin/status_dhcp_leases.php_ b/config/mactovendor/bin/status_dhcp_leases.php_ index 58ef71b0..311b617c 100644 --- a/config/mactovendor/bin/status_dhcp_leases.php_ +++ b/config/mactovendor/bin/status_dhcp_leases.php_ @@ -1,434 +1,434 @@ -. - 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. -*/ - -/* - pfSense_BUILDER_BINARIES: /usr/bin/awk /bin/cat /usr/sbin/arp /usr/bin/wc /usr/bin/grep - pfSense_MODULE: dhcpserver -*/ - -##|+PRIV -##|*IDENT=page-status-dhcpleases -##|*NAME=Status: DHCP leases page -##|*DESCR=Allow access to the 'Status: DHCP leases' page. -##|*MATCH=status_dhcp_leases.php* -##|-PRIV - -require("guiconfig.inc"); - -$pgtitle = array(gettext("Status"),gettext("DHCP leases")); - -$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"; - -if (($_GET['deleteip']) && (is_ipaddr($_GET['deleteip']))) { - /* Stop DHCPD */ - killbyname("dhcpd"); - - /* Read existing leases */ - $leases_contents = explode("\n", file_get_contents($leasesfile)); - $newleases_contents = array(); - $i=0; - while ($i < count($leases_contents)) { - /* Find the lease(s) we want to delete */ - if ($leases_contents[$i] == "lease {$_GET['deleteip']} {") { - /* Skip to the end of the lease declaration */ - do { - $i++; - } while ($leases_contents[$i] != "}"); - } else { - /* It's a line we want to keep, copy it over. */ - $newleases_contents[] = $leases_contents[$i]; - } - $i++; - } - - /* Write out the new leases file */ - $fd = fopen($leasesfile, 'w'); - fwrite($fd, implode("\n", $newleases_contents)); - fclose($fd); - - /* Restart DHCP Service */ - services_dhcpd_configure(); - header("Location: status_dhcp_leases.php?all={$_GET['all']}"); -} - -include("head.inc"); - -?> - - - - $rien) - $new[] = $array[$k]; - return $new; -} - -$awk = "/usr/bin/awk"; -/* this pattern sticks comments into a single array item */ -$cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'"; -/* We then split the leases file by } */ -$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'"; - -/* stuff the leases file in a proper format into a array by line */ -exec("/bin/cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern}", $leases_content); -$leases_count = count($leases_content); -exec("/usr/sbin/arp -an", $rawdata); -$arpdata = array(); -foreach ($rawdata as $line) { - $elements = explode(' ',$line); - if ($elements[3] != "(incomplete)") { - $arpent = array(); - $arpent['ip'] = trim(str_replace(array('(',')'),'',$elements[1])); - // $arpent['mac'] = trim($elements[3]); - // $arpent['interface'] = trim($elements[5]); - $arpdata[] = $arpent['ip']; - } -} - -$pools = array(); -$leases = array(); -$i = 0; -$l = 0; -$p = 0; - -// Put everything together again -while($i < $leases_count) { - /* split the line by space */ - $data = explode(" ", $leases_content[$i]); - /* walk the fields */ - $f = 0; - $fcount = count($data); - /* with less then 20 fields there is nothing useful */ - if($fcount < 20) { - $i++; - continue; - } - while($f < $fcount) { - switch($data[$f]) { - case "failover": - $pools[$p]['name'] = $data[$f+2]; - $pools[$p]['mystate'] = $data[$f+7]; - $pools[$p]['peerstate'] = $data[$f+14]; - $pools[$p]['mydate'] = $data[$f+10]; - $pools[$p]['mydate'] .= " " . $data[$f+11]; - $pools[$p]['peerdate'] = $data[$f+17]; - $pools[$p]['peerdate'] .= " " . $data[$f+18]; - $p++; - $i++; - continue 3; - case "lease": - $leases[$l]['ip'] = $data[$f+1]; - $leases[$l]['type'] = "dynamic"; - $f = $f+2; - break; - case "starts": - $leases[$l]['start'] = $data[$f+2]; - $leases[$l]['start'] .= " " . $data[$f+3]; - $f = $f+3; - break; - case "ends": - $leases[$l]['end'] = $data[$f+2]; - $leases[$l]['end'] .= " " . $data[$f+3]; - $f = $f+3; - break; - case "tstp": - $f = $f+3; - break; - case "tsfp": - $f = $f+3; - break; - case "atsfp": - $f = $f+3; - break; - case "cltt": - $f = $f+3; - break; - case "binding": - switch($data[$f+2]) { - case "active": - $leases[$l]['act'] = "active"; - break; - case "free": - $leases[$l]['act'] = "expired"; - $leases[$l]['online'] = "offline"; - break; - case "backup": - $leases[$l]['act'] = "reserved"; - $leases[$l]['online'] = "offline"; - break; - } - $f = $f+1; - break; - case "next": - /* skip the next binding statement */ - $f = $f+3; - break; - case "hardware": - $leases[$l]['mac'] = $data[$f+2]; - /* check if it's online and the lease is active */ - if (in_array($leases[$l]['ip'], $arpdata)) { - $leases[$l]['online'] = 'online'; - } else { - $leases[$l]['online'] = 'offline'; - } - $f = $f+2; - break; - case "client-hostname": - if($data[$f+1] <> "") { - $leases[$l]['hostname'] = preg_replace('/"/','',$data[$f+1]); - } else { - $hostname = gethostbyaddr($leases[$l]['ip']); - if($hostname <> "") { - $leases[$l]['hostname'] = $hostname; - } - } - $f = $f+1; - break; - case "uid": - $f = $f+1; - break; - } - $f++; - } - $l++; - $i++; -} - -/* remove duplicate items by mac address */ -if(count($leases) > 0) { - $leases = remove_duplicate($leases,"ip"); -} - -if(count($pools) > 0) { - $pools = remove_duplicate($pools,"name"); - asort($pools); -} - -foreach($config['interfaces'] as $ifname => $ifarr) { - if (is_array($config['dhcpd'][$ifname]) && - is_array($config['dhcpd'][$ifname]['staticmap'])) { - foreach($config['dhcpd'][$ifname]['staticmap'] as $static) { - $slease = array(); - $slease['ip'] = $static['ipaddr']; - $slease['type'] = "static"; - $slease['mac'] = $static['mac']; - $slease['start'] = ""; - $slease['end'] = ""; - $slease['hostname'] = htmlentities($static['hostname']); - $slease['act'] = "static"; - $online = exec("/usr/sbin/arp -an |/usr/bin/grep {$slease['mac']}| /usr/bin/wc -l|/usr/bin/awk '{print $1;}'"); - if ($online == 1) { - $slease['online'] = 'online'; - } else { - $slease['online'] = 'offline'; - } - $leases[] = $slease; - } - } -} - -if ($_GET['order']) - usort($leases, "leasecmp"); - -/* only print pool status when we have one */ -if(count($pools) > 0) { -?> - - - - - - - - -\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; -} - -?> -
{$fspans}{$data['name']}{$fspane} {$fspans}{$data['mystate']}{$fspane} {$fspans}" . adjust_gmt($data['mydate']) . "{$fspane} {$fspans}{$data['peerstate']}{$fspane} {$fspans}" . adjust_gmt($data['peerdate']) . "{$fspane}   
- - - -

- - - - - - - - - - - -"; - $fspane = ""; - } else { - $fspans = $fspane = ""; - } - $lip = ip2ulong($data['ip']); - if ($data['act'] == "static") { - foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { - if(is_array($dhcpifconf['staticmap'])) { - foreach ($dhcpifconf['staticmap'] as $staticent) { - if ($data['ip'] == $staticent['ipaddr']) { - $data['if'] = $dhcpif; - break; - } - } - } - /* exit as soon as we have an interface */ - if ($data['if'] != "") - break; - } - } else { - foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { - if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) { - $data['if'] = $dhcpif; - break; - } - } - } - echo "\n"; - echo "\n"; - $mac=$data['mac']; - $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); - if ($data['online'] != "online") { - if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined - $mac_man_ar = explode(' ', $mac_man[$mac_hi]); - echo "\n"; - }else{ - echo "\n"; - } - } else { - if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined - $mac_man_ar = explode(' ', $mac_man[$mac_hi]); - echo "\n"; - }else{ - echo "\n"; - } - } - echo "\n"; - if ($data['type'] != "static") { - echo "\n"; - echo "\n"; - } else { - echo "\n"; - echo "\n"; - } - echo "\n"; - echo "\n"; - - if ($data['type'] == "dynamic") { - echo "\n"; - } else { - echo "\n"; - } - - echo "\n"; - - /* Only show the button for offline dynamic leases */ - if (($data['type'] == "dynamic") && ($data['online'] != "online")) { - echo "\n"; - } - echo "\n"; - } -} - -?> -
{$fspans}{$data['ip']}{$fspane} {$fspans}" . $mac_man_ar[0] . substr($mac, 8) . "{$fspane} {$fspans}{$data['mac']}{$fspane} {$fspans}" . $mac_man_ar[0] . substr($mac, 8) . "{$fspane} {$fspans}{$data['mac']}{$fspane} {$fspans}" . htmlentities($data['hostname']) . "{$fspane} {$fspans}" . adjust_gmt($data['start']) . "{$fspane} {$fspans}" . adjust_gmt($data['end']) . "{$fspane} {$fspans} n/a {$fspane} {$fspans} n/a {$fspane} {$fspans}{$data['online']}{$fspane} {$fspans}{$data['act']}{$fspane} "; - echo ""; - echo ""; - echo ""; - echo "
-

-

- - - -"> - - -"> - -
- -

?

- - - - - +. + 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. +*/ + +/* + pfSense_BUILDER_BINARIES: /usr/bin/awk /bin/cat /usr/sbin/arp /usr/bin/wc /usr/bin/grep + pfSense_MODULE: dhcpserver +*/ + +##|+PRIV +##|*IDENT=page-status-dhcpleases +##|*NAME=Status: DHCP leases page +##|*DESCR=Allow access to the 'Status: DHCP leases' page. +##|*MATCH=status_dhcp_leases.php* +##|-PRIV + +require("guiconfig.inc"); + +$pgtitle = array(gettext("Status"),gettext("DHCP leases")); + +$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"; + +if (($_GET['deleteip']) && (is_ipaddr($_GET['deleteip']))) { + /* Stop DHCPD */ + killbyname("dhcpd"); + + /* Read existing leases */ + $leases_contents = explode("\n", file_get_contents($leasesfile)); + $newleases_contents = array(); + $i=0; + while ($i < count($leases_contents)) { + /* Find the lease(s) we want to delete */ + if ($leases_contents[$i] == "lease {$_GET['deleteip']} {") { + /* Skip to the end of the lease declaration */ + do { + $i++; + } while ($leases_contents[$i] != "}"); + } else { + /* It's a line we want to keep, copy it over. */ + $newleases_contents[] = $leases_contents[$i]; + } + $i++; + } + + /* Write out the new leases file */ + $fd = fopen($leasesfile, 'w'); + fwrite($fd, implode("\n", $newleases_contents)); + fclose($fd); + + /* Restart DHCP Service */ + services_dhcpd_configure(); + header("Location: status_dhcp_leases.php?all={$_GET['all']}"); +} + +include("head.inc"); + +?> + + + + $rien) + $new[] = $array[$k]; + return $new; +} + +$awk = "/usr/bin/awk"; +/* this pattern sticks comments into a single array item */ +$cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'"; +/* We then split the leases file by } */ +$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'"; + +/* stuff the leases file in a proper format into a array by line */ +exec("/bin/cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern}", $leases_content); +$leases_count = count($leases_content); +exec("/usr/sbin/arp -an", $rawdata); +$arpdata = array(); +foreach ($rawdata as $line) { + $elements = explode(' ',$line); + if ($elements[3] != "(incomplete)") { + $arpent = array(); + $arpent['ip'] = trim(str_replace(array('(',')'),'',$elements[1])); + // $arpent['mac'] = trim($elements[3]); + // $arpent['interface'] = trim($elements[5]); + $arpdata[] = $arpent['ip']; + } +} + +$pools = array(); +$leases = array(); +$i = 0; +$l = 0; +$p = 0; + +// Put everything together again +while($i < $leases_count) { + /* split the line by space */ + $data = explode(" ", $leases_content[$i]); + /* walk the fields */ + $f = 0; + $fcount = count($data); + /* with less then 20 fields there is nothing useful */ + if($fcount < 20) { + $i++; + continue; + } + while($f < $fcount) { + switch($data[$f]) { + case "failover": + $pools[$p]['name'] = $data[$f+2]; + $pools[$p]['mystate'] = $data[$f+7]; + $pools[$p]['peerstate'] = $data[$f+14]; + $pools[$p]['mydate'] = $data[$f+10]; + $pools[$p]['mydate'] .= " " . $data[$f+11]; + $pools[$p]['peerdate'] = $data[$f+17]; + $pools[$p]['peerdate'] .= " " . $data[$f+18]; + $p++; + $i++; + continue 3; + case "lease": + $leases[$l]['ip'] = $data[$f+1]; + $leases[$l]['type'] = "dynamic"; + $f = $f+2; + break; + case "starts": + $leases[$l]['start'] = $data[$f+2]; + $leases[$l]['start'] .= " " . $data[$f+3]; + $f = $f+3; + break; + case "ends": + $leases[$l]['end'] = $data[$f+2]; + $leases[$l]['end'] .= " " . $data[$f+3]; + $f = $f+3; + break; + case "tstp": + $f = $f+3; + break; + case "tsfp": + $f = $f+3; + break; + case "atsfp": + $f = $f+3; + break; + case "cltt": + $f = $f+3; + break; + case "binding": + switch($data[$f+2]) { + case "active": + $leases[$l]['act'] = "active"; + break; + case "free": + $leases[$l]['act'] = "expired"; + $leases[$l]['online'] = "offline"; + break; + case "backup": + $leases[$l]['act'] = "reserved"; + $leases[$l]['online'] = "offline"; + break; + } + $f = $f+1; + break; + case "next": + /* skip the next binding statement */ + $f = $f+3; + break; + case "hardware": + $leases[$l]['mac'] = $data[$f+2]; + /* check if it's online and the lease is active */ + if (in_array($leases[$l]['ip'], $arpdata)) { + $leases[$l]['online'] = 'online'; + } else { + $leases[$l]['online'] = 'offline'; + } + $f = $f+2; + break; + case "client-hostname": + if($data[$f+1] <> "") { + $leases[$l]['hostname'] = preg_replace('/"/','',$data[$f+1]); + } else { + $hostname = gethostbyaddr($leases[$l]['ip']); + if($hostname <> "") { + $leases[$l]['hostname'] = $hostname; + } + } + $f = $f+1; + break; + case "uid": + $f = $f+1; + break; + } + $f++; + } + $l++; + $i++; +} + +/* remove duplicate items by mac address */ +if(count($leases) > 0) { + $leases = remove_duplicate($leases,"ip"); +} + +if(count($pools) > 0) { + $pools = remove_duplicate($pools,"name"); + asort($pools); +} + +foreach($config['interfaces'] as $ifname => $ifarr) { + if (is_array($config['dhcpd'][$ifname]) && + is_array($config['dhcpd'][$ifname]['staticmap'])) { + foreach($config['dhcpd'][$ifname]['staticmap'] as $static) { + $slease = array(); + $slease['ip'] = $static['ipaddr']; + $slease['type'] = "static"; + $slease['mac'] = $static['mac']; + $slease['start'] = ""; + $slease['end'] = ""; + $slease['hostname'] = htmlentities($static['hostname']); + $slease['act'] = "static"; + $online = exec("/usr/sbin/arp -an |/usr/bin/grep {$slease['mac']}| /usr/bin/wc -l|/usr/bin/awk '{print $1;}'"); + if ($online == 1) { + $slease['online'] = 'online'; + } else { + $slease['online'] = 'offline'; + } + $leases[] = $slease; + } + } +} + +if ($_GET['order']) + usort($leases, "leasecmp"); + +/* only print pool status when we have one */ +if(count($pools) > 0) { +?> + + + + + + + + +\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; +} + +?> +
{$fspans}{$data['name']}{$fspane} {$fspans}{$data['mystate']}{$fspane} {$fspans}" . adjust_gmt($data['mydate']) . "{$fspane} {$fspans}{$data['peerstate']}{$fspane} {$fspans}" . adjust_gmt($data['peerdate']) . "{$fspane}   
+ + + +

+ + + + + + + + + + + +"; + $fspane = ""; + } else { + $fspans = $fspane = ""; + } + $lip = ip2ulong($data['ip']); + if ($data['act'] == "static") { + foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { + if(is_array($dhcpifconf['staticmap'])) { + foreach ($dhcpifconf['staticmap'] as $staticent) { + if ($data['ip'] == $staticent['ipaddr']) { + $data['if'] = $dhcpif; + break; + } + } + } + /* exit as soon as we have an interface */ + if ($data['if'] != "") + break; + } + } else { + foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { + if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) { + $data['if'] = $dhcpif; + break; + } + } + } + echo "\n"; + echo "\n"; + $mac=$data['mac']; + $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); + if ($data['online'] != "online") { + if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined + $mac_man_ar = explode(' ', $mac_man[$mac_hi]); + echo "\n"; + }else{ + echo "\n"; + } + } else { + if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined + $mac_man_ar = explode(' ', $mac_man[$mac_hi]); + echo "\n"; + }else{ + echo "\n"; + } + } + echo "\n"; + if ($data['type'] != "static") { + echo "\n"; + echo "\n"; + } else { + echo "\n"; + echo "\n"; + } + echo "\n"; + echo "\n"; + + if ($data['type'] == "dynamic") { + echo "\n"; + } else { + echo "\n"; + } + + echo "\n"; + + /* Only show the button for offline dynamic leases */ + if (($data['type'] == "dynamic") && ($data['online'] != "online")) { + echo "\n"; + } + echo "\n"; + } +} + +?> +
{$fspans}{$data['ip']}{$fspane} {$fspans}" . $mac_man_ar[0] . substr($mac, 8) . "{$fspane} {$fspans}{$data['mac']}{$fspane} {$fspans}" . $mac_man_ar[0] . substr($mac, 8) . "{$fspane} {$fspans}{$data['mac']}{$fspane} {$fspans}" . htmlentities($data['hostname']) . "{$fspane} {$fspans}" . adjust_gmt($data['start']) . "{$fspane} {$fspans}" . adjust_gmt($data['end']) . "{$fspane} {$fspans} n/a {$fspane} {$fspans} n/a {$fspane} {$fspans}{$data['online']}{$fspane} {$fspans}{$data['act']}{$fspane} "; + echo ""; + echo ""; + echo ""; + echo "
+

+

+ + + +"> + + +"> + +
+ +

?

+ + + + + diff --git a/config/mactovendor/bin/status_interfaces.php_ b/config/mactovendor/bin/status_interfaces.php_ index 36c95a0c..1d8f8c9c 100644 --- a/config/mactovendor/bin/status_interfaces.php_ +++ b/config/mactovendor/bin/status_interfaces.php_ @@ -1,353 +1,353 @@ -. - All rights reserved. - - originally part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2005 Manuel Kasper . - 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. -*/ -/* - pfSense_MODULE: interfaces -*/ - -##|+PRIV -##|*IDENT=page-status-interfaces -##|*NAME=Status: Interfaces page -##|*DESCR=Allow access to the 'Status: Interfaces' page. -##|*MATCH=status_interfaces.php* -##|-PRIV - -require_once("guiconfig.inc"); - -if ($_GET['if']) { - $interface = $_GET['if']; - if ($_GET['action'] == "Disconnect" || $_GET['action'] == "Release") { - interface_bring_down($interface); - } else if ($_GET['action'] == "Connect" || $_GET['action'] == "Renew") { - interface_configure($interface); - } - header("Location: status_interfaces.php"); - exit; -} - -$pgtitle = array(gettext("Status"),gettext("Interfaces")); -include("head.inc"); - -?> - - - - - $ifname): - $ifinfo = get_interface_info($ifdescr); - // Load MAC-Manufacturer table - $macs=file("/usr/local/pkg/mactovendor/mac-prefixes"); - if ($macs){ - foreach ($macs as $line){ - if (preg_match('/([0-9A-Fa-f]{6}) (.*)$/', $line, $matches)){ - /* store values like this $mac_man['000C29']='VMware' */ - $mac_man["$matches[1]"]=$matches[2]; - } - } - } -?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- () -
- -
- DHCP - -    - - - " class="formbtns"> - - - " class="formbtns"> - - -
-    - - - " class="formbtns"> - - - " class="formbtns"> - - -
-    - - - " class="formbtns"> - - - " class="formbtns"> - - -
- - - - " class="formbtns"> - - - - " class="formbtns"> - - - -
- -
- " . $mac_man_ar[0] . substr($mac, 8) . ""; } - else {print htmlspecialchars($mac);} - ?> -
- -   -
- -
- - -
- "; - } - ?> -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- "; - echo $interrupt_sec . " " . gettext("rate"); - ?> -
- -
- -','')?> - - +. + All rights reserved. + + originally part of m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2005 Manuel Kasper . + 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. +*/ +/* + pfSense_MODULE: interfaces +*/ + +##|+PRIV +##|*IDENT=page-status-interfaces +##|*NAME=Status: Interfaces page +##|*DESCR=Allow access to the 'Status: Interfaces' page. +##|*MATCH=status_interfaces.php* +##|-PRIV + +require_once("guiconfig.inc"); + +if ($_GET['if']) { + $interface = $_GET['if']; + if ($_GET['action'] == "Disconnect" || $_GET['action'] == "Release") { + interface_bring_down($interface); + } else if ($_GET['action'] == "Connect" || $_GET['action'] == "Renew") { + interface_configure($interface); + } + header("Location: status_interfaces.php"); + exit; +} + +$pgtitle = array(gettext("Status"),gettext("Interfaces")); +include("head.inc"); + +?> + + + + + $ifname): + $ifinfo = get_interface_info($ifdescr); + // Load MAC-Manufacturer table + $macs=file("/usr/local/pkg/mactovendor/mac-prefixes"); + if ($macs){ + foreach ($macs as $line){ + if (preg_match('/([0-9A-Fa-f]{6}) (.*)$/', $line, $matches)){ + /* store values like this $mac_man['000C29']='VMware' */ + $mac_man["$matches[1]"]=$matches[2]; + } + } + } +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ () +
+ +
+ DHCP + +    + + + " class="formbtns"> + + + " class="formbtns"> + + +
+    + + + " class="formbtns"> + + + " class="formbtns"> + + +
+    + + + " class="formbtns"> + + + " class="formbtns"> + + +
+ + + + " class="formbtns"> + + + + " class="formbtns"> + + + +
+ +
+ " . $mac_man_ar[0] . substr($mac, 8) . ""; } + else {print htmlspecialchars($mac);} + ?> +
+ +   +
+ +
+ + +
+ "; + } + ?> +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ "; + echo $interrupt_sec . " " . gettext("rate"); + ?> +
+ +
+ +','')?> + + diff --git a/config/mactovendor/bin/status_wireless.php_ b/config/mactovendor/bin/status_wireless.php_ index fbc35538..8e54e06e 100644 --- a/config/mactovendor/bin/status_wireless.php_ +++ b/config/mactovendor/bin/status_wireless.php_ @@ -1,208 +1,208 @@ - "") - $if = $_GET['if']; - -$ciflist = get_configured_interface_with_descr(); -if(empty($if)) { - /* Find the first interface - that is wireless */ - foreach($ciflist as $interface => $ifdescr) { - if(is_interface_wireless(get_real_interface($interface))) { - $if = $interface; - break; - } - } -} -?> - - - -
- - - - - -
- $ifdescr) { - if (is_interface_wireless(get_real_interface($interface))) { - $enabled = false; - if($if == $interface) - $enabled = true; - $tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}"); - } -} -$rwlif = get_real_interface($if); -if($_POST['rescanwifi'] <> "") { - mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1"); - $savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results."); -} -if ($savemsg) print_info_box($savemsg); -display_top_tabs($tab_array); -?> -
-
- -\n"; - print "\n"; - print "\n"; - print "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n\n"; - - exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret); - /* Skip Header */ - array_shift($states); - - $counter=0; - foreach($states as $state) { - /* Split by Mac address for the SSID Field */ - $split = preg_split("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state); - preg_match("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state, $bssid); - $ssid = htmlspecialchars($split[0]); - $bssid = $bssid[0]; - /* Split the rest by using spaces for this line using the 2nd part */ - $split = preg_split("/[ ]+/i", $split[1]); - $channel = $split[1]; - $rate = $split[2]; - $rssi = $split[3]; - $int = $split[4]; - $caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] "; - - print ""; - print ""; - $mac_hi = strtoupper($bssid[0] . $bssid[1] . $bssid[3] . $bssid[4] . $bssid[6] . $bssid[7]); - if(isset($mac_man[$mac_hi])){ - $mac_man_ar = explode(' ', $mac_man[$mac_hi]); - print ""; - }else - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - } - - print "

" . gettext("Nearby access points or ad-hoc peers") . ".
SSIDBSSIDCHANRATERSSIINTCAPS
{$ssid}" . $mac_man_ar[0] . substr($bssid, 8) . "{$bssid}{$channel}{$rate}{$rssi}{$int}{$caps}
"; - - /* table header */ - print "\n"; - print "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n\n"; - - $states = array(); - exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret); - array_shift($states); - - $counter=0; - foreach($states as $state) { - $split = preg_split("/[ ]+/i", $state); - /* Split the rest by using spaces for this line using the 2nd part */ - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - } - -/* XXX: what stats to we get for adhoc mode? */ - -?> -
" . gettext("Associated or ad-hoc peers") . "
ADDRAIDCHANRATERSSIIDLETXSEQRXSEQCAPSERP
{$split[0]}{$split[1]}{$split[2]}{$split[3]}{$split[4]}{$split[5]}{$split[6]}{$split[7]}{$split[8]}{$split[9]}
-

- Flags: A = authorized, E = Extended Rate (802.11g), P = Power save mode
- Capabilities: E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES), - S = Short preamble, s = Short slot time -
- - - - + "") + $if = $_GET['if']; + +$ciflist = get_configured_interface_with_descr(); +if(empty($if)) { + /* Find the first interface + that is wireless */ + foreach($ciflist as $interface => $ifdescr) { + if(is_interface_wireless(get_real_interface($interface))) { + $if = $interface; + break; + } + } +} +?> + + + + + + + + + +
+ $ifdescr) { + if (is_interface_wireless(get_real_interface($interface))) { + $enabled = false; + if($if == $interface) + $enabled = true; + $tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}"); + } +} +$rwlif = get_real_interface($if); +if($_POST['rescanwifi'] <> "") { + mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1"); + $savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results."); +} +if ($savemsg) print_info_box($savemsg); +display_top_tabs($tab_array); +?> +
+
+ +\n"; + print "\n"; + print "\n"; + print "\n"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n\n"; + + exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret); + /* Skip Header */ + array_shift($states); + + $counter=0; + foreach($states as $state) { + /* Split by Mac address for the SSID Field */ + $split = preg_split("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state); + preg_match("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state, $bssid); + $ssid = htmlspecialchars($split[0]); + $bssid = $bssid[0]; + /* Split the rest by using spaces for this line using the 2nd part */ + $split = preg_split("/[ ]+/i", $split[1]); + $channel = $split[1]; + $rate = $split[2]; + $rssi = $split[3]; + $int = $split[4]; + $caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] "; + + print ""; + print ""; + $mac_hi = strtoupper($bssid[0] . $bssid[1] . $bssid[3] . $bssid[4] . $bssid[6] . $bssid[7]); + if(isset($mac_man[$mac_hi])){ + $mac_man_ar = explode(' ', $mac_man[$mac_hi]); + print ""; + }else + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + } + + print "

" . gettext("Nearby access points or ad-hoc peers") . ".
SSIDBSSIDCHANRATERSSIINTCAPS
{$ssid}" . $mac_man_ar[0] . substr($bssid, 8) . "{$bssid}{$channel}{$rate}{$rssi}{$int}{$caps}
"; + + /* table header */ + print "\n"; + print "\n"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n\n"; + + $states = array(); + exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret); + array_shift($states); + + $counter=0; + foreach($states as $state) { + $split = preg_split("/[ ]+/i", $state); + /* Split the rest by using spaces for this line using the 2nd part */ + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + } + +/* XXX: what stats to we get for adhoc mode? */ + +?> +
" . gettext("Associated or ad-hoc peers") . "
ADDRAIDCHANRATERSSIIDLETXSEQRXSEQCAPSERP
{$split[0]}{$split[1]}{$split[2]}{$split[3]}{$split[4]}{$split[5]}{$split[6]}{$split[7]}{$split[8]}{$split[9]}
+

+ Flags: A = authorized, E = Extended Rate (802.11g), P = Power save mode
+ Capabilities: E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES), + S = Short preamble, s = Short slot time +
+ + + + diff --git a/config/openvpn-client-export/source/dotnet2.nsh b/config/openvpn-client-export/source/dotnet2.nsh index 5ec356e3..272f1bb3 100644 --- a/config/openvpn-client-export/source/dotnet2.nsh +++ b/config/openvpn-client-export/source/dotnet2.nsh @@ -1,93 +1,93 @@ -; Plugin for installing .NET Framework v2.0 -; Written by Christopher St. John -; for EncounterPRO Healthcare Resources, Inc. - -!ifndef DOTNET2_INCLUDED -!define DOTNET2_INCLUDED - -; ----------------------------------------- -; Includes - !include "WordFunc.nsh" - !insertmacro VersionCompare - !include LogicLib.nsh - -; ----------------------------------------- -; Defines - ; Direct-download location of .NET 2.0 redist - !define BASE_URL http://download.microsoft.com/download - !define URL_DOTNET_1033 "${BASE_URL}/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe" - -; ----------------------------------------- -; Variables - Var DotNetVersion2 - Var InstallDotNet2 - -; ----------------------------------------- -; Functions -Function GetDotNETVersion2 - Push $0 - Push $1 - - System::Call "mscoree::GetCORVersion(w .r0, i 1024, *i r2) i .r1" - StrCmp $1 0 +2 - StrCpy $0 0 - - Pop $1 - Exch $0 -FunctionEnd - -; ----------------------------------------- -; Macros -!macro CheckForDotNET2 - ; Check .NET version - StrCpy $InstallDotNET2 "No" - Call GetDotNETVersion2 - Pop $0 - StrCpy $DotNetVersion2 $0 - - ${If} $0 == "not found" - StrCpy $InstallDotNET2 "Yes" - MessageBox MB_OK|MB_ICONINFORMATION "Installer requires that the .NET Framework 2.0 is installed. The .NET Framework will be downloaded and installed automatically during installation." - Return - ${EndIf} - - StrCpy $0 $0 "" 1 # skip "v" - - ${VersionCompare} $0 "2.0" $1 - ${If} $1 == 2 - StrCpy $InstallDotNET2 "Yes" - MessageBox MB_OK|MB_ICONINFORMATION "Installer requires that the .NET Framework 2.0 is installed. The .NET Framework will be downloaded and installed automatically during installation." - Return - ${EndIf} -!macroend - -!macro InstallDotNET2 - ; Get .NET if required - ${If} $InstallDotNET2 == "Yes" - DetailPrint "Downloading .NET Framework v2.0..." - ;SetDetailsView hide - NSISdl::download /TIMEOUT=30000 "${URL_DOTNET_1033}" "$INSTDIR\dotnetfx.exe" - Pop $1 - - ${If} $1 != "success" - DetailPrint "Download failed: $1" - Delete "$INSTDIR\dotnetfx.exe" - Abort "Installation Cancelled" - ${EndIf} - - DetailPrint "Installing .NET Framework v2.0..." - ExecWait '"$INSTDIR\dotnetfx.exe" /q:a /c:"install /passive"' $1 - ${If} $1 == 0 - DetailPrint ".NET Framework v2.0 successfully installed." - ${ElseIf} $1 == 3010 - MessageBox MB_OK ".NET Framework v2.0 has been installed and requires a reboot. Please restart the computer and run this installer again." - Abort ".NET Framework v2.0 requires reboot." - ${Else} - MessageBox MB_OK ".NET Framework v2.0 reports a failure during installation ($1). Please try to install .NET Framework v2.0 via Windows Update before running this installer again." - Abort ".NET Framework v2.0 installation failed ($1)." - ${EndIf} - Delete "$INSTDIR\dotnetfx.exe" - ${EndIf} -!macroend - +; Plugin for installing .NET Framework v2.0 +; Written by Christopher St. John +; for EncounterPRO Healthcare Resources, Inc. + +!ifndef DOTNET2_INCLUDED +!define DOTNET2_INCLUDED + +; ----------------------------------------- +; Includes + !include "WordFunc.nsh" + !insertmacro VersionCompare + !include LogicLib.nsh + +; ----------------------------------------- +; Defines + ; Direct-download location of .NET 2.0 redist + !define BASE_URL http://download.microsoft.com/download + !define URL_DOTNET_1033 "${BASE_URL}/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe" + +; ----------------------------------------- +; Variables + Var DotNetVersion2 + Var InstallDotNet2 + +; ----------------------------------------- +; Functions +Function GetDotNETVersion2 + Push $0 + Push $1 + + System::Call "mscoree::GetCORVersion(w .r0, i 1024, *i r2) i .r1" + StrCmp $1 0 +2 + StrCpy $0 0 + + Pop $1 + Exch $0 +FunctionEnd + +; ----------------------------------------- +; Macros +!macro CheckForDotNET2 + ; Check .NET version + StrCpy $InstallDotNET2 "No" + Call GetDotNETVersion2 + Pop $0 + StrCpy $DotNetVersion2 $0 + + ${If} $0 == "not found" + StrCpy $InstallDotNET2 "Yes" + MessageBox MB_OK|MB_ICONINFORMATION "Installer requires that the .NET Framework 2.0 is installed. The .NET Framework will be downloaded and installed automatically during installation." + Return + ${EndIf} + + StrCpy $0 $0 "" 1 # skip "v" + + ${VersionCompare} $0 "2.0" $1 + ${If} $1 == 2 + StrCpy $InstallDotNET2 "Yes" + MessageBox MB_OK|MB_ICONINFORMATION "Installer requires that the .NET Framework 2.0 is installed. The .NET Framework will be downloaded and installed automatically during installation." + Return + ${EndIf} +!macroend + +!macro InstallDotNET2 + ; Get .NET if required + ${If} $InstallDotNET2 == "Yes" + DetailPrint "Downloading .NET Framework v2.0..." + ;SetDetailsView hide + NSISdl::download /TIMEOUT=30000 "${URL_DOTNET_1033}" "$INSTDIR\dotnetfx.exe" + Pop $1 + + ${If} $1 != "success" + DetailPrint "Download failed: $1" + Delete "$INSTDIR\dotnetfx.exe" + Abort "Installation Cancelled" + ${EndIf} + + DetailPrint "Installing .NET Framework v2.0..." + ExecWait '"$INSTDIR\dotnetfx.exe" /q:a /c:"install /passive"' $1 + ${If} $1 == 0 + DetailPrint ".NET Framework v2.0 successfully installed." + ${ElseIf} $1 == 3010 + MessageBox MB_OK ".NET Framework v2.0 has been installed and requires a reboot. Please restart the computer and run this installer again." + Abort ".NET Framework v2.0 requires reboot." + ${Else} + MessageBox MB_OK ".NET Framework v2.0 reports a failure during installation ($1). Please try to install .NET Framework v2.0 via Windows Update before running this installer again." + Abort ".NET Framework v2.0 installation failed ($1)." + ${EndIf} + Delete "$INSTDIR\dotnetfx.exe" + ${EndIf} +!macroend + !endif \ No newline at end of file diff --git a/config/postfix/postfix_recipients.php b/config/postfix/postfix_recipients.php index 0deb2f79..8d7db416 100644 --- a/config/postfix/postfix_recipients.php +++ b/config/postfix/postfix_recipients.php @@ -1,4 +1,4 @@ - \ No newline at end of file diff --git a/config/squid-reverse/squid_reverse.inc b/config/squid-reverse/squid_reverse.inc index 728a81b2..652931c8 100644 --- a/config/squid-reverse/squid_reverse.inc +++ b/config/squid-reverse/squid_reverse.inc @@ -1,187 +1,187 @@ - $iface) { - $real_ifaces[] = squid_get_real_interface_address($iface); - if($real_ifaces[$i][0]) { - //HTTP - if (!empty($settings['reverse_http'])) - $conf .= "http_port {$real_ifaces[$i][0]}:{$http_port} accel defaultsite={$http_defsite} vhost\n"; - //HTTPS - if (!empty($settings['reverse_https'])) - $conf .= "https_port {$real_ifaces[$i][0]}:{$https_port} accel cert={$reverse_crt} key={$reverse_key} defaultsite={$https_defsite} vhost\n"; - } - } - - if(!empty($settings['reverse_ip'])) { - $reverse_ip = explode(";", ($settings['reverse_ip'])); - foreach ($reverse_ip as $reip) { - //HTTP - if (!empty($settings['reverse_http'])) - $conf .= "http_port {$reip}:{$http_port} accel defaultsite={$http_defsite} vhost\n"; - //HTTPS - if (!empty($settings['reverse_https'])) - $conf .= "https_port {$reip}:{$https_port} accel cert={$reverse_crt} key={$reverse_key} defaultsite={$https_defsite} vhost\n"; - } - } - - //PEERS - if (($settings['reverse_owa'] == 'on') && (!empty($settings['reverse_owa_ip']))) - $conf .= "cache_peer {$settings['reverse_owa_ip']} parent 443 0 proxy-only no-query originserver login=PASS connection-auth=on ssl sslflags=DONT_VERIFY_PEER front-end-https=on name=OWA_HOST_pfs\n"; - - $active_peers=array(); - if (is_array($reverse_peers)) - foreach ($reverse_peers as $rp){ - if ($rp['enable'] =="on" && $rp['name'] !="" && $rp['ip'] !="" && $rp['port'] !=""){ - $conf_peer = "#{$rp['description']}\n"; - $conf_peer .= "cache_peer {$rp['ip']} parent {$rp['port']} 0 proxy-only no-query no-digest originserver login=PASS "; - if($rp['protocol'] == 'HTTPS') - $conf_peer .= "ssl sslflags=DONT_VERIFY_PEER front-end-https=auto "; - $conf_peer .= "name=rvp_{$rp['name']}\n\n"; - - // add peer only if reverse proxy is enabled for http - if($rp['protocol'] == 'HTTP' && $settings['reverse_http'] =="on"){ - $conf .= $conf_peer; - array_push($active_peers,$rp['name']); - } - // add peer only if if reverse proxy is enabled for https - if($rp['protocol'] == 'HTTPS' && $settings['reverse_https'] =="on"){ - if (!in_array($rp['name'],$active_peers)){ - $conf .= $conf_peer; - array_push($active_peers,$rp['name']); - } - } - } - } - - //ACLS and MAPPINGS - - //create an empty owa_dirs to populate based on user selected options - $owa_dirs=array(); - if (($settings['reverse_owa'] == 'on') && $settings['reverse_https'] =="on"){ - if(!empty($settings['reverse_owa_ip'])){ - array_push($owa_dirs,'owa','exchange','public','exchweb','ecp','OAB'); - if($settings['reverse_owa_activesync']) - array_push($owa_dirs,'Microsoft-Server-ActiveSync'); - if($settings['reverse_owa_rpchttp']) - array_push($owa_dirs,'rpc/rpcproxy.dll','rpcwithcert/rpcproxy.dll'); - if($settings['reverse_owa_autodiscover']) - array_push($owa_dirs,'autodiscover'); - if($settings['reverse_owa_webservice']){ - array_push($owa_dirs,'EWS'); - $conf .= "ignore_expect_100 on\n"; - } - } - if (is_array($owa_dirs)) - foreach ($owa_dirs as $owa_dir) - $conf .= "acl OWA_URI_pfs url_regex -i ^https://{$settings['reverse_external_fqdn']}/$owa_dir.*$\n"; - } - //$conf .= "ssl_unclean_shutdown on"; - if (is_array($reverse_maps)) - foreach ($reverse_maps as $rm){ - if ($rm['enable'] == "on" && $rm['name']!="" && $rm['peers']!=""){ - if (is_array($rm['row'])) - foreach ($rm['row'] as $uri){ - $url_regex=($uri['uri'] == '' ? $settings['reverse_external_fqdn'] : $uri['uri'] ); - //$conf .= "acl rvm_{$rm['name']} url_regex -i {$uri['uri']}{$url_regex}.*$\n"; - $conf .= "acl rvm_{$rm['name']} url_regex -i {$url_regex}\n"; - if($rm['name'] != $last_rm_name){ - $cache_peer_never_direct_conf .= "never_direct allow rvm_{$rm['name']}\n"; - $http_access_conf .= "http_access allow rvm_{$rm['name']}\n"; - foreach (explode(',',$rm['peers']) as $map_peer) - if (in_array($map_peer,$active_peers)){ - $cache_peer_allow_conf .= "cache_peer_access rvp_{$map_peer} allow rvm_{$rm['name']}\n"; - $cache_peer_deny_conf .= "cache_peer_access rvp_{$map_peer} deny allsrc\n"; - } - $last_rm_name=$rm['name']; - } - } - } - } - - //ACCESS - if ($settings['reverse_owa'] == 'on' && !empty($settings['reverse_owa_ip']) && $settings['reverse_https'] =="on") { - $conf .= "cache_peer_access OWA_HOST_pfs allow OWA_URI_pfs\n"; - $conf .= "cache_peer_access OWA_HOST_pfs deny allsrc\n"; - $conf .= "never_direct allow OWA_URI_pfs\n"; - $conf .= "http_access allow OWA_URI_pfs\n"; - } - - $conf .= $cache_peer_allow_conf.$cache_peer_deny_conf.$cache_peer_never_direct_conf.$http_access_conf."\n"; - - if (!empty($settings['deny_info_tcp_reset'])) - $conf .= "deny_info TCP_RESET allsrc\n"; - - return $conf; -} -?> + $iface) { + $real_ifaces[] = squid_get_real_interface_address($iface); + if($real_ifaces[$i][0]) { + //HTTP + if (!empty($settings['reverse_http'])) + $conf .= "http_port {$real_ifaces[$i][0]}:{$http_port} accel defaultsite={$http_defsite} vhost\n"; + //HTTPS + if (!empty($settings['reverse_https'])) + $conf .= "https_port {$real_ifaces[$i][0]}:{$https_port} accel cert={$reverse_crt} key={$reverse_key} defaultsite={$https_defsite} vhost\n"; + } + } + + if(!empty($settings['reverse_ip'])) { + $reverse_ip = explode(";", ($settings['reverse_ip'])); + foreach ($reverse_ip as $reip) { + //HTTP + if (!empty($settings['reverse_http'])) + $conf .= "http_port {$reip}:{$http_port} accel defaultsite={$http_defsite} vhost\n"; + //HTTPS + if (!empty($settings['reverse_https'])) + $conf .= "https_port {$reip}:{$https_port} accel cert={$reverse_crt} key={$reverse_key} defaultsite={$https_defsite} vhost\n"; + } + } + + //PEERS + if (($settings['reverse_owa'] == 'on') && (!empty($settings['reverse_owa_ip']))) + $conf .= "cache_peer {$settings['reverse_owa_ip']} parent 443 0 proxy-only no-query originserver login=PASS connection-auth=on ssl sslflags=DONT_VERIFY_PEER front-end-https=on name=OWA_HOST_pfs\n"; + + $active_peers=array(); + if (is_array($reverse_peers)) + foreach ($reverse_peers as $rp){ + if ($rp['enable'] =="on" && $rp['name'] !="" && $rp['ip'] !="" && $rp['port'] !=""){ + $conf_peer = "#{$rp['description']}\n"; + $conf_peer .= "cache_peer {$rp['ip']} parent {$rp['port']} 0 proxy-only no-query no-digest originserver login=PASS "; + if($rp['protocol'] == 'HTTPS') + $conf_peer .= "ssl sslflags=DONT_VERIFY_PEER front-end-https=auto "; + $conf_peer .= "name=rvp_{$rp['name']}\n\n"; + + // add peer only if reverse proxy is enabled for http + if($rp['protocol'] == 'HTTP' && $settings['reverse_http'] =="on"){ + $conf .= $conf_peer; + array_push($active_peers,$rp['name']); + } + // add peer only if if reverse proxy is enabled for https + if($rp['protocol'] == 'HTTPS' && $settings['reverse_https'] =="on"){ + if (!in_array($rp['name'],$active_peers)){ + $conf .= $conf_peer; + array_push($active_peers,$rp['name']); + } + } + } + } + + //ACLS and MAPPINGS + + //create an empty owa_dirs to populate based on user selected options + $owa_dirs=array(); + if (($settings['reverse_owa'] == 'on') && $settings['reverse_https'] =="on"){ + if(!empty($settings['reverse_owa_ip'])){ + array_push($owa_dirs,'owa','exchange','public','exchweb','ecp','OAB'); + if($settings['reverse_owa_activesync']) + array_push($owa_dirs,'Microsoft-Server-ActiveSync'); + if($settings['reverse_owa_rpchttp']) + array_push($owa_dirs,'rpc/rpcproxy.dll','rpcwithcert/rpcproxy.dll'); + if($settings['reverse_owa_autodiscover']) + array_push($owa_dirs,'autodiscover'); + if($settings['reverse_owa_webservice']){ + array_push($owa_dirs,'EWS'); + $conf .= "ignore_expect_100 on\n"; + } + } + if (is_array($owa_dirs)) + foreach ($owa_dirs as $owa_dir) + $conf .= "acl OWA_URI_pfs url_regex -i ^https://{$settings['reverse_external_fqdn']}/$owa_dir.*$\n"; + } + //$conf .= "ssl_unclean_shutdown on"; + if (is_array($reverse_maps)) + foreach ($reverse_maps as $rm){ + if ($rm['enable'] == "on" && $rm['name']!="" && $rm['peers']!=""){ + if (is_array($rm['row'])) + foreach ($rm['row'] as $uri){ + $url_regex=($uri['uri'] == '' ? $settings['reverse_external_fqdn'] : $uri['uri'] ); + //$conf .= "acl rvm_{$rm['name']} url_regex -i {$uri['uri']}{$url_regex}.*$\n"; + $conf .= "acl rvm_{$rm['name']} url_regex -i {$url_regex}\n"; + if($rm['name'] != $last_rm_name){ + $cache_peer_never_direct_conf .= "never_direct allow rvm_{$rm['name']}\n"; + $http_access_conf .= "http_access allow rvm_{$rm['name']}\n"; + foreach (explode(',',$rm['peers']) as $map_peer) + if (in_array($map_peer,$active_peers)){ + $cache_peer_allow_conf .= "cache_peer_access rvp_{$map_peer} allow rvm_{$rm['name']}\n"; + $cache_peer_deny_conf .= "cache_peer_access rvp_{$map_peer} deny allsrc\n"; + } + $last_rm_name=$rm['name']; + } + } + } + } + + //ACCESS + if ($settings['reverse_owa'] == 'on' && !empty($settings['reverse_owa_ip']) && $settings['reverse_https'] =="on") { + $conf .= "cache_peer_access OWA_HOST_pfs allow OWA_URI_pfs\n"; + $conf .= "cache_peer_access OWA_HOST_pfs deny allsrc\n"; + $conf .= "never_direct allow OWA_URI_pfs\n"; + $conf .= "http_access allow OWA_URI_pfs\n"; + } + + $conf .= $cache_peer_allow_conf.$cache_peer_deny_conf.$cache_peer_never_direct_conf.$http_access_conf."\n"; + + if (!empty($settings['deny_info_tcp_reset'])) + $conf .= "deny_info TCP_RESET allsrc\n"; + + return $conf; +} +?> -- cgit v1.2.3