diff options
author | Seth Mos <seth.mos@dds.nl> | 2011-02-01 15:28:55 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@dds.nl> | 2011-02-01 15:28:55 +0100 |
commit | 7203754c2ef2e457bcebec7cc96012b774e04681 (patch) | |
tree | 4d3731e1c853b4ecaeb0214a8e05dd0783e2d575 | |
parent | cebd086a856086529728d2d8592ebd9687451ca3 (diff) | |
parent | 20fef17c7398170e18c9d03bcc04ee794002e981 (diff) | |
download | pfsense-7203754c2ef2e457bcebec7cc96012b774e04681.zip pfsense-7203754c2ef2e457bcebec7cc96012b774e04681.tar.gz |
Merge remote branch 'upstream/master'
31 files changed, 363 insertions, 81 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 12701ab..3d4b61a 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -1072,16 +1072,20 @@ function captiveportal_allowedip_configure_entry($ipent) { */ function setup_dnsfilter_entries() { global $g, $config; + $cp_filterdns_filename = "{$g['varetc_path']}/filterdns-captiveportal.conf"; - $fd = fopen($cp_filterdns_filename, "w"); - if (is_array($config['captiveportal']['allowedhostname'])) - foreach ($config['captiveportal']['allowedhostname'] as $hostnameent) - fwrite($fd, $hostnameent['hostname'] . "\n"); - fclose($fd); - killbypid("{$g['tmp_path']}/dnswatch-cpah.pid"); - // For some reason the killbypid() is not working. Brute force if needed. - exec("/bin/ps awux | grep -v /usr/bin/grep | grep dnswatch-cpah.pid | /usr/bin/awk '{ print \$2 }' | /usr/bin/xargs kill"); - mwexec("/usr/local/sbin/dnswatch {$g['tmp_path']}/dnswatch-cpah.pid 300 /etc/rc.captiveportal_configure {$cp_filterdns_filename}"); + $cp_filterdns_conf = ""; + if (is_array($config['captiveportal']['allowedhostname'])) { + foreach ($config['captiveportal']['allowedhostname'] as $hostnameent) { + $cp_filterdns_conf .= "ipfw $hostnameent 3 '/etc/rc.captiveportal_configure'\n"; + $cp_filterdns_conf .= "ipfw $hostnameent 4 '/etc/rc.captiveportal_configure'\n"; + $cp_filterdns_conf .= "ipfw $hostnameent 7 '/etc/rc.captiveportal_configure'\n"; + $cp_filterdns_conf .= "ipfw $hostnameent 8 '/etc/rc.captiveportal_configure'\n"; + } + } + file_put_contents($cp_filterdns_filename, $cp_filterdns_conf); + killbypid("{$g['tmp_path']}/filterdns-cpah.pid"); + mwexec("/usr/local/sbin/filterdns -p {$g['tmp_path']}/filterdns-cpah.pid -i 300 -c {$cp_filterdns_filename} -d 1"); } function captiveportal_allowedhostname_configure() { @@ -1511,4 +1515,4 @@ function portal_ip_from_client_ip($cliip) { return false; } -?>
\ No newline at end of file +?> diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 8b6b5d2..f320531 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -472,7 +472,7 @@ function filter_generate_nested_alias($name, $alias, &$aliasnesting, &$aliasaddr $tmpline = filter_generate_nested_alias($address, $aliastable[$address], $aliasnesting, $aliasaddrnesting); } else if(!isset($aliasaddrnesting[$address])) { if(!is_ipaddr($address) && !is_subnet($address) && !is_port($address)) { - $filterdns .= "{$address} = {$name}\n"; + $filterdns .= "pf {$address} {$name}\n"; continue; } $aliasaddrnesting[$address] = $address; diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index ce1e9fd..496b8bc 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -278,7 +278,7 @@ function openvpn_add_keyfile(& $data, & $conf, $mode_id, $directive, $opt = "") $conf .= "{$directive} {$fpath} {$opt}\n"; } -function openvpn_reconfigure($mode,& $settings) { +function openvpn_reconfigure($mode, $settings) { global $g, $config; if (empty($settings)) @@ -571,7 +571,7 @@ function openvpn_reconfigure($mode,& $settings) { @chmod("{$g['varetc_path']}/openvpn/{$mode_id}.conf", 0600); } -function openvpn_restart($mode, & $settings) { +function openvpn_restart($mode, $settings) { global $g, $config; $vpnid = $settings['vpnid']; @@ -683,7 +683,7 @@ function openvpn_delete_csc(& $settings) { } // Resync the configuration and restart the VPN -function openvpn_resync($mode, & $settings) { +function openvpn_resync($mode, $settings) { openvpn_reconfigure($mode, $settings); openvpn_restart($mode, $settings); } diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index d811a85..cdb90c1 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -175,6 +175,8 @@ function enable_rrd_graphing() { $mem = "-memory.rrd"; $cellular = "-cellular.rrd"; $vpnusers = "-vpnusers.rrd"; + $captiveportalconcurrent = "-concurrent.rrd"; + $captiveportalloggedin = "-loggedin.rrd"; $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool"; $netstat = "/usr/bin/netstat"; @@ -186,6 +188,7 @@ function enable_rrd_graphing() { $top = "/usr/bin/top"; $spamd_gather = "/usr/local/bin/spamd_gather_stats.php"; $ifconfig = "/sbin/ifconfig"; + $captiveportal_gather = "/usr/local/bin/captiveportal_gather_stats.php"; $rrdtrafficinterval = 60; $rrdwirelessinterval = 60; @@ -199,6 +202,7 @@ function enable_rrd_graphing() { $rrdmeminterval = 60; $rrdcellularinterval = 60; $rrdvpninterval = 60; + $rrdcaptiveportalinterval = 60; $trafficvalid = $rrdtrafficinterval * 2; $wirelessvalid = $rrdwirelessinterval * 2; @@ -212,6 +216,7 @@ function enable_rrd_graphing() { $memvalid = $rrdmeminterval * 2; $cellularvalid = $rrdcellularinterval * 2; $vpnvalid = $rrdvpninterval * 2; + $captiveportalvalid = $rrdcaptiveportalinterval * 2; /* Asume GigE for now */ $downstream = 125000000; @@ -666,6 +671,78 @@ function enable_rrd_graphing() { $rrdupdatesh .= "else $rrdtool update $rrddbpath$ifname$cellular N:U:U; fi\n"; } + /* Captive Portal statistics, set up the rrd file */ + if(isset($config['captiveportal']['enable'])) { + $ifname= "captiveportal"; + if (!file_exists("$rrddbpath$ifname$captiveportal")) { + $rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportalconcurrent --step $rrdcaptiveportalinterval "; + $rrdcreate .= "DS:concurrentusers:GAUGE:$captiveportalvalid:0:10000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:5:1000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:60:1000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:720:3000 "; + $rrdcreate .= "RRA:MIN:0.5:1:1000 "; + $rrdcreate .= "RRA:MIN:0.5:5:1000 "; + $rrdcreate .= "RRA:MIN:0.5:60:1000 "; + $rrdcreate .= "RRA:MIN:0.5:720:3000 "; + $rrdcreate .= "RRA:MAX:0.5:1:1000 "; + $rrdcreate .= "RRA:MAX:0.5:5:1000 "; + $rrdcreate .= "RRA:MAX:0.5:60:1000 "; + $rrdcreate .= "RRA:MAX:0.5:720:3000 "; + $rrdcreate .= "RRA:LAST:0.5:1:1000 "; + $rrdcreate .= "RRA:LAST:0.5:5:1000 "; + $rrdcreate .= "RRA:LAST:0.5:60:1000 "; + $rrdcreate .= "RRA:LAST:0.5:720:3000 "; + + create_new_rrd($rrdcreate); + } + + /* enter UNKNOWN values in the RRD so it knows we rebooted. */ + if($g['booting']) { + mwexec("$rrdtool update $rrddbpath$ifname$captiveportalconcurrent N:U"); + } + + /* the Captive Portal stats gathering function. */ + $rrdupdatesh .= "\n"; + $rrdupdatesh .= "# polling Captive Portal for number of concurrent users\n"; + $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalconcurrent \\\n"; + $rrdupdatesh .= "`$php -q $captiveportal_gather concurrent`\n"; + + $ifname= "captiveportal"; + if (!file_exists("$rrddbpath$ifname$captiveportal")) { + $rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportalloggedin --step $rrdcaptiveportalinterval "; + $rrdcreate .= "DS:loggedinusers:GAUGE:$captiveportalvalid:0:10000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:5:1000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:60:1000 "; + $rrdcreate .= "RRA:AVERAGE:0.5:720:3000 "; + $rrdcreate .= "RRA:MIN:0.5:1:1000 "; + $rrdcreate .= "RRA:MIN:0.5:5:1000 "; + $rrdcreate .= "RRA:MIN:0.5:60:1000 "; + $rrdcreate .= "RRA:MIN:0.5:720:3000 "; + $rrdcreate .= "RRA:MAX:0.5:1:1000 "; + $rrdcreate .= "RRA:MAX:0.5:5:1000 "; + $rrdcreate .= "RRA:MAX:0.5:60:1000 "; + $rrdcreate .= "RRA:MAX:0.5:720:3000 "; + $rrdcreate .= "RRA:LAST:0.5:1:1000 "; + $rrdcreate .= "RRA:LAST:0.5:5:1000 "; + $rrdcreate .= "RRA:LAST:0.5:60:1000 "; + $rrdcreate .= "RRA:LAST:0.5:720:3000 "; + + create_new_rrd($rrdcreate); + } + + /* enter UNKNOWN values in the RRD so it knows we rebooted. */ + if($g['booting']) { + mwexec("$rrdtool update $rrddbpath$ifname$captiveportalloggedin N:U"); + } + + /* the Captive Portal stats gathering function. */ + $rrdupdatesh .= "\n"; + $rrdupdatesh .= "# polling Captive Portal for number of logged in users and concurrent users\n"; + $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalloggedin \\\n"; + $rrdupdatesh .= "`$php -q $captiveportal_gather loggedin`\n"; + } $rrdupdatesh .= "sleep 60\n"; $rrdupdatesh .= "done\n"; diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index bea2c04..85bae2b 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -517,7 +517,7 @@ class altq_root_queue { * foreach ($queues as $qkey => $queue) * this->queues[$qkey]->build_rule(); */ - function build_rules($default = false) { + function build_rules(&$default = false) { if (count($this->queues) > 0 && $this->GetEnabled() == "on") { $default = false; $rules = " altq on " . get_real_interface($this->GetInterface()); @@ -542,7 +542,7 @@ class altq_root_queue { } $rules .= " } \n"; foreach ($this->queues as $q) { - $rules .= $q->build_rules(&$default); + $rules .= $q->build_rules($default); } } if ($default == false) { @@ -1035,7 +1035,7 @@ class priq_queue { /* Should return something like: * queue $qname on $qinterface bandwidth .... */ - function build_rules($default = false) { + function build_rules(&$default = false) { $pfq_rule = " queue ". $this->qname; if ($this->GetInterface()) $pfq_rule .= " on ".get_real_interface($this->GetInterface()); @@ -1685,7 +1685,7 @@ class hfsc_queue extends priq_queue { } /* Even this should take children into consideration */ - function build_rules($default = false) { + function build_rules(&$default = false) { $pfq_rule = " queue ". $this->qname; if ($this->GetInterface()) @@ -1767,7 +1767,7 @@ class hfsc_queue extends priq_queue { } $pfq_rule .= " } \n"; foreach ($this->subqueues as $q) - $pfq_rule .= $q->build_rules(); + $pfq_rule .= $q->build_rules(&$default); } $pfq_rule .= " \n"; @@ -2227,7 +2227,7 @@ class cbq_queue extends priq_queue { } /* Even this should take children into consideration */ - function build_rules($default = false) { + function build_rules(&$default = false) { $pfq_rule = "queue ". $this->qname; if ($this->GetInterface()) $pfq_rule .= " on ".get_real_interface($this->GetInterface()); @@ -2288,7 +2288,7 @@ class cbq_queue extends priq_queue { } $pfq_rule .= " } \n"; foreach ($this->subqueues as $q) - $pfq_rule .= $q->build_rules(&$default); + $pfq_rule .= $q->build_rules($default); } $pfq_rule .= " \n"; @@ -2502,7 +2502,7 @@ class fairq_queue extends priq_queue { } /* Even this should take children into consideration */ - function build_rules($default = false) { + function build_rules(&$default = false) { $pfq_rule = "queue ". $this->qname; if ($this->GetInterface()) $pfq_rule .= " on ".get_real_interface($this->GetInterface()); diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index e4b49ec..caf8006 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -37,7 +37,7 @@ pfSense_BUILDER_BINARIES: /usr/bin/killall /usr/local/sbin/sasyncd /sbin/ifconfig /sbin/sysctl pfSense_BUILDER_BINARIES: /usr/local/sbin/setkey /usr/bin/netstat /sbin/route /bin/mkdir pfSense_BUILDER_BINARIES: /usr/local/sbin/racoonctl /usr/local/sbin/racoon - pfSense_BUILDER_BINARIES: /usr/local/sbin/dnswatch /usr/local/sbin/mpd4 + pfSense_BUILDER_BINARIES: /usr/local/sbin/filterdns /usr/local/sbin/mpd4 pfSense_MODULE: vpn */ @@ -103,7 +103,7 @@ function vpn_ipsec_configure($ipchg = false) /* kill racoon */ if(is_process_running("racoon")) mwexec("/usr/bin/killall racoon", true); - killbypid("{$g['varrun_path']}/dnswatch-ipsec.pid"); + killbypid("{$g['varrun_path']}/filterdns-ipsec.pid"); /* wait for racoon process to die */ sleep(2); @@ -133,7 +133,7 @@ function vpn_ipsec_configure($ipchg = false) /* resolve all local, peer addresses and setup pings */ $ipmap = array(); $rgmap = array(); - $dnswatch_list = array(); + $filterdns_list = array(); if (is_array($a_phase1) && count($a_phase1)) { /* step through each phase1 entry */ @@ -149,7 +149,7 @@ function vpn_ipsec_configure($ipchg = false) $ipmap[] = $ep; /* see if this tunnel has a hostname for the remote-gateway. If so, - try to resolve it now and add it to the list for dnswatch */ + try to resolve it now and add it to the list for filterdns */ if (isset ($ph1ent['mobile'])) continue; @@ -157,7 +157,7 @@ function vpn_ipsec_configure($ipchg = false) $rg = $ph1ent['remote-gateway']; if (!is_ipaddr($rg)) { - $dnswatch_list[] = "{$rg}=value"; + $filterdns_list[] = "{$rg}"; add_hostname_to_watch($rg); $rg = resolve_retry($rg); if (!$rg) @@ -897,19 +897,20 @@ EOD; /* load SPD */ mwexec("/usr/local/sbin/setkey -f {$g['varetc_path']}/spd.conf", false); - /* start dnswatch, if necessary */ - if (count($dnswatch_list) > 0) { + /* start filterdns, if necessary */ + if (count($filterdns_list) > 0) { $interval = 60; if (!empty($ipseccfg['dns-interval']) && is_numeric($ipseccfg['dns-interval'])) $interval = $ipseccfg['dns-interval']; $hostnames = ""; - array_unique($dnswatch_list); - $hostnames = implode("\n", $dnswatch_list); - file_put_contents("{$g['varetc_path']}/dnswatch-ipsec.hosts", $hostnames); + array_unique($filterdns_list); + foreach ($filterdns_list as $hostname) + $hostnames .= "cmd {$hostname} '/etc/rc.newipsecdns'\n"; + file_put_contents("{$g['varetc_path']}/filterdns-ipsec.hosts", $hostnames); - killbypid("{$g['varrun_path']}/dnswatch-ipsec.pid"); - mwexec("/usr/local/sbin/dnswatch {$g['varrun_path']}/dnswatch-ipsec.pid $interval /etc/rc.newipsecdns {$g['varetc_path']}/dnswatch-ipsec.hosts"); + killbypid("{$g['varrun_path']}/filterdns-ipsec.pid"); + mwexec("/usr/local/sbin/filterdns -p {$g['varrun_path']}/filterdns-ipsec.pid -i {$interval} -c {$g['varetc_path']}/filterdns-ipsec.hosts -d 1"); } } @@ -1674,7 +1675,7 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { $old_remote_subnet = ipsec_idinfo_to_cidr($old_phase2['remoteid']); /* see if this tunnel has a hostname for the remote-gateway, and if so, - * try to resolve it now and add it to the list for dnswatch */ + * try to resolve it now and add it to the list for filterdns */ if (!is_ipaddr($phase1['remote-gateway'])) { $rgip = resolve_retry($phase1['remote-gateway']); add_hostname_to_watch($phase1['remote-gateway']); @@ -25,6 +25,12 @@ PLATFORM=`/bin/cat /etc/platform` # Set our current version version=`/bin/cat /etc/version` +# Setup dumpdev/ddb/savecore" +echo "Configuring crash dumps..." +if [ "$PLATFORM" = "pfSense" ]; then + /etc/rc.dumpon +fi + # Mount memory file system if it exists echo "Mounting filesystems..." @@ -110,9 +116,9 @@ elif [ "$PLATFORM" = "nanobsd" ] ; then /bin/rm -rf /var/db/pkg /bin/ln -s /root/var/db/pkg/ /var/db/pkg else - /etc/rc.dumpon SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1` /sbin/swapon -a 2>/dev/null >/dev/null + /etc/rc.savecore fi if [ "$PLATFORM" = "cdrom" ] ; then diff --git a/etc/rc.dumpon b/etc/rc.dumpon index 7e72a73..fad1a82 100755 --- a/etc/rc.dumpon +++ b/etc/rc.dumpon @@ -1,7 +1,6 @@ #!/bin/sh # Based on: # FreeBSD: src/etc/rc.d/dumpon,v 1.12.2.1.4.1 2010/06/14 02:09:06 kensmith Exp -# FreeBSD: src/etc/rc.d/savecore,v 1.16.2.2.4.1 2010/06/14 02:09:06 kensmith Exp # dumpon @@ -34,24 +33,3 @@ fi if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then /sbin/ddb /etc/ddb.conf fi - -# savecore - -dumpdev=`/bin/realpath /dev/dumpdev` -dumpdir='/var/crash' - -if [ ! -c "${dumpdev}" ]; then - echo "Dump device does not exist. Savecore not run." - exit -fi - -if [ ! -d "${dumpdir}" ]; then - echo "Dump directory does not exist. Savecore not run." - exit -fi - -if savecore -C "${dumpdir}" "${dumpdev}" >/dev/null; then - savecore ${dumpdir} ${dumpdev} -else - echo 'No core dumps found.' -fi diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip index 1aacfb1..c1f6ddc 100755 --- a/etc/rc.initial.setlanip +++ b/etc/rc.initial.setlanip @@ -139,6 +139,7 @@ $config['interfaces'][$interface]['ipaddr'] = $intip; $config['interfaces'][$interface]['subnet'] = $intbits; + $config['interfaces'][$interface]['enable'] = true; if($g['services_dhcp_server_enable']) $yn = prompt_for_enable_dhcp_server(); @@ -257,4 +258,4 @@ fgets($fp); fclose($fp); -?>
\ No newline at end of file +?> diff --git a/etc/rc.linkup b/etc/rc.linkup index 997228f..2e8bbcd 100755 --- a/etc/rc.linkup +++ b/etc/rc.linkup @@ -43,6 +43,7 @@ function handle_argument_group($iface, $argument2) { if (is_ipaddr($ipaddr) || empty($ipaddr)) { log_error("Hotplug event detected for {$iface} but ignoring since interface is configured with static IP ({$ipaddr})"); $iface = get_real_interface($iface); + interfaces_bring_up($iface); exec("/usr/sbin/arp -d -i {$iface} -a"); } else { switch ($argument2) { diff --git a/etc/rc.newipsecdns b/etc/rc.newipsecdns index 9239428..3061f16 100755 --- a/etc/rc.newipsecdns +++ b/etc/rc.newipsecdns @@ -45,7 +45,7 @@ log_error("IPSEC: One or more IPSEC tunnel endpoints has changed IP. Refreshing."); /* We will walk the list of hostnames found in the ipsec tunnel - * configuration. Since we are already triggered by dnswatch + * configuration. Since we are already triggered by filterdns * that a hostname has changed we can proceed to compare the * new IP address with the old address from the DNS cache. */ diff --git a/etc/rc.savecore b/etc/rc.savecore new file mode 100755 index 0000000..8685330 --- /dev/null +++ b/etc/rc.savecore @@ -0,0 +1,22 @@ +#!/bin/sh +# Based on: +# FreeBSD: src/etc/rc.d/savecore,v 1.16.2.2.4.1 2010/06/14 02:09:06 kensmith Exp + +dumpdev=`/bin/realpath /dev/dumpdev` +dumpdir='/var/crash' + +if [ ! -c "${dumpdev}" ]; then + echo "Dump device does not exist. Savecore not run." + exit +fi + +if [ ! -d "${dumpdir}" ]; then + echo "Dump directory does not exist. Savecore not run." + exit +fi + +if savecore -C "${dumpdir}" "${dumpdev}" >/dev/null; then + savecore ${dumpdir} ${dumpdev} +else + echo 'No core dumps found.' +fi diff --git a/tmp/post_upgrade_command b/tmp/post_upgrade_command index ed49d0a..99285e4 100755 --- a/tmp/post_upgrade_command +++ b/tmp/post_upgrade_command @@ -5,24 +5,24 @@ KERNELTYPE=`cat /boot/kernel/pfsense_kernel.txt` if [ $KERNELTYPE = "wrap" ]; then if [ -f /kernels/kernel_wrap.gz ]; then - tar xzpf /kernels/kernel_wrap.gz -C /boot/ + tar xzpf /kernels/kernel_wrap.gz --exclude loader.conf -C /boot/ cp /etc/ttys_wrap /etc/ttys fi fi if [ $KERNELTYPE = "Developers" ]; then if [ -f /kernels/kernel_Dev.gz ]; then - tar xzpf /kernels/kernel_Dev.gz -C /boot/ + tar xzpf /kernels/kernel_Dev.gz --exclude loader.conf -C /boot/ cp /boot/kernel/kernel.gz fi fi if [ $KERNELTYPE = "SMP" ]; then if [ -f /kernels/kernel_SMP.gz ]; then - tar xzpf /kernels/kernel_SMP.gz -C /boot/ + tar xzpf /kernels/kernel_SMP.gz --exclude loader.conf -C /boot/ fi fi if [ $KERNELTYPE = "UP" ]; then if [ -f /kernels/kernel_SMP.gz ]; then - tar xzpf /kernels/kernel_uniprocessor.gz -C /boot/ + tar xzpf /kernels/kernel_uniprocessor.gz --exclude loader.conf -C /boot/ fi fi diff --git a/usr/local/bin/captiveportal_gather_stats.php b/usr/local/bin/captiveportal_gather_stats.php new file mode 100644 index 0000000..5fe1c6b --- /dev/null +++ b/usr/local/bin/captiveportal_gather_stats.php @@ -0,0 +1,106 @@ +#!/usr/local/bin/php -q +<?php +/* $Id$ */ +/* + captiveportal_gather_stats.php + Copyright (C) 2011 Warren Baker + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require_once("functions.inc"); +require_once("captiveportal.inc"); +require_once("util.inc"); + +/* read in captive portal db */ +$cpdb = captiveportal_read_db(); + +/* determine number of logged in users */ +$no_users = count($cpdb); +$concurrent_users = $no_users; + +/* set initial user count to zero */ +$current_user_count = 0; + +/* tmp file to use to store old data (per interface)*/ +$tmpfile = "{$g['tmp_path']}/captiveportal_online_users"; + +$type = $argv[1]; + +if(empty($type)) + exit; + +/* echo the rrd required syntax */ +echo "N:"; + +if ($type == "loggedin") { + + /* Find out the previous user timestamp + * so we can determine the difference between the current + * and previous user count. If the file is empty return a 0. + */ + $fd = @fopen($tmpfile, "r"); + if ($fd) { + while (!feof($fd)) { + $line = trim(fgets($fd)); + if($line) + $previous_user_timestamp = $line; + else + $previous_user_timestamp = 0; + } + } else { + $previous_user_timestamp = 0; + } + @fclose($fd); + + + foreach($cpdb as $user) { + $user_ip = $user[2]; + // Record the timestamp + $timestamp = $user[0]; + if ($timestamp > $previous_user_timestamp) + $current_user_count = $current_user_count + 1; + } + + // Write out the latest timestamp + $fd = @fopen($tmpfile, "w"); + if ($fd) { + fwrite($fd, $timestamp); + } + @fclose($fd); + + /* If $timestamp is less than or equal to previous_user_timestamp return 0, + * as we only want the 'X' number of users logged in since last RRD poll. + */ + if($timestamp <= $previous_user_timestamp) + $result = 0; + else { + $result = $current_user_count; + } +} else + $result = $no_users; + + +echo "$result"; + +?>
\ No newline at end of file diff --git a/usr/local/www/diag_limiter_info.php b/usr/local/www/diag_limiter_info.php index 1d4ca28..6f525dc 100644 --- a/usr/local/www/diag_limiter_info.php +++ b/usr/local/www/diag_limiter_info.php @@ -71,7 +71,7 @@ include("head.inc"); }); } function activitycallback(transport) { - $('limiteractivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; + $('limiteractivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre style="text-align:left;">' + transport.responseText + '</pre></font>'; setTimeout('getlimiteractivity()', 2000); } setTimeout('getlimiteractivity()', 5000); diff --git a/usr/local/www/diag_pf_info.php b/usr/local/www/diag_pf_info.php index 633cd1e..cba9727 100644 --- a/usr/local/www/diag_pf_info.php +++ b/usr/local/www/diag_pf_info.php @@ -75,7 +75,7 @@ include("head.inc"); }); } function activitycallback(transport) { - $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; + $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre style="text-align:left;">' + transport.responseText + '</pre></font>'; setTimeout('getcpuactivity()', 2000); } setTimeout('getcpuactivity()', 5000); diff --git a/usr/local/www/diag_system_activity.php b/usr/local/www/diag_system_activity.php index b94dc92..e1e8003 100644 --- a/usr/local/www/diag_system_activity.php +++ b/usr/local/www/diag_system_activity.php @@ -70,7 +70,7 @@ include("head.inc"); }); } function activitycallback(transport) { - $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; + $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre style="text-align:left;">' + transport.responseText + '</pre></font>'; setTimeout('getcpuactivity()', 2500); } setTimeout('getcpuactivity()', 1000); diff --git a/usr/local/www/diag_system_pftop.php b/usr/local/www/diag_system_pftop.php index a064f27..af0a581 100644 --- a/usr/local/www/diag_system_pftop.php +++ b/usr/local/www/diag_system_pftop.php @@ -77,7 +77,7 @@ else }); } function activitycallback(transport) { - $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; + $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre style="text-align:left;">' + transport.responseText + '</pre></font>'; setTimeout('getcpuactivity()', 2500); } setTimeout('getcpuactivity()', 1000); diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index d09b39f..600348d 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -162,9 +162,9 @@ if ($config['pptpd']['mode'] == "server") if(have_ruleint_access("pptp")) $iflist['pptp'] = "PPTP VPN"; -if ($config['pppoe']['mode'] == "server") - if(have_ruleint_access("pppoe")) - $iflist['pppoe'] = "PPPoE VPN"; +foreach ($config['pppoes']['pppoe'] as $pppoes) + if (($pppoes['mode'] == 'server') && have_ruleint_access("pppoe")) + $iflist['pppoe'] = "PPPoE Server"; /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable'])) diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index 28b1b4c..4505a02 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -122,6 +122,9 @@ if ($_GET['option']) { continue 2; } } + case "captiveportal": + $curoption = "allgraphs"; + break; default: $curoption = "wan"; break; @@ -173,6 +176,7 @@ $dbheader = array("allgraphs-traffic.rrd", "allgraphs-wireless.rrd", "allgraphs-cellular.rrd", "allgraphs-vpnusers.rrd", + "captiveportal-allgraphs.rrd", "allgraphs-packets.rrd", "system-allgraphs.rrd", "system-throughput.rrd", @@ -196,6 +200,9 @@ foreach($databases as $database) { if(stristr($database, "-vpnusers")) { $vpnusers = true; } + if(stristr($database, "captiveportal-") && isset($config['captiveportal']['enable'])) { + $captiveportal = true; + } } /* append the existing array to the header */ $ui_databases = array_merge($dbheader, $databases); @@ -344,6 +351,10 @@ function get_dates($curperiod, $graph) { if($curcat == "vpnusers") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array("VPN", $tabactive, "status_rrd_graph.php?cat=vpnusers"); } + if($captiveportal) { + if($curcat == "captiveportal") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Captive Portal", $tabactive, "status_rrd_graph.php?cat=captiveportal"); + } if($curcat == "custom") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array(gettext("Custom"), $tabactive, "status_rrd_graph.php?cat=custom"); if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } @@ -387,6 +398,11 @@ function get_dates($curperiod, $graph) { $replace = array(" :: ", "", $friendly); switch($curcat) { + case "captiveportal": + $optionc = str_replace($search, $replace, $optionc[1]); + echo "<option value=\"$optionc\""; + $prettyprint = ucwords(str_replace($search, $replace, $optionc)); + break; case "system": $optionc = str_replace($search, $replace, $optionc[1]); echo "<option value=\"$optionc\""; diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 3943b51..18c938f 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -209,6 +209,7 @@ if(file_exists($rrdcolors)) { $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); + $colorcaptiveportalusers = array('990000'); } switch ($curstyle) { @@ -1034,6 +1035,44 @@ elseif((strstr($curdatabase, "-cellular.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, "-loggedin.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { + /* define graphcmd for online Captive Portal users stats */ + $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; + $graphcmd .= "--start $start --end $end "; + $graphcmd .= "--vertical-label \"Captive Portal Users\" "; + $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; + $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; + $graphcmd .= "--height 200 --width 620 "; + $graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE\" "; + $graphcmd .= "LINE2:\"$curif-loggedinusers#{$colorcaptiveportalusers[0]}:$curif-loggedinusers\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" "; + $graphcmd .= "COMMENT:\"Users Online\t\" "; + $graphcmd .= "GPRINT:\"$curif-loggedinusers:LAST:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-loggedinusers:AVERAGE:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-loggedinusers:MAX:%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, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) { + /* define graphcmd for online Captive Portal users stats */ + $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png "; + $graphcmd .= "--start $start --end $end "; + $graphcmd .= "--vertical-label \"Captive Portal Users\" "; + $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee "; + $graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" "; + $graphcmd .= "--height 200 --width 620 "; + $graphcmd .= "DEF:\"$curif-concurrentusers=$rrddbpath$curdatabase:concurrentusers:AVERAGE\" "; + $graphcmd .= "LINE2:\"$curif-concurrentusers#{$colorcaptiveportalusers[0]}:$curif-concurrentusers\" "; + $graphcmd .= "COMMENT:\"\\n\" "; + $graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" "; + $graphcmd .= "COMMENT:\"Users Online\t\" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:LAST:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%7.2lf \" "; + $graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%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\"`\" "; +} else { $data = false; log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase)); diff --git a/usr/local/www/status_rrd_graph_settings.php b/usr/local/www/status_rrd_graph_settings.php index 7accd25..a4b562e 100755 --- a/usr/local/www/status_rrd_graph_settings.php +++ b/usr/local/www/status_rrd_graph_settings.php @@ -54,7 +54,8 @@ $categories = array('system' => gettext("System"), 'traffic' => gettext("Traffic"), 'packets' => gettext("Packets"), 'quality' => gettext("Quality"), - 'queues' => gettext("Queues")); + 'queues' => gettext("Queues"), + 'captiveportal' => gettext("Captive Portal")); $styles = array('inverse' => gettext("Inverse"), 'absolute' => gettext("Absolute")); $periods = array("absolute" => gettext("Absolute Timespans"), @@ -101,6 +102,9 @@ foreach($databases as $database) { if(stristr($database, "-vpnusers")) { $vpnusers = true; } + if(stristr($database, "captiveportal-") && isset($config['captiveportal']['enable'])) { + $captiveportal = true; + } } $pgtitle = array(gettext("Status"),gettext("RRD Graphs")); @@ -143,6 +147,10 @@ include("head.inc"); if($curcat == "vpnusers") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array(gettext("VPN"), $tabactive, "status_rrd_graph.php?cat=vpnusers"); } + if($captiveportal) { + if($curcat == "captiveportal") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array(gettext("Captive Portal"), $tabactive, "status_rrd_graph.php?cat=captiveportal"); + } if($curcat == "custom") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array(gettext("Custom"), $tabactive, "status_rrd_graph.php?cat=custom"); if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } diff --git a/usr/local/www/themes/code-red/rrdcolors.inc.php b/usr/local/www/themes/code-red/rrdcolors.inc.php index cdaff68..7da2805 100755 --- a/usr/local/www/themes/code-red/rrdcolors.inc.php +++ b/usr/local/www/themes/code-red/rrdcolors.inc.php @@ -47,5 +47,6 @@ $colorwireless = array('990000','a83c3c','b36666'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); +$colorcaptiveportalusers = array('990000'); ?> diff --git a/usr/local/www/themes/metallic/rrdcolors.inc.php b/usr/local/www/themes/metallic/rrdcolors.inc.php index 8e74545..c2bc613 100644 --- a/usr/local/www/themes/metallic/rrdcolors.inc.php +++ b/usr/local/www/themes/metallic/rrdcolors.inc.php @@ -47,5 +47,6 @@ $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); +$colorcaptiveportalusers = 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 8e74545..c2bc613 100644 --- a/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense-dropdown/rrdcolors.inc.php @@ -47,5 +47,6 @@ $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); +$colorcaptiveportalusers = array('990000'); ?> diff --git a/usr/local/www/themes/pfsense/rrdcolors.inc.php b/usr/local/www/themes/pfsense/rrdcolors.inc.php index 8e74545..c2bc613 100644 --- a/usr/local/www/themes/pfsense/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense/rrdcolors.inc.php @@ -47,5 +47,6 @@ $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); +$colorcaptiveportalusers = 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 246b717..fc66253 100644 --- a/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php +++ b/usr/local/www/themes/pfsense_ng/rrdcolors.inc.php @@ -47,5 +47,6 @@ $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); +$colorcaptiveportalusers = 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 246b717..fc66253 100644 --- a/usr/local/www/themes/the_wall/rrdcolors.inc.php +++ b/usr/local/www/themes/the_wall/rrdcolors.inc.php @@ -47,5 +47,6 @@ $colorwireless = array('333333','a83c3c','999999'); $colorspamdtime = array('DDDDFF', 'AAAAFF', 'DDDDFF', '000066'); $colorspamdconn = array('00AA00BB', 'FFFFFFFF', '00660088', 'FFFFFF88', '006600'); $colorvpnusers = array('990000'); +$colorcaptiveportalusers = array('990000'); ?> diff --git a/usr/local/www/vpn_ipsec_phase1.php b/usr/local/www/vpn_ipsec_phase1.php index 6240a63..3a14f3b 100644 --- a/usr/local/www/vpn_ipsec_phase1.php +++ b/usr/local/www/vpn_ipsec_phase1.php @@ -389,6 +389,8 @@ function methodsel_change() { document.getElementById('opt_peerid').style.display = ''; document.getElementById('opt_cert').style.display = ''; document.getElementById('opt_ca').style.display = ''; + document.getElementById('opt_cert').disabled = false; + document.getElementById('opt_ca').disabled = false; break; case 'xauth_rsa_server': case 'rsasig': @@ -396,6 +398,8 @@ function methodsel_change() { document.getElementById('opt_peerid').style.display = ''; document.getElementById('opt_cert').style.display = ''; document.getElementById('opt_ca').style.display = ''; + document.getElementById('opt_cert').disabled = false; + document.getElementById('opt_ca').disabled = false; break; <?php if ($pconfig['mobile']) { ?> case 'pre_shared_key': @@ -403,6 +407,8 @@ function methodsel_change() { document.getElementById('opt_peerid').style.display = 'none'; document.getElementById('opt_cert').style.display = 'none'; document.getElementById('opt_ca').style.display = 'none'; + document.getElementById('opt_cert').disabled = true; + document.getElementById('opt_ca').disabled = true; break; <?php } ?> default: /* psk modes*/ @@ -410,6 +416,8 @@ function methodsel_change() { document.getElementById('opt_peerid').style.display = ''; document.getElementById('opt_cert').style.display = 'none'; document.getElementById('opt_ca').style.display = 'none'; + document.getElementById('opt_cert').disabled = true; + document.getElementById('opt_ca').disabled = true; break; } } diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index d2374b2..d28315d 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -125,7 +125,7 @@ if($_GET['act']=="edit"){ } else $pconfig['shared_key'] = base64_decode($a_client[$id]['shared_key']); $pconfig['crypto'] = $a_client[$id]['crypto']; - $pconfig['engine'] = $a_server[$id]['engine']; + $pconfig['engine'] = $a_client[$id]['engine']; $pconfig['tunnel_network'] = $a_client[$id]['tunnel_network']; $pconfig['remote_network'] = $a_client[$id]['remote_network']; diff --git a/usr/local/www/widgets/widgets/openvpn.widget.php b/usr/local/www/widgets/widgets/openvpn.widget.php index fdf2e3c..c93c708 100644 --- a/usr/local/www/widgets/widgets/openvpn.widget.php +++ b/usr/local/www/widgets/widgets/openvpn.widget.php @@ -13,7 +13,7 @@ if($_GET['action']) { $retval = kill_client($port, $remipp); echo htmlentities("|{$port}|{$remipp}|{$retval}|"); } else { - echo "invalid input"; + echo gettext("invalid input"); } exit; } @@ -21,7 +21,10 @@ if($_GET['action']) { function kill_client($port, $remipp) { - $tcpsrv = "tcp://127.0.0.1:{$port}"; + global $g; + + //$tcpsrv = "tcp://127.0.0.1:{$port}"; + $tcpsrv = "unix://{$g['varetc_path']}/openvpn/{$port}.sock"; $errval; $errstr; @@ -29,13 +32,19 @@ function kill_client($port, $remipp) { $fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1); $killed = -1; if ($fp) { + stream_set_timeout($fp, 1); fputs($fp, "kill {$remipp}\n"); while (!feof($fp)) { $line = fgets($fp, 1024); + + $info = stream_get_meta_data($fp); + if ($info['timed_out']) + break; + /* parse header list line */ - if (strpos($line, "INFO:")) + if (strpos($line, "INFO:") !== false) continue; - if (strpos($line, "UCCESS")) { + if (strpos($line, "SUCCESS") !== false) { $killed = 0; } break; @@ -97,7 +106,7 @@ $clients = openvpn_get_active_clients(); <td class="listhdrr">Real/Virtual IP</td> </tr> <?php foreach ($server['conns'] as $conn): ?> - <tr name='<?php echo "r:{$server['port']}:{$conn['remote_host']}"; ?>'> + <tr name='<?php echo "r:{$server['mgmt']}:{$conn['remote_host']}"; ?>'> <td class="listlr"> <?=$conn['common_name'];?> </td> @@ -106,12 +115,12 @@ $clients = openvpn_get_active_clients(); </td> <td class='list' rowspan="2"> <img src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif' height='17' width='17' border='0' - onclick="killClient('<?php echo $server['port']; ?>', '<?php echo $conn['remote_host']; ?>');" style='cursor:pointer;' - name='<?php echo "i:{$server['port']}:{$conn['remote_host']}"; ?>' + onclick="killClient('<?php echo $server['mgmt']; ?>', '<?php echo $conn['remote_host']; ?>');" style='cursor:pointer;' + name='<?php echo "i:{$server['mgmt']}:{$conn['remote_host']}"; ?>' title='Kill client connection from <?php echo $conn['remote_host']; ?>' alt='' /> </td> </tr> - <tr name='<?php echo "r:{$server['port']}:{$conn['remote_host']}"; ?>'> + <tr name='<?php echo "r:{$server['mgmt']}:{$conn['remote_host']}"; ?>'> <td class="listlr"> <?=$conn['connect_time'];?> </td> |