Skip to content

Commit 8e283b5

Browse files
author
Marius Cramer
committed
Merge branch 'work-3.0.5.4p3' into 'stable-3.0.5'
Work for 3.0.5.4p4 See merge request !123
2 parents 65ad343 + 350a863 commit 8e283b5

File tree

1,925 files changed

+7609
-23563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,925 files changed

+7609
-23563
lines changed

install/dist/lib/fedora.lib.php

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function configure_mailman($status = 'insert') {
114114

115115
function configure_postfix($options = '')
116116
{
117-
global $conf;
117+
global $conf,$autoinstall;
118118
$cf = $conf['postfix'];
119119
$config_dir = $cf['config_dir'];
120120

@@ -832,6 +832,31 @@ public function install_ispconfig()
832832
//* copy the ISPConfig server part
833833
$command = "cp -rf ../server $install_dir";
834834
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
835+
836+
//* Make a backup of the security settings
837+
if(is_file('/usr/local/ispconfig/security/security_settings.ini')) copy('/usr/local/ispconfig/security/security_settings.ini','/usr/local/ispconfig/security/security_settings.ini~');
838+
839+
//* copy the ISPConfig security part
840+
$command = 'cp -rf ../security '.$install_dir;
841+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
842+
843+
//* Apply changed security_settings.ini values to new security_settings.ini file
844+
if(is_file('/usr/local/ispconfig/security/security_settings.ini~')) {
845+
$security_settings_old = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini~'));
846+
$security_settings_new = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini'));
847+
if(is_array($security_settings_new) && is_array($security_settings_old)) {
848+
foreach($security_settings_new as $section => $sval) {
849+
if(is_array($sval)) {
850+
foreach($sval as $key => $val) {
851+
if(isset($security_settings_old[$section]) && isset($security_settings_old[$section][$key])) {
852+
$security_settings_new[$section][$key] = $security_settings_old[$section][$key];
853+
}
854+
}
855+
}
856+
}
857+
file_put_contents('/usr/local/ispconfig/security/security_settings.ini',array_to_ini($security_settings_new));
858+
}
859+
}
835860

836861
//* Create a symlink, so ISPConfig is accessible via web
837862
// Replaced by a separate vhost definition for port 8080
@@ -958,12 +983,38 @@ public function install_ispconfig()
958983
$this->db->query($sql);
959984
}
960985

961-
//* Chmod the files
962-
$command = "chmod -R 750 $install_dir";
986+
// chown install dir to root and chmod 755
987+
$command = 'chown root:root '.$install_dir;
988+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
989+
$command = 'chmod 755 '.$install_dir;
990+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
991+
992+
//* Chmod the files and directories in the install dir
993+
$command = 'chmod -R 750 '.$install_dir.'/*';
963994
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
964995

965-
//* chown the files to the ispconfig user and group
966-
$command = "chown -R ispconfig:ispconfig $install_dir";
996+
//* chown the interface files to the ispconfig user and group
997+
$command = 'chown -R ispconfig:ispconfig '.$install_dir.'/interface';
998+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
999+
1000+
//* chown the server files to the root user and group
1001+
$command = 'chown -R root:root '.$install_dir.'/server';
1002+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1003+
1004+
//* chown the security files to the root user and group
1005+
$command = 'chown -R root:root '.$install_dir.'/security';
1006+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1007+
1008+
//* chown the security directory and security_settings.ini to root:ispconfig
1009+
$command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini';
1010+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1011+
$command = 'chown root:ispconfig '.$install_dir.'/security';
1012+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1013+
$command = 'chown root:ispconfig '.$install_dir.'/security/ids.whitelist';
1014+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1015+
$command = 'chown root:ispconfig '.$install_dir.'/security/ids.htmlfield';
1016+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1017+
$command = 'chown root:ispconfig '.$install_dir.'/security/apache_directives.blacklist';
9671018
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
9681019

9691020
//* Make the global language file directory group writable

install/dist/lib/gentoo.lib.php

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function configure_jailkit()
4949

5050
public function configure_postfix($options = '')
5151
{
52-
global $conf;
52+
global $conf,$autoinstall;
5353

5454
$cf = $conf['postfix'];
5555
$config_dir = $cf['config_dir'];
@@ -126,6 +126,7 @@ public function configure_postfix($options = '')
126126
$command = 'cd '.$config_dir.'; '
127127
.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
128128
}
129+
exec($command);
129130

130131
$command = 'chmod o= '.$config_dir.'/smtpd.key';
131132
caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
@@ -747,6 +748,31 @@ public function install_ispconfig()
747748
//* copy the ISPConfig server part
748749
$command = "cp -rf ../server $install_dir";
749750
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
751+
752+
//* Make a backup of the security settings
753+
if(is_file('/usr/local/ispconfig/security/security_settings.ini')) copy('/usr/local/ispconfig/security/security_settings.ini','/usr/local/ispconfig/security/security_settings.ini~');
754+
755+
//* copy the ISPConfig security part
756+
$command = 'cp -rf ../security '.$install_dir;
757+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
758+
759+
//* Apply changed security_settings.ini values to new security_settings.ini file
760+
if(is_file('/usr/local/ispconfig/security/security_settings.ini~')) {
761+
$security_settings_old = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini~'));
762+
$security_settings_new = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini'));
763+
if(is_array($security_settings_new) && is_array($security_settings_old)) {
764+
foreach($security_settings_new as $section => $sval) {
765+
if(is_array($sval)) {
766+
foreach($sval as $key => $val) {
767+
if(isset($security_settings_old[$section]) && isset($security_settings_old[$section][$key])) {
768+
$security_settings_new[$section][$key] = $security_settings_old[$section][$key];
769+
}
770+
}
771+
}
772+
}
773+
file_put_contents('/usr/local/ispconfig/security/security_settings.ini',array_to_ini($security_settings_new));
774+
}
775+
}
750776

751777

752778
//* Create the config file for ISPConfig interface
@@ -850,12 +876,38 @@ public function install_ispconfig()
850876
$this->db->query($sql);
851877
}
852878

853-
//* Chmod the files
854-
$command = "chmod -R 750 $install_dir";
879+
// chown install dir to root and chmod 755
880+
$command = 'chown root:root '.$install_dir;
881+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
882+
$command = 'chmod 755 '.$install_dir;
883+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
884+
885+
//* Chmod the files and directories in the install dir
886+
$command = 'chmod -R 750 '.$install_dir.'/*';
855887
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
856888

857-
//* chown the files to the ispconfig user and group
858-
$command = "chown -R ispconfig:ispconfig $install_dir";
889+
//* chown the interface files to the ispconfig user and group
890+
$command = 'chown -R ispconfig:ispconfig '.$install_dir.'/interface';
891+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
892+
893+
//* chown the server files to the root user and group
894+
$command = 'chown -R root:root '.$install_dir.'/server';
895+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
896+
897+
//* chown the security files to the root user and group
898+
$command = 'chown -R root:root '.$install_dir.'/security';
899+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
900+
901+
//* chown the security directory and security_settings.ini to root:ispconfig
902+
$command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini';
903+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
904+
$command = 'chown root:ispconfig '.$install_dir.'/security';
905+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
906+
$command = 'chown root:ispconfig '.$install_dir.'/security/ids.whitelist';
907+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
908+
$command = 'chown root:ispconfig '.$install_dir.'/security/ids.htmlfield';
909+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
910+
$command = 'chown root:ispconfig '.$install_dir.'/security/apache_directives.blacklist';
859911
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
860912

861913
//* Make the global language file directory group writable

install/dist/lib/opensuse.lib.php

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function configure_mailman($status = 'insert') {
130130

131131
function configure_postfix($options = '')
132132
{
133-
global $conf;
133+
global $conf,$autoinstall;
134134
$cf = $conf['postfix'];
135135
$config_dir = $cf['config_dir'];
136136

@@ -264,6 +264,7 @@ function configure_postfix($options = '')
264264
$command = 'cd '.$config_dir.'; '
265265
.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
266266
}
267+
exec($command);
267268

268269
$command = 'chmod o= '.$config_dir.'/smtpd.key';
269270
caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
@@ -903,6 +904,31 @@ public function install_ispconfig()
903904
//* copy the ISPConfig server part
904905
$command = "cp -rf ../server $install_dir";
905906
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
907+
908+
//* Make a backup of the security settings
909+
if(is_file('/usr/local/ispconfig/security/security_settings.ini')) copy('/usr/local/ispconfig/security/security_settings.ini','/usr/local/ispconfig/security/security_settings.ini~');
910+
911+
//* copy the ISPConfig security part
912+
$command = 'cp -rf ../security '.$install_dir;
913+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
914+
915+
//* Apply changed security_settings.ini values to new security_settings.ini file
916+
if(is_file('/usr/local/ispconfig/security/security_settings.ini~')) {
917+
$security_settings_old = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini~'));
918+
$security_settings_new = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini'));
919+
if(is_array($security_settings_new) && is_array($security_settings_old)) {
920+
foreach($security_settings_new as $section => $sval) {
921+
if(is_array($sval)) {
922+
foreach($sval as $key => $val) {
923+
if(isset($security_settings_old[$section]) && isset($security_settings_old[$section][$key])) {
924+
$security_settings_new[$section][$key] = $security_settings_old[$section][$key];
925+
}
926+
}
927+
}
928+
}
929+
file_put_contents('/usr/local/ispconfig/security/security_settings.ini',array_to_ini($security_settings_new));
930+
}
931+
}
906932

907933
//* Create a symlink, so ISPConfig is accessible via web
908934
// Replaced by a separate vhost definition for port 8080
@@ -1028,12 +1054,38 @@ public function install_ispconfig()
10281054
$this->db->query($sql);
10291055
}
10301056

1031-
//* Chmod the files
1032-
$command = "chmod -R 750 $install_dir";
1057+
// chown install dir to root and chmod 755
1058+
$command = 'chown root:root '.$install_dir;
1059+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1060+
$command = 'chmod 755 '.$install_dir;
1061+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1062+
1063+
//* Chmod the files and directories in the install dir
1064+
$command = 'chmod -R 750 '.$install_dir.'/*';
10331065
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
10341066

1035-
//* chown the files to the ispconfig user and group
1036-
$command = "chown -R ispconfig:ispconfig $install_dir";
1067+
//* chown the interface files to the ispconfig user and group
1068+
$command = 'chown -R ispconfig:ispconfig '.$install_dir.'/interface';
1069+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1070+
1071+
//* chown the server files to the root user and group
1072+
$command = 'chown -R root:root '.$install_dir.'/server';
1073+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1074+
1075+
//* chown the security files to the root user and group
1076+
$command = 'chown -R root:root '.$install_dir.'/security';
1077+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1078+
1079+
//* chown the security directory and security_settings.ini to root:ispconfig
1080+
$command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini';
1081+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1082+
$command = 'chown root:ispconfig '.$install_dir.'/security';
1083+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1084+
$command = 'chown root:ispconfig '.$install_dir.'/security/ids.whitelist';
1085+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1086+
$command = 'chown root:ispconfig '.$install_dir.'/security/ids.htmlfield';
1087+
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
1088+
$command = 'chown root:ispconfig '.$install_dir.'/security/apache_directives.blacklist';
10371089
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
10381090

10391091
//* Make the global language file directory group writable

install/install.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,11 @@
679679

680680
} //* << $install_mode / 'Standard' or Genius
681681

682+
//* Create md5 filelist
683+
$md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5';
684+
exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename);
685+
chmod($md5_filename,0700);
686+
682687

683688
echo "Installation completed.\n";
684689

0 commit comments

Comments
 (0)