@@ -366,6 +366,9 @@ function update($event_name,$data) {
366366 }
367367 }
368368 }
369+
370+ //* Remove protection of old folders
371+ $ app ->system ->web_folder_protection ($ data ['old ' ]['document_root ' ],false );
369372
370373 //* Move the site data
371374 $ tmp_docroot = explode ('/ ' ,$ data ['new ' ]['document_root ' ]);
@@ -414,7 +417,7 @@ function update($event_name,$data) {
414417 if (!is_dir ($ data ['new ' ]['document_root ' ].'/ssl ' )) exec ('mkdir -p ' .$ data ['new ' ]['document_root ' ].'/ssl ' );
415418 if (!is_dir ($ data ['new ' ]['document_root ' ].'/cgi-bin ' )) exec ('mkdir -p ' .$ data ['new ' ]['document_root ' ].'/cgi-bin ' );
416419 if (!is_dir ($ data ['new ' ]['document_root ' ].'/tmp ' )) exec ('mkdir -p ' .$ data ['new ' ]['document_root ' ].'/tmp ' );
417-
420+
418421 // Remove the symlink for the site, if site is renamed
419422 if ($ this ->action == 'update ' && $ data ['old ' ]['domain ' ] != '' && $ data ['new ' ]['domain ' ] != $ data ['old ' ]['domain ' ]) {
420423 if (is_dir ('/var/log/ispconfig/httpd/ ' .$ data ['old ' ]['domain ' ])) exec ('rm -rf /var/log/ispconfig/httpd/ ' .$ data ['old ' ]['domain ' ]);
@@ -593,10 +596,11 @@ function update($event_name,$data) {
593596 }
594597 }
595598
596-
597-
598599 //* If the security level is set to high
599600 if (($ this ->action == 'insert ' && $ data ['new ' ]['type ' ] == 'vhost ' ) or ($ web_config ['set_folder_permissions_on_update ' ] == 'y ' && $ data ['new ' ]['type ' ] == 'vhost ' )) {
601+
602+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ],false );
603+
600604 if ($ web_config ['security_level ' ] == 20 ) {
601605
602606 $ this ->_exec ('chmod 751 ' .escapeshellcmd ($ data ['new ' ]['document_root ' ]));
@@ -673,6 +677,9 @@ function update($event_name,$data) {
673677 $ this ->_exec ('chown ' .$ username .': ' .$ groupname .' ' .escapeshellcmd ($ data ['new ' ]['document_root ' ].'/web ' ));
674678 }
675679 }
680+
681+ //* Protect web folders
682+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ],true );
676683
677684 // Change the ownership of the error log to the owner of the website
678685 if (!@is_file ($ data ['new ' ]['document_root ' ].'/log/error.log ' )) exec ('touch ' .escapeshellcmd ($ data ['new ' ]['document_root ' ]).'/log/error.log ' );
@@ -1217,7 +1224,9 @@ function update($event_name,$data) {
12171224 if (!is_file ($ data ['new ' ]['document_root ' ].'/.htpasswd_stats ' ) || $ data ['new ' ]['stats_password ' ] != $ data ['old ' ]['stats_password ' ]) {
12181225 if (trim ($ data ['new ' ]['stats_password ' ]) != '' ) {
12191226 $ htp_file = 'admin: ' .trim ($ data ['new ' ]['stats_password ' ]);
1227+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ],false );
12201228 file_put_contents ($ data ['new ' ]['document_root ' ].'/.htpasswd_stats ' ,$ htp_file );
1229+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ],true );
12211230 chmod ($ data ['new ' ]['document_root ' ].'/.htpasswd_stats ' ,0755 );
12221231 unset($ htp_file );
12231232 }
@@ -1280,6 +1289,8 @@ function delete($event_name,$data) {
12801289 // load the server configuration options
12811290 $ app ->uses ('getconf ' );
12821291 $ web_config = $ app ->getconf ->get_server_config ($ conf ['server_id ' ], 'web ' );
1292+
1293+ $ app ->system ->web_folder_protection ($ data ['new ' ]['document_root ' ],false );
12831294
12841295 //* Check if this is a chrooted setup
12851296 if ($ web_config ['website_basedir ' ] != '' && @is_file ($ web_config ['website_basedir ' ].'/etc/passwd ' )) {
0 commit comments