diff options
author | Ermal <eri@pfsense.org> | 2010-08-18 15:46:37 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-08-18 15:46:37 +0000 |
commit | 71ca2cb2d4c2f573939db6801bef3db59d3b8b3c (patch) | |
tree | f9df72e66bdfd0f292871480c0968bf487b5aa67 /etc/inc | |
parent | 19e3d450b3c3dad6404ff3131fd9483e1ccc7277 (diff) | |
download | pfsense-71ca2cb2d4c2f573939db6801bef3db59d3b8b3c.zip pfsense-71ca2cb2d4c2f573939db6801bef3db59d3b8b3c.tar.gz |
Ticket #826. Convert to unix domain sockets for management interface so we do not have problems when interface is any.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/openvpn.inc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 4606c89..9053c85 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -404,7 +404,9 @@ function openvpn_reconfigure($mode,& $settings) { $conf .= "lport {$settings['local_port']}\n"; // The management port to listen on - $conf .= "management 127.0.0.1 {$settings['local_port']}\n"; + // Use unix socket to overcome the problem on any type of server + $conf .= "management {$g['varetc_path']}/openvpn/{$mode_id}.sock unix\n"; + //$conf .= "management 127.0.0.1 {$settings['local_port']}\n"; if ($settings['maxclients']) $conf .= "max-clients {$settings['maxclients']}\n"; @@ -445,7 +447,9 @@ function openvpn_reconfigure($mode,& $settings) { // If local_port is used, bind the management port if ($settings['local_port']) { $conf .= "lport {$settings['local_port']}\n"; - $conf .= "management 127.0.0.1 {$settings['local_port']}\n"; + // Use unix socket to overcome the problem on any type of server + $conf .= "management {$g['varetc_path']}/openvpn/{$mode_id}.sock unix\n"; + //$conf .= "management 127.0.0.1 {$settings['local_port']}\n"; } // If there is no bind option at all (ip and/or port), add "nobind" directive @@ -709,8 +713,9 @@ function openvpn_resync_all($interface = "") { } function openvpn_get_active_servers() { + global $config, $g; + $servers = array(); - global $config; if (is_array($config['openvpn']['openvpn-server'])) { foreach ($config['openvpn']['openvpn-server'] as & $settings) { @@ -726,7 +731,10 @@ function openvpn_get_active_servers() { $server['name'] = "Server {$prot}:{$port}"; $server['conns'] = array(); - $tcpsrv = "tcp://127.0.0.1:{$port}"; + $vpnid = $settings['vpnid']; + $mode_id = "server{$vpnid}"; + $server['mgmt'] = $mode_id; + $tcpsrv = "unix://{$g['varetc_path']}/openvpn/{$mode_id}.sock"; $errval; $errstr; @@ -786,8 +794,9 @@ function openvpn_get_active_servers() { } function openvpn_get_active_clients() { + global $config, $g; + $clients = array(); - global $config; if (is_array($config['openvpn']['openvpn-client'])) { foreach ($config['openvpn']['openvpn-client'] as & $settings) { @@ -801,7 +810,10 @@ function openvpn_get_active_clients() { else $client['name'] = "Client {$prot}:{$port}"; - $tcpcli = "tcp://127.0.0.1:{$port}"; + $vpnid = $settings['vpnid']; + $mode_id = "client{$vpnid}"; + $client['mgmt'] = $mode_id; + $tcpcli = "unix://{$g['varetc_path']}/openvpn/{$mode_id}.sock"; $errval; $errstr; |