Merge branch 'master' into feature/800

Conflicts:
	web/edit/web/index.php
This commit is contained in:
Derrick Hammer 2016-10-08 11:22:23 -04:00
commit 09e1238d54
542 changed files with 5342 additions and 709 deletions

View file

@ -78,6 +78,21 @@ foreach ($backup_types as $backup_type) {
}
}
// List ssl certificate info
exec (VESTA_CMD."v-list-sys-vesta-ssl json", $output, $return_var);
$ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_ssl_crt = $ssl_str['VESTA']['CRT'];
$v_ssl_key = $ssl_str['VESTA']['KEY'];
$v_ssl_ca = $ssl_str['VESTA']['CA'];
$v_ssl_subject = $ssl_str['VESTA']['SUBJECT'];
$v_ssl_aliases = $ssl_str['VESTA']['ALIASES'];
$v_ssl_not_before = $ssl_str['VESTA']['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str['VESTA']['NOT_AFTER'];
$v_ssl_signature = $ssl_str['VESTA']['SIGNATURE'];
$v_ssl_pub_key = $ssl_str['VESTA']['PUB_KEY'];
$v_ssl_issuer = $ssl_str['VESTA']['ISSUER'];
// Check POST request
if (!empty($_POST['save'])) {
@ -178,7 +193,6 @@ if (!empty($_POST['save'])) {
}
}
// Update webmail url
if (empty($_SESSION['error_msg'])) {
if ($_POST['v_mail_url'] != $_SESSION['MAIL_URL']) {
@ -231,7 +245,6 @@ if (!empty($_POST['save'])) {
}
}
// Change backup gzip level
if (empty($_SESSION['error_msg'])) {
if ($_POST['v_backup_gzip'] != $v_backup_gzip ) {
@ -323,7 +336,6 @@ if (!empty($_POST['save'])) {
}
}
// Delete remote backup host
if (empty($_SESSION['error_msg'])) {
if ((empty($_POST['v_backup_host'])) && (!empty($v_backup_host))) {
@ -340,6 +352,49 @@ if (!empty($_POST['save'])) {
}
}
// Update SSL certificate
if ((!empty($_POST['v_ssl_crt'])) && (empty($_SESSION['error_msg']))) {
if (($v_ssl_crt != str_replace("\r\n", "\n", $_POST['v_ssl_crt'])) || ($v_ssl_key != str_replace("\r\n", "\n", $_POST['v_ssl_key']))) {
exec ('mktemp -d', $mktemp_output, $return_var);
$tmpdir = $mktemp_output[0];
// Certificate
if (!empty($_POST['v_ssl_crt'])) {
$fp = fopen($tmpdir."/certificate.crt", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_crt']));
fwrite($fp, "\n");
fclose($fp);
}
// Key
if (!empty($_POST['v_ssl_key'])) {
$fp = fopen($tmpdir."/certificate.key", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_key']));
fwrite($fp, "\n");
fclose($fp);
}
exec (VESTA_CMD."v-change-sys-vesta-ssl ".$tmpdir, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
// List ssl certificate info
exec (VESTA_CMD."v-list-sys-vesta-ssl json", $output, $return_var);
$ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_ssl_crt = $ssl_str['VESTA']['CRT'];
$v_ssl_key = $ssl_str['VESTA']['KEY'];
$v_ssl_ca = $ssl_str['VESTA']['CA'];
$v_ssl_subject = $ssl_str['VESTA']['SUBJECT'];
$v_ssl_aliases = $ssl_str['VESTA']['ALIASES'];
$v_ssl_not_before = $ssl_str['VESTA']['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str['VESTA']['NOT_AFTER'];
$v_ssl_signature = $ssl_str['VESTA']['SIGNATURE'];
$v_ssl_pub_key = $ssl_str['VESTA']['PUB_KEY'];
$v_ssl_issuer = $ssl_str['VESTA']['ISSUER'];
}
}
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Changes has been saved.');
@ -375,7 +430,6 @@ if (!empty($_POST['save'])) {
}
}
// activating filemanager licence
if (empty($_SESSION['error_msg'])) {
if($_SESSION['FILEMANAGER_KEY'] != $_POST['v_filemanager_licence'] && $_POST['v_filemanager'] == 'yes'){
@ -410,11 +464,14 @@ if (!empty($_POST['save'])) {
// Check system configuration
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
$data = json_decode(implode('', $output), true);
unset($output);
$sys_arr = $data['config'];
foreach ($sys_arr as $key => $value) {
$_SESSION[$key] = $value;
}
// Render page
render_page($user, $TAB, 'edit_server');

View file

@ -43,6 +43,13 @@ if ( $v_ssl == 'yes' && ($v_letsencrypt == 'no' || empty($v_letsencrypt))) {
$v_ssl_crt = $ssl_str[$v_domain]['CRT'];
$v_ssl_key = $ssl_str[$v_domain]['KEY'];
$v_ssl_ca = $ssl_str[$v_domain]['CA'];
$v_ssl_subject = $ssl_str[$v_domain]['SUBJECT'];
$v_ssl_aliases = $ssl_str[$v_domain]['ALIASES'];
$v_ssl_not_before = $ssl_str[$v_domain]['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str[$v_domain]['NOT_AFTER'];
$v_ssl_signature = $ssl_str[$v_domain]['SIGNATURE'];
$v_ssl_pub_key = $ssl_str[$v_domain]['PUB_KEY'];
$v_ssl_issuer = $ssl_str[$v_domain]['ISSUER'];
}
$v_ssl_home = $data[$v_domain]['SSL_HOME'];
$v_backend_template = $data[$v_domain]['BACKEND'];
@ -321,14 +328,25 @@ if (!empty($_POST['save'])) {
fclose($fp);
}
exec (VESTA_CMD."v-change-web-domain-sslcert ".$user." ".$v_domain." ".$tmpdir." 'no'", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_web = 'yes';
$restart_proxy = 'yes';
$v_ssl_crt = $_POST['v_ssl_crt'];
$v_ssl_key = $_POST['v_ssl_key'];
$v_ssl_ca = $_POST['v_ssl_ca'];
exec (VESTA_CMD."v-change-web-domain-sslcert ".$user." ".$v_domain." ".$tmpdir." 'no'", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_web = 'yes';
$restart_proxy = 'yes';
exec (VESTA_CMD."v-list-web-domain-ssl ".$user." '".$v_domain."' json", $output, $return_var);
$ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_ssl_crt = $ssl_str[$v_domain]['CRT'];
$v_ssl_key = $ssl_str[$v_domain]['KEY'];
$v_ssl_ca = $ssl_str[$v_domain]['CA'];
$v_ssl_subject = $ssl_str[$v_domain]['SUBJECT'];
$v_ssl_aliases = $ssl_str[$v_domain]['ALIASES'];
$v_ssl_not_before = $ssl_str[$v_domain]['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str[$v_domain]['NOT_AFTER'];
$v_ssl_signature = $ssl_str[$v_domain]['SIGNATURE'];
$v_ssl_pub_key = $ssl_str[$v_domain]['PUB_KEY'];
$v_ssl_issuer = $ssl_str[$v_domain]['ISSUER'];
// Cleanup certificate tempfiles
if (!empty($_POST['v_ssl_crt'])) {
@ -380,22 +398,32 @@ if (!empty($_POST['save'])) {
fclose($fp);
}
// CA
if (!empty($_POST['v_ssl_ca'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca']));
fclose($fp);
}
exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_ssl = 'yes';
$restart_web = 'yes';
$restart_proxy = 'yes';
$v_ssl_crt = $_POST['v_ssl_crt'];
$v_ssl_key = $_POST['v_ssl_key'];
$v_ssl_ca = $_POST['v_ssl_ca'];
$v_ssl_home = $_POST['v_ssl_home'];
// CA
if (!empty($_POST['v_ssl_ca'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca']));
fclose($fp);
}
exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_ssl = 'yes';
$restart_web = 'yes';
$restart_proxy = 'yes';
exec (VESTA_CMD."v-list-web-domain-ssl ".$user." '".$v_domain."' json", $output, $return_var);
$ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_ssl_crt = $ssl_str[$v_domain]['CRT'];
$v_ssl_key = $ssl_str[$v_domain]['KEY'];
$v_ssl_ca = $ssl_str[$v_domain]['CA'];
$v_ssl_subject = $ssl_str[$v_domain]['SUBJECT'];
$v_ssl_aliases = $ssl_str[$v_domain]['ALIASES'];
$v_ssl_not_before = $ssl_str[$v_domain]['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str[$v_domain]['NOT_AFTER'];
$v_ssl_signature = $ssl_str[$v_domain]['SIGNATURE'];
$v_ssl_pub_key = $ssl_str[$v_domain]['PUB_KEY'];
$v_ssl_issuer = $ssl_str[$v_domain]['ISSUER'];
// Cleanup certificate tempfiles
if (!empty($_POST['v_ssl_crt'])) {
@ -606,10 +634,10 @@ if (!empty($_POST['save'])) {
// Change FTP account path
$v_ftp_username = $user . '_' . $v_ftp_user_data['v_ftp_user']; //preg_replace("/^".$user."_/", "", $v_ftp_user_data['v_ftp_user']);
$v_ftp_username = escapeshellarg($v_ftp_username);
//if (!empty($v_ftp_user_data['v_ftp_path'])) {
$v_ftp_path = escapeshellarg(trim($v_ftp_user_data['v_ftp_path']));
exec (VESTA_CMD."v-change-web-domain-ftp-path ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_path, $output, $return_var);
//}
if(escapeshellarg(trim($v_ftp_user_data['v_ftp_path_prev'])) != $v_ftp_path) {
exec (VESTA_CMD."v-change-web-domain-ftp-path ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_path, $output, $return_var);
}
// Change FTP account password
if (!empty($v_ftp_user_data['v_ftp_password'])) {