Why No Status?
-
This was a really easy modification, and something we can really use. Why isn't something like this already in PFSense?
$pgtitle = "Diagnostics: OpenVPN status"; require("guiconfig.inc"); function dump_ovpnstat($logfile) { $count=0; $header=true; $fh=@fopen($logfile,'r'); if(!$fh) echo "status file not found required custom option: status $logfile"; else { while(!feof($fh)) { $line=trim(fgets($fh,1024)); $data = explode(",", $line); if(count($data)==5) { echo "\n"; $class="lr"; foreach($data as $val) { if($header) echo "" . htmlspecialchars($val) . "\n"; else { $count++; echo "" . htmlspecialchars($val) . "\n"; } $class="r"; } echo "\n"; $header=false; } } fclose($fh); if($count==0) echo "no connections"; } } function mod_time($logfile) { $ret=false; $fh=@fopen($logfile,'r'); if(!$fh) return false; fgets($fh,1024); $line=fgets($fh,1024); $data=explode(",",$line,2); if(count($data)>1 && $data[0]=='Updated') $ret=$data[1]; fclose($fh); return $ret; } include("head.inc"); ?> $logfile='/var/log/openvpn-status.log'; $mtime=mod_time($logfile); if($mtime) print ' updated '.htmlspecialchars($mtime).' '; ?>
-
I would like to use this but have no idea where to implement it…
I copied the contents and placed it in the /usr/local/www/vpn_status.phpadded: status /var/log/openvpn-status.log to Custom options in the vpn setup window.
but all i get is:
Diagnostics: OpenVPN status
updated 12/10/2009 12:35:30 pm
-
Is someone connected to your OpenVPN server? It lists current connections, and /var/log/openvpn-status.log is updated once a minute, so it may not show up for up to 60 seconds.
cat /var/log/openvpn-status.log
-
I get this:
cat /var/log/openvpn-status.log
OpenVPN STATISTICS
Updated,Thu Dec 10 12:51:34 2009
TUN/TAP read bytes,260
TUN/TAP write bytes,260
TCP/UDP read bytes,5860
TCP/UDP write bytes,9100
Auth read bytes,1700
pre-compress bytes,0
post-compress bytes,0
pre-decompress bytes,0
post-decompress bytes,0
END -
Yep. You have no connections to list. I just updated my code in the first post so it displays "no connections" in that case.
Actually, my file doesn't look like that. Are you running an OpenVPN server or client?
-
Thanks!
I dont think its running every minute. I refreshed the page and it still shows the same time…
Did I add the status option to the correct location? -
Yep. You have no connections to list. I just updated my code in the first post so it displays "no connections" in that case.
Actually, my file doesn't look like that. Are you running an OpenVPN server or client?
I am running the openvpn site to site.
-
The reason I would like to use this script is becuase i am getting this on the status page.
The servers are all up I can ping hosts on the other side but they are all reporting down except for the first one.
-
My script shows the status of the OpenVPN server. It's not going to display anything from your status file, because there is no client list.
# cat /var/log/openvpn-status.log OpenVPN CLIENT LIST Updated,Thu Dec 10 12:42:18 2009 Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since ROUTING TABLE Virtual Address,Common Name,Real Address,Last Ref GLOBAL STATS Max bcast/mcast queue length,0 END
-
There is an OpenVPN status in 2.0 that works much better.
The Dashboard widget doesn't work as well as I'd hoped, and I'm not sure that it ever really will on 1.2.x.
As for why such a thing hasn't been added to 1.2.x, it's probably considered too much of a "feature". Most of the changes in 1.2.3 were bug fixes, features that made their way in as a part of other bug fixes, or bits that were needed by commercial support customers.
I can try to work some of this OpenVPN status code into an add-on package though.
-
Is there any way you could add the private IP addresses assigned to the client in the webgui?
This was a really easy modification, and something we can really use. Why isn't something like this already in PFSense?
$pgtitle = "Diagnostics: OpenVPN status"; require("guiconfig.inc"); function dump_ovpnstat($logfile) { $count=0; $header=true; $fh=@fopen($logfile,'r'); if(!$fh) echo "status file not found required custom option: status $logfile"; else { while(!feof($fh)) { $line=trim(fgets($fh,1024)); $data = explode(",", $line); if(count($data)==5) { echo "\n"; $class="lr"; foreach($data as $val) { if($header) echo "" . htmlspecialchars($val) . "\n"; else { $count++; echo "" . htmlspecialchars($val) . "\n"; } $class="r"; } echo "\n"; $header=false; } } fclose($fh); if($count==0) echo "no connections"; } } function mod_time($logfile) { $ret=false; $fh=@fopen($logfile,'r'); if(!$fh) return false; fgets($fh,1024); $line=fgets($fh,1024); $data=explode(",",$line,2); if(count($data)>1 && $data[0]=='Updated') $ret=$data[1]; fclose($fh); return $ret; } include("head.inc"); ?> $logfile='/var/log/openvpn-status.log'; $mtime=mod_time($logfile); if($mtime) print ' updated '.htmlspecialchars($mtime).' '; ?>
-
Is there any way you could add the private IP addresses assigned to the client in the webgui?
this is my biggest complaint. i cant see the ip addresses that are assigned to each client. and sometimes they change after rebooting a client
-
This is already done in the 2.0 openvpn client status.
-
awesome. i cant wait for it to become stable release. i tried the beta for a few days, but i was having some intermittent issues with it
-
I just uploaded a package to add the OpenVPN status page from 2.0 to 1.2.3. Details here:
http://forum.pfsense.org/index.php/topic,22301.msg114826.html#msg114826 -
I just uploaded a package to add the OpenVPN status page from 2.0 to 1.2.3. Details here:
http://forum.pfsense.org/index.php/topic,22301.msg114826.html#msg114826oh thank you SO much….this is exactly what i needed!