From be00850b9db59c1a477656aa82a9daf7183532a6 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Tue, 7 May 2013 20:19:49 +0545 Subject: Remember which interface was used by each OpenVPN conf When interfaces go down and up we need to know which interface (vr1, vr2 etc) each OpenVPN instance is using so we can optimize our decision about which instances to resync. That data is not in the conf file (the conf file contains the IP address the instance binds to). This change puts the interface name into a little file in /var/etc/openvpn for later use. --- etc/inc/openvpn.inc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'etc/inc/openvpn.inc') diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index a5244fd..bd92642 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -744,9 +744,12 @@ function openvpn_reconfigure($mode, $settings) { $fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.conf"; file_put_contents($fpath, $conf); unset($conf); + $fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.interface"; + file_put_contents($fpath, $interface); //chown($fpath, 'nobody'); //chgrp($fpath, 'nobody'); @chmod("{$g['varetc_path']}/openvpn/{$mode_id}.conf", 0600); + @chmod("{$g['varetc_path']}/openvpn/{$mode_id}.interface", 0600); @chmod("{$g['varetc_path']}/openvpn/{$mode_id}.key", 0600); @chmod("{$g['varetc_path']}/openvpn/{$mode_id}.tls-auth", 0600); @chmod("{$g['varetc_path']}/openvpn/{$mode_id}.conf", 0600); -- cgit v1.1