From dce071e2b2b4a9e5cecf1469fad0522f8ccb7485 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Wed, 9 Jul 2008 19:01:08 +0000 Subject: [PATCH] Create a missing directory for the firewall in installer. --- install/lib/installer_base.lib.php | 32 ++++++++++--------- .../plugins-available/firewall_plugin.inc.php | 2 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 0ac9d6bc32..2f0f26d965 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -601,11 +601,11 @@ class installer_base { $dist_init_scripts = $conf['init_scripts']; - if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", $FILE, __LINE__); + if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__); @mkdir("/etc/Bastille", octdec($directory_mode)); - if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", $FILE, __LINE__); - caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", $FILE, __LINE__); - caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", $FILE, __LINE__); + if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__); + caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__); + caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__); $content = rf("/etc/Bastille/bastille-firewall.cfg"); $content = str_replace("{DNS_SERVERS}", "", $content); @@ -626,23 +626,25 @@ class installer_base { wf("/etc/Bastille/bastille-firewall.cfg", $content); - if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup_".date("m_d_Y__H_i_s", $current_date), $FILE, __LINE__); - caselog("cp -f apps/bastille-firewall $dist_init_scripts", $FILE, __LINE__); - caselog("chmod 700 $dist_init_scripts/bastille-firewall", $FILE, __LINE__); + if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup_".date("m_d_Y__H_i_s", $current_date), __FILE__, __LINE__); + caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__); + caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__); - if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", $FILE, __LINE__); - caselog("cp -f apps/bastille-ipchains /sbin", $FILE, __LINE__); - caselog("chmod 700 /sbin/bastille-ipchains", $FILE, __LINE__); + if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__); + caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__); + caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__); - if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", $FILE, __LINE__); - caselog("cp -f apps/bastille-netfilter /sbin", $FILE, __LINE__); - caselog("chmod 700 /sbin/bastille-netfilter", $FILE, __LINE__); + if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__); + caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__); + caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__); + + if(!@is_dir('/var/lock/subsys')) caselog("mkdir /var/lock/subsys", __FILE__, __LINE__); exec("which ipchains &> /dev/null", $ipchains_location, $ret_val); - if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', $FILE, __LINE__); + if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__); unset($ipchains_location); exec("which iptables &> /dev/null", $iptables_location, $ret_val); - if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', $FILE, __LINE__); + if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__); unset($iptables_location); } diff --git a/server/plugins-available/firewall_plugin.inc.php b/server/plugins-available/firewall_plugin.inc.php index 8525bf3440..4c8c467bff 100644 --- a/server/plugins-available/firewall_plugin.inc.php +++ b/server/plugins-available/firewall_plugin.inc.php @@ -96,7 +96,7 @@ class firewall_plugin { $app->log('Writing firewall configuration /etc/Bastille/bastille-firewall.cfg',LOGLEVEL_DEBUG); unset($tpl); - if($data["new"]["active"] == 'y')) { + if($data["new"]["active"] == 'y') { exec('/etc/init.d/bastille-firewall restart'); if(@is_file('/etc/debian_version')) exec('update-rc.d bastille-firewall defaults'); $app->log('Restarting the firewall',LOGLEVEL_DEBUG); -- GitLab