From fa029ba07e16cf79f2adc8e049c0d981ec61d18e Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Thu, 14 Aug 2014 12:46:15 +0200 Subject: [PATCH] Added security directory. --- install/dist/lib/fedora.lib.php | 14 +++++++-- install/dist/lib/gentoo.lib.php | 12 +++++++- install/dist/lib/opensuse.lib.php | 12 +++++++- install/lib/installer_base.lib.php | 12 +++++++- security/check.php | 47 ++++++++++++++++++++++++++++++ security/data/empty.dir | 0 server/server.sh | 3 ++ 7 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 security/check.php create mode 100644 security/data/empty.dir diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php index d6d975a15..e01a739d6 100644 --- a/install/dist/lib/fedora.lib.php +++ b/install/dist/lib/fedora.lib.php @@ -958,13 +958,13 @@ class installer_dist extends installer_base { $this->db->query($sql); } - /// chown install dir to root and chmod 755 + // chown install dir to root and chmod 755 $command = 'chown root:root '.$install_dir; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); $command = 'chmod 755 '.$install_dir; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - //* Chmod the files and directoreies in the install dir + //* Chmod the files and directories in the install dir $command = 'chmod -R 750 '.$install_dir.'/*'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); @@ -975,6 +975,16 @@ class installer_dist extends installer_base { //* chown the server files to the root user and group $command = 'chown -R root:root '.$install_dir.'/server'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security files to the root user and group + $command = 'chown -R root:root '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security directory and security_settings.ini to root:ispconfig + $command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); //* Make the global language file directory group writable exec("chmod -R 770 $install_dir/interface/lib/lang"); diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php index 26474c51f..fb6b13853 100644 --- a/install/dist/lib/gentoo.lib.php +++ b/install/dist/lib/gentoo.lib.php @@ -856,7 +856,7 @@ class installer extends installer_base $command = 'chmod 755 '.$install_dir; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - //* Chmod the files and directoreies in the install dir + //* Chmod the files and directories in the install dir $command = 'chmod -R 750 '.$install_dir.'/*'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); @@ -867,6 +867,16 @@ class installer extends installer_base //* chown the server files to the root user and group $command = 'chown -R root:root '.$install_dir.'/server'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security files to the root user and group + $command = 'chown -R root:root '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security directory and security_settings.ini to root:ispconfig + $command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); //* Make the global language file directory group writable exec("chmod -R 770 $install_dir/interface/lib/lang"); diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php index dad3a6a3c..c76833169 100644 --- a/install/dist/lib/opensuse.lib.php +++ b/install/dist/lib/opensuse.lib.php @@ -1034,7 +1034,7 @@ class installer_dist extends installer_base { $command = 'chmod 755 '.$install_dir; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - //* Chmod the files and directoreies in the install dir + //* Chmod the files and directories in the install dir $command = 'chmod -R 750 '.$install_dir.'/*'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); @@ -1045,6 +1045,16 @@ class installer_dist extends installer_base { //* chown the server files to the root user and group $command = 'chown -R root:root '.$install_dir.'/server'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security files to the root user and group + $command = 'chown -R root:root '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security directory and security_settings.ini to root:ispconfig + $command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); //* Make the global language file directory group writable exec("chmod -R 770 $install_dir/interface/lib/lang"); diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 9bf84b6e1..19e1f032f 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -1891,7 +1891,7 @@ class installer_base { $command = 'chmod 755 '.$install_dir; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); - //* Chmod the files and directoreies in the install dir + //* Chmod the files and directories in the install dir $command = 'chmod -R 750 '.$install_dir.'/*'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); @@ -1902,6 +1902,16 @@ class installer_base { //* chown the server files to the root user and group $command = 'chown -R root:root '.$install_dir.'/server'; caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security files to the root user and group + $command = 'chown -R root:root '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security directory and security_settings.ini to root:ispconfig + $command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); //* Make the global language file directory group writable exec("chmod -R 770 $install_dir/interface/lib/lang"); diff --git a/security/check.php b/security/check.php new file mode 100644 index 000000000..d6518a1c5 --- /dev/null +++ b/security/check.php @@ -0,0 +1,47 @@ +uses('ini_parser,file,services,getconf,system'); + + + +?> \ No newline at end of file diff --git a/security/data/empty.dir b/security/data/empty.dir new file mode 100644 index 000000000..e69de29bb diff --git a/server/server.sh b/server/server.sh index 75253e789..88c30e744 100755 --- a/server/server.sh +++ b/server/server.sh @@ -13,5 +13,8 @@ if [ -f /usr/local/ispconfig/server/lib/php.ini ]; then fi fi +cd /usr/local/ispconfig/security +/usr/bin/php -q /usr/local/ispconfig/security/check.php + cd /usr/local/ispconfig/server /usr/bin/php -q /usr/local/ispconfig/server/server.php -- GitLab