From 0a83b504c8a2d469c1d7ac056b42f136e92b87d5 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Tue, 18 Aug 2015 10:36:11 +0200 Subject: Unlink and recreate the conf file symlink on every reconfiguration Just in case users shuffle interfaces assignment somehow.... --- config/ipguard/ipguard.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'config/ipguard') diff --git a/config/ipguard/ipguard.inc b/config/ipguard/ipguard.inc index bbef02e4..272e4d31 100644 --- a/config/ipguard/ipguard.inc +++ b/config/ipguard/ipguard.inc @@ -72,7 +72,11 @@ function ipguard_custom_php_write_config() { $pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3); if ($pfs_version == "2.2") { $conf_file_link = "/usr/pbi/ipguard-" . php_uname("m") . "/local/etc/ipguard_{$key}.conf"; - @symlink($conf_file, $conf_file_link); + /* Better recreate this every time just in case users shuffle interfaces assignment somehow */ + if (is_link($conf_file_link)) { + unlink($conf_file_link); + } + symlink($conf_file, $conf_file_link); } $iface = convert_friendly_interface_to_real_interface_name($key); $start .= "/usr/local/sbin/ipguard -l /var/log/ipguard_{$key}.log -p /var/run/ipguard_{$key}.pid -f {$conf_file} -u 300 -z {$iface}\n\t"; -- cgit v1.2.3