improved server configuration page

This commit is contained in:
Serghey Rodin 2015-11-03 01:07:41 +02:00
commit 868092219f
2 changed files with 57 additions and 51 deletions

View file

@ -157,6 +157,25 @@ if (!empty($_POST['save'])) {
}
}
// Set firewall support
if (empty($_SESSION['error_msg'])) {
if ($_SESSION['FIREWALL_SYSTEM'] == 'iptables') $v_firewall = 'yes';
if ($_SESSION['FIREWALL_SYSTEM'] != 'iptables') $v_firewall = 'no';
if ((!empty($_POST['v_firewall'])) && ($v_firewall != $_POST['v_firewall'])) {
if($_POST['v_firewall'] == 'yes') {
exec (VESTA_CMD."v-add-sys-firewall", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = 'iptables';
} else {
exec (VESTA_CMD."v-delete-sys-firewall", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = '';
}
}
}
// Update mysql pasword
if (empty($_SESSION['error_msg'])) {
if (!empty($_POST['v_mysql_password'])) {
@ -336,7 +355,7 @@ if (!empty($_POST['save'])) {
// activating sftp licence
if (empty($_SESSION['error_msg'])) {
if($_SESSION['SFTP_KEY'] != $_POST['v_sftp_licence'] && $_POST['v_sftp'] == 'yes'){
if($_SESSION['SFTPJAIL_KEY'] != $_POST['v_sftp_licence'] && $_POST['v_sftp'] == 'yes'){
$module = 'sftpjail';
$licence_key = escapeshellarg($_POST['v_sftp_licence']);
exec (VESTA_CMD."v-activate-vesta-license ".$module." ".$licence_key, $output, $return_var);
@ -344,22 +363,22 @@ if (!empty($_POST['save'])) {
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Licence Activated');
$_SESSION['SFTP_KEY'] = $_POST['v_sftp_licence'];
$_SESSION['SFTPJAIL_KEY'] = $_POST['v_sftp_licence'];
}
}
}
// cancel sftp licence
if (empty($_SESSION['error_msg'])) {
if($_POST['v_sftp'] == 'cancel' && $_SESSION['SFTP_KEY']){
if($_POST['v_sftp'] == 'cancel' && $_SESSION['SFTPJAIL_KEY']){
$module = 'sftpjail';
$licence_key = escapeshellarg($_SESSION['SFTP_KEY']);
$licence_key = escapeshellarg($_SESSION['SFTPJAIL_KEY']);
exec (VESTA_CMD."v-deactivate-vesta-license ".$module." ".$licence_key, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Licence Deactivated');
unset($_SESSION['SFTP_KEY']);
unset($_SESSION['SFTPJAIL_KEY']);
}
}
}

View file

@ -111,21 +111,6 @@
<br><br>
</td>
</tr>
<tr>
<td class="vst-text input-label">
<?php print __('FileSystem Disk Quota');?>
</td>
</tr>
<tr>
<td>
<select class="vst-list" name="v_quota">
<option value='no'><?php print __('no'); ?></option>
<option value='yes' <?php if($_SESSION['DISK_QUOTA'] == 'yes') echo 'selected' ?> ><?php print __('yes'); ?></option>
</select>
<br><br>
</td>
</tr>
<tr>
<td class="vst-text input-label step-top">
<a href="javascript:elementHideShow('web');" class="vst-text">
@ -623,6 +608,34 @@
<br><br>
</td>
</tr>
<tr>
<td class="vst-text input-label">
<?php print __('FileSystem Disk Quota');?>
</td>
</tr>
<tr>
<td>
<select class="vst-list" name="v_quota">
<option value='no'><?php print __('no'); ?></option>
<option value='yes' <?php if($_SESSION['DISK_QUOTA'] == 'yes') echo 'selected' ?> ><?php print __('yes'); ?></option>
</select>
<br><br>
</td>
</tr>
<tr>
<td class="vst-text input-label">
<?php print __('Firewall');?>
</td>
</tr>
<tr>
<td>
<select class="vst-list" name="v_firewall">
<option value='no'><?php print __('no'); ?></option>
<option value='yes' <?php if($_SESSION['FIREWALL_SYSTEM'] == 'iptables') echo 'selected' ?> ><?php print __('yes'); ?></option>
</select>
<br><br>
</td>
</tr>
<tr>
<td class="vst-text">
<?php print __('Reseller Role') ?>
@ -636,32 +649,6 @@
<br><br>
</td>
</tr>
<tr>
<td class="vst-text">
<?php print __('Web Config Editor') ?>
</td>
</tr>
<tr>
<td>
<select class="vst-list" name="v_conf_editor" disabled="disabled">
<option value='no'><?php print __('no'); ?></option>
</select>
<br><br>
</td>
</tr>
<tr>
<td class="vst-text">
<?php print __('Template Manager') ?>
</td>
</tr>
<tr>
<td>
<select class="vst-list" name="v_template_manager" disabled="disabled">
<option value='no'><?php print __('no'); ?></option>
</select>
<br><br>
</td>
</tr>
<tr>
<td class="vst-text">
<?php print __('Backup Migration Manager') ?>
@ -684,21 +671,21 @@
<td>
<select class="vst-list" name="v_sftp">
<?
if($_SESSION['SFTP_KEY']){
if($_SESSION['SFTPJAIL_KEY']){
echo '<option value="cancel">'.__('Disable and Cancel Licence').'</option>';
} else {
echo '<option value="no">'.__('no').'</option>';
}
?>
<option value='yes' <? if($_GET['lead'] == 'sftp' || $_SESSION['SFTP_KEY'] != '') echo 'selected="selected"'; ?>><?php print __('yes'); ?></option>
<option value='yes' <? if($_GET['lead'] == 'sftp' || $_SESSION['SFTPJAIL_KEY'] != '') echo 'selected="selected"'; ?>><?php print __('yes'); ?></option>
</select>
<br><br>
<div class="sftp description" <? if($_GET['lead'] != 'sftp' && !$_SESSION['SFTP_KEY']) echo 'style="display:none"'; ?>>
<div class="sftp description" <? if($_GET['lead'] != 'sftp' && !$_SESSION['SFTPJAIL_KEY']) echo 'style="display:none"'; ?>>
<?
if($_GET['sftp_licence_key'] != '' || $_SESSION['SFTP_KEY']){
$licence_key = $_GET['sftp_licence_key'] != '' ? $_GET['sftp_licence_key'] : $_SESSION['SFTP_KEY'];
if($_GET['sftp_licence_key'] != '' || $_SESSION['SFTPJAIL_KEY']){
$licence_key = $_GET['sftp_licence_key'] != '' ? $_GET['sftp_licence_key'] : $_SESSION['SFTPJAIL_KEY'];
echo 'Restrict users so that they cannot use SSH and access only their home directory.
<div class="licence">
Licence Key: <input type="text" class="vst-input" name="v_sftp_licence" value="'.$licence_key.'" /><br>