From b5b6083d345d221c1c1faff5a24f57ef56a0e276 Mon Sep 17 00:00:00 2001 From: Florian Schaal <florian@schaal-24.de> Date: Tue, 26 Apr 2016 01:13:27 -0400 Subject: [PATCH] Fixes: #3846 --- server/plugins-available/nginx_plugin.inc.php | 42 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 38 insertions(+), 4 deletions(-) diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 23bca9b..2a49504 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -219,6 +219,22 @@ $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); } + //* Check that the SSL key is not password protected + if($data["new"]["ssl_action"] == 'save') { + if(stristr($data["new"]["ssl_key"],'Proc-Type: 4,ENCRYPTED')) { + $data["new"]["ssl_action"] = ''; + + $app->log('SSL Certificate not saved. The SSL key is encrypted.', LOGLEVEL_WARN); + $app->dbmaster->datalogError('SSL Certificate not saved. The SSL key is encrypted.'); + + /* Update the DB of the (local) Server */ + $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + + /* Update also the master-DB of the Server-Farm */ + $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = ?", $data['new']['domain']); + } + } + //* Save a SSL certificate to disk if($data["new"]["ssl_action"] == 'save') { $this->ssl_certificate_changed = true; @@ -715,15 +731,33 @@ } // end copy error docs // Set the quota for the user, but only for vhosts, not vhostsubdomains or vhostalias - if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') { + if($username != '' && $app->system->is_user($username) && $data['new']['type'] == 'vhost') { if($data['new']['hd_quota'] > 0) { $blocks_soft = $data['new']['hd_quota'] * 1024; $blocks_hard = $blocks_soft + 1024; + $mb_hard = $mb_soft + 1; } else { - $blocks_soft = $blocks_hard = 0; + $mb_soft = $mb_hard = $blocks_soft = $blocks_hard = 0; } - exec("setquota -u $username $blocks_soft $blocks_hard 0 0 -a &> /dev/null"); - exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null'); + + // get the primitive folder for document_root and the filesystem, will need it later. + $df_output=exec("df -T $document_root|awk 'END{print \$2,\$NF}'"); + $file_system = explode(" ", $df_output)[0]; + $primitive_root = explode(" ", $df_output)[1]; + + if ( in_array($file_system , array('ext2','ext3','ext4'), true) ) { + exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null'); + exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null'); + } elseif ($file_system == 'xfs') { + + exec("xfs_quota -x -c 'limit -g bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " $username' $primitive_root"); + + // xfs only supports timers globally, not per user. + exec("xfs_quota -x -c 'timer -bir -i 604800'"); + + unset($project_uid, $username_position, $xfs_projects); + unset($primitive_root, $df_output, $mb_hard, $mb_soft); + } } if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) { -- Gitblit v1.9.1