@@ -916,7 +916,7 @@ public function configure_jailkit() {
916916
917917 if (is_dir ($ config_dir )) {
918918 if (is_file ($ config_dir .'/ ' .$ jk_init )) copy ($ config_dir .'/ ' .$ jk_init , $ config_dir .'/ ' .$ jk_init .'~ ' );
919- if (is_file ($ config_dir .'/ ' .$ jk_chrootsh. ' .master ' )) copy ($ config_dir .'/ ' .$ jk_chrootsh. ' .master ' , $ config_dir .'/ ' .$ jk_chrootsh .'~ ' );
919+ if (is_file ($ config_dir .'/ ' .$ jk_chrootsh )) copy ($ config_dir .'/ ' .$ jk_chrootsh , $ config_dir .'/ ' .$ jk_chrootsh .'~ ' );
920920
921921 if (is_file ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/ ' .$ jk_init .'.master ' )) {
922922 copy ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/ ' .$ jk_init .'.master ' , $ config_dir .'/ ' .$ jk_init );
@@ -1353,7 +1353,7 @@ public function configure_postfix($options = '') {
13531353 $ change_maildrop_flags = @(preg_match ("/ $ quoted_regex/ " , $ configfile ))?false :true ;
13541354 }
13551355 if ($ change_maildrop_flags ) {
1356- //* Change maildrop service in posfix master.cf
1356+ //* Change maildrop service in postfix master.cf
13571357 if (is_file ($ config_dir .'/master.cf ' )) {
13581358 copy ($ config_dir .'/master.cf ' , $ config_dir .'/master.cf~ ' );
13591359 }
@@ -1362,8 +1362,8 @@ public function configure_postfix($options = '') {
13621362 }
13631363 $ configfile = $ config_dir .'/master.cf ' ;
13641364 $ content = rf ($ configfile );
1365- $ content = str_replace ( ' flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} ' ,
1366- 'flags=DRhu user= ' .$ cf ['vmail_username ' ].' argv=/usr/bin/maildrop -d ' .$ cf ['vmail_username ' ].' ${extension} ${recipient} ${user} ${nexthop} ${sender} ' ,
1365+ $ content = preg_replace ( ' / flags=(DRX?hu) user=vmail argv=\ /usr\ /bin\ /maildrop -d \ ${recipient}/ ' ,
1366+ 'flags=$1 user= ' .$ cf ['vmail_username ' ].' argv=/usr/bin/maildrop -d ' .$ cf ['vmail_username ' ].' \ ${extension} \ ${recipient} \ ${user} \ ${nexthop} \ ${sender} ' ,
13671367 $ content );
13681368 wf ($ configfile , $ content );
13691369 }
@@ -1539,7 +1539,7 @@ public function configure_dovecot() {
15391539 if (is_file ($ config_dir .'/master.cf ' )){
15401540 copy ($ config_dir .'/master.cf ' , $ config_dir .'/master.cf~2 ' );
15411541 }
1542- if (is_file ($ config_dir .'/master.cf~ ' )){
1542+ if (is_file ($ config_dir .'/master.cf~2 ' )){
15431543 chmod ($ config_dir .'/master.cf~2 ' , 0400 );
15441544 }
15451545 //* Configure master.cf and add a line for deliver
@@ -2049,7 +2049,7 @@ public function configure_rspamd() {
20492049 rename ("/etc/rspamd/local.d/greylist.conf " , "/etc/rspamd/local.d/greylist.old " );
20502050 }
20512051
2052- exec ('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/local.d/maps.d/* /etc/rspamd/override.d/* ' );
2052+ exec ('chmod a+r,-x+X /etc/rspamd/local.d/* /etc/rspamd/local.d/maps.d/* /etc/rspamd/override.d/* ' );
20532053 # protect passwords in these files
20542054 exec ('chgrp _rspamd /etc/rspamd/local.d/redis.conf /etc/rspamd/local.d/classifier-bayes.conf ' );
20552055 exec ('chmod 640 /etc/rspamd/local.d/redis.conf /etc/rspamd/local.d/classifier-bayes.conf ' );
@@ -2396,13 +2396,17 @@ public function configure_apache() {
23962396 replaceLine ('/etc/apache2/ports.conf ' , 'Listen 443 ' , 'Listen 443 ' , 1 );
23972397
23982398 // Comment out the namevirtualhost lines, as they were added by ispconfig in ispconfig.conf file again
2399- replaceLine ('/etc/apache2/ports.conf ' , 'NameVirtualHost *:80 ' , '# NameVirtualHost *:80 ' , 1 );
2400- replaceLine ('/etc/apache2/ports.conf ' , 'NameVirtualHost *:443 ' , '# NameVirtualHost *:443 ' , 1 );
2399+ replaceLine ('/etc/apache2/ports.conf ' , 'NameVirtualHost *:80 ' , '# NameVirtualHost *:80 ' , 1 , 0 );
2400+ replaceLine ('/etc/apache2/ports.conf ' , 'NameVirtualHost *:443 ' , '# NameVirtualHost *:443 ' , 1 , 0 );
24012401 }
24022402
24032403 if (is_file ('/etc/apache2/mods-available/fcgid.conf ' )) {
24042404 // add or modify the parameters for fcgid.conf
2405- replaceLine ('/etc/apache2/mods-available/fcgid.conf ' ,'MaxRequestLen ' ,'MaxRequestLen 15728640 ' ,1 );
2405+ if (hasLine ('/etc/apache2/mods-available/fcgid.conf ' ,'MaxRequestLen ' )) {
2406+ replaceLine ('/etc/apache2/mods-available/fcgid.conf ' ,'MaxRequestLen ' ,' MaxRequestLen 15728640 ' ,1 );
2407+ } else {
2408+ preg_replace ('/^(.*\n)(.*)$/sU ' , '$1 MaxRequestLen 15728640\n$2 ' , '/etc/apache2/mods-available/fcgid.conf ' );
2409+ }
24062410 }
24072411
24082412 if (is_file ('/etc/apache2/apache.conf ' )) {
@@ -2984,15 +2988,15 @@ public function make_ispconfig_ssl_cert() {
29842988 $ dnsa =dns_get_record ($ hostname , DNS_A );
29852989 if ($ dnsa ) {
29862990 foreach ($ dnsa as $ rec ) {
2987- $ dns_ips [] = $ rec ['ip ' ];
2991+ if ( is_array ( $ rec ) && isset ( $ rec [ ' ip ' ])) $ dns_ips [] = $ rec ['ip ' ];
29882992 }
29892993 }
29902994 }
29912995 if (checkdnsrr ($ hostname , 'AAAA ' )) {
29922996 $ dnsaaaa =dns_get_record ($ hostname , DNS_AAAA );
29932997 if ($ dnsaaaa ) {
29942998 foreach ($ dnsaaaa as $ rec ) {
2995- $ dns_ips [] = $ rec ['ip ' ];
2999+ if ( is_array ( $ rec ) && isset ( $ rec [ ' ip ' ])) $ dns_ips [] = $ rec ['ip ' ];
29963000 }
29973001 }
29983002 }
@@ -3047,6 +3051,8 @@ public function make_ispconfig_ssl_cert() {
30473051 $ crt_issuer = exec ("openssl x509 -in " .escapeshellarg ($ ssl_crt_file )." -inform PEM -noout -issuer " );
30483052 }
30493053
3054+ $ issued_successfully = false ;
3055+
30503056 if ((@file_exists ($ ssl_crt_file ) && ($ crt_subject == $ crt_issuer )) || (!@is_dir ($ acme_cert_dir ) || !@file_exists ($ check_acme_file ) || !@file_exists ($ ssl_crt_file ) || md5_file ($ check_acme_file ) != md5_file ($ ssl_crt_file )) && $ ip_address_match == true ) {
30513057
30523058 // This script is needed earlier to check and open http port 80 or standalone might fail
@@ -3145,8 +3151,6 @@ public function make_ispconfig_ssl_cert() {
31453151 }
31463152 }
31473153
3148- $ issued_successfully = false ;
3149-
31503154 // Backup existing ispserver ssl files
31513155 //
31523156 // We may find valid or broken symlinks or actual files here.
@@ -3923,7 +3927,7 @@ public function install_crontab() {
39233927 $ install_dir = $ conf ['ispconfig_install_dir ' ];
39243928
39253929 //* Root Crontab
3926- exec ('crontab -u root -l > crontab.txt ' );
3930+ exec ('crontab -u root -l > crontab.txt 2>/dev/null ' );
39273931 $ existing_root_cron_jobs = file ('crontab.txt ' );
39283932
39293933 // remove existing ispconfig cronjobs, in case the syntax has changed
@@ -3952,7 +3956,7 @@ public function install_crontab() {
39523956 //* Getmail crontab
39533957 if (is_user ('getmail ' )) {
39543958 $ cf = $ conf ['getmail ' ];
3955- exec ('crontab -u getmail -l > crontab.txt ' );
3959+ exec ('crontab -u getmail -l > crontab.txt 2>/dev/null ' );
39563960 $ existing_cron_jobs = file ('crontab.txt ' );
39573961
39583962 $ cron_jobs = array (
0 commit comments