From b89f602f7b17709b472d92b566d708f860c95d20 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Thu, 25 Aug 2016 19:29:36 +0300 Subject: [PATCH] Service config feature --- bin/v-change-sys-config-value | 2 + bin/v-change-sys-service-config | 119 +++++++++++ bin/v-list-sys-clamd-config | 73 +++++++ bin/v-list-sys-dovecot-config | 103 +++++++++ bin/v-list-sys-mysql-config | 82 +++++++ bin/v-list-sys-nginx-config | 88 ++++++++ bin/v-list-sys-pgsql-config | 70 ++++++ bin/v-list-sys-php-config | 94 ++++++++ bin/v-list-sys-proftpd-config | 64 ++++++ bin/v-list-sys-spamd-config | 64 ++++++ bin/v-list-sys-vsftpd-config | 64 ++++++ bin/v-open-fs-config | 47 ++++ web/edit/server/apache2/index.php | 58 +++++ web/edit/server/bind9/index.php | 73 +++++++ web/edit/server/clamd/index.php | 58 +++++ web/edit/server/cron/index.php | 58 +++++ web/edit/server/crond/index.php | 58 +++++ web/edit/server/dovecot/index.php | 183 ++++++++++++++++ web/edit/server/exim/index.php | 58 +++++ web/edit/server/exim4/index.php | 58 +++++ web/edit/server/fail2ban/index.php | 58 +++++ web/edit/server/httpd/index.php | 58 +++++ web/edit/server/iptables/index.php | 10 + web/edit/server/mariadb/index.php | 67 ++++++ web/edit/server/mysql/index.php | 67 ++++++ web/edit/server/mysqld/index.php | 67 ++++++ web/edit/server/named/index.php | 58 +++++ web/edit/server/php-fpm/index.php | 68 ++++++ web/edit/server/php5-fpm/index.php | 68 ++++++ web/edit/server/postgresql/index.php | 78 +++++++ web/edit/server/proftpd/index.php | 58 +++++ web/edit/server/spamassassin/index.php | 58 +++++ web/edit/server/spamd/index.php | 58 +++++ web/edit/server/vsftpd/index.php | 58 +++++ web/favicon.ico | Bin 0 -> 4286 bytes web/js/pages/edit_server_mysql.js | 41 ++++ web/js/pages/edit_server_nginx.js | 41 ++++ web/js/pages/edit_server_php.js | 41 ++++ web/templates/admin/edit_server_bind9.html | 92 ++++++++ web/templates/admin/edit_server_dovecot.html | 171 +++++++++++++++ web/templates/admin/edit_server_httpd.html | 86 ++++++++ web/templates/admin/edit_server_mysql.html | 155 ++++++++++++++ web/templates/admin/edit_server_nginx.html | 213 +++++++++++++++++++ web/templates/admin/edit_server_pgsql.html | 92 ++++++++ web/templates/admin/edit_server_php.html | 175 +++++++++++++++ web/templates/admin/edit_server_service.html | 84 ++++++++ web/templates/admin/list_services.html | 5 +- 47 files changed, 3499 insertions(+), 2 deletions(-) create mode 100755 bin/v-change-sys-service-config create mode 100755 bin/v-list-sys-clamd-config create mode 100755 bin/v-list-sys-dovecot-config create mode 100755 bin/v-list-sys-mysql-config create mode 100755 bin/v-list-sys-nginx-config create mode 100755 bin/v-list-sys-pgsql-config create mode 100755 bin/v-list-sys-php-config create mode 100755 bin/v-list-sys-proftpd-config create mode 100755 bin/v-list-sys-spamd-config create mode 100755 bin/v-list-sys-vsftpd-config create mode 100755 bin/v-open-fs-config create mode 100644 web/edit/server/apache2/index.php create mode 100644 web/edit/server/bind9/index.php create mode 100644 web/edit/server/clamd/index.php create mode 100644 web/edit/server/cron/index.php create mode 100644 web/edit/server/crond/index.php create mode 100644 web/edit/server/dovecot/index.php create mode 100644 web/edit/server/exim/index.php create mode 100644 web/edit/server/exim4/index.php create mode 100644 web/edit/server/fail2ban/index.php create mode 100644 web/edit/server/httpd/index.php create mode 100644 web/edit/server/iptables/index.php create mode 100644 web/edit/server/mariadb/index.php create mode 100644 web/edit/server/mysql/index.php create mode 100644 web/edit/server/mysqld/index.php create mode 100644 web/edit/server/named/index.php create mode 100644 web/edit/server/php-fpm/index.php create mode 100644 web/edit/server/php5-fpm/index.php create mode 100644 web/edit/server/postgresql/index.php create mode 100644 web/edit/server/proftpd/index.php create mode 100644 web/edit/server/spamassassin/index.php create mode 100644 web/edit/server/spamd/index.php create mode 100644 web/edit/server/vsftpd/index.php create mode 100644 web/favicon.ico create mode 100644 web/js/pages/edit_server_mysql.js create mode 100644 web/js/pages/edit_server_nginx.js create mode 100644 web/js/pages/edit_server_php.js create mode 100644 web/templates/admin/edit_server_bind9.html create mode 100644 web/templates/admin/edit_server_dovecot.html create mode 100644 web/templates/admin/edit_server_httpd.html create mode 100644 web/templates/admin/edit_server_mysql.html create mode 100644 web/templates/admin/edit_server_nginx.html create mode 100644 web/templates/admin/edit_server_pgsql.html create mode 100644 web/templates/admin/edit_server_php.html create mode 100644 web/templates/admin/edit_server_service.html diff --git a/bin/v-change-sys-config-value b/bin/v-change-sys-config-value index 31b626342..106576563 100755 --- a/bin/v-change-sys-config-value +++ b/bin/v-change-sys-config-value @@ -18,6 +18,8 @@ value=$2 source $VESTA/func/main.sh source $VESTA/conf/vesta.conf +PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin" + #----------------------------------------------------------# # Verifications # diff --git a/bin/v-change-sys-service-config b/bin/v-change-sys-service-config new file mode 100755 index 000000000..77b45d885 --- /dev/null +++ b/bin/v-change-sys-service-config @@ -0,0 +1,119 @@ +#!/bin/bash +# info: change service config +# options: CONFIG SERVICE [RESTART] +# +# The function for changing service confguration. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +src=$1 +service=$2 +restart=$3 +echo "$0 $*" >/tmp/t.log + +# Includes +source $VESTA/func/main.sh +source $VESTA/conf/vesta.conf + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +check_args '2' "$#" 'CONFIG SERVICE [RESTART]' +if [ ! -e "$src" ]; then + check_result "$E_NOTEXIST" "$src config doesn't exist" +fi + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining dst config path +case $service in + nginx) dst='/etc/nginx/nginx.conf';; + httpd) dst='/etc/httpd/conf/httpd.conf';; + apache2) dst='/etc/apache2/apache2.conf';; + exim) dst='/etc/exim/exim.conf';; + exim4) dst='/etc/exim4/exim4.conf.template';; + vsftpd) dst=$(find /etc/vsftpd* -name 'vsftpd.conf');; + proftpd) dst=$(find /etc/proftpd* -name 'proftpd.conf');; + php) dst=$(find /etc/php* -name php.ini);; + mysql) dst=$(find /etc/my* -name my.cnf);; + mariadb) dst=$(find /etc/my* -name my.cnf);; + postgresql) dst=$($BIN/v-list-sys-pgsql-config plain |cut -f 1);; + postgresql-hba) dst=$($BIN/v-list-sys-pgsql-config plain |cut -f 2);; + dovecot) dst=$(find /etc/dovecot* -name dovecot.conf);; + dovecot-1) dst='/etc/dovecot/conf.d/10-auth.conf';; + dovecot-2) dst='/etc/dovecot/conf.d/10-logging.conf';; + dovecot-3) dst='/etc/dovecot/conf.d/10-mail.conf';; + dovecot-4) dst='/etc/dovecot/conf.d/10-master.conf';; + dovecot-5) dst='/etc/dovecot/conf.d/10-ssl.conf';; + dovecot-6) dst='/etc/dovecot/conf.d/20-imap.conf';; + dovecot-7) dst='/etc/dovecot/conf.d/20-pop3.conf';; + dovecot-8) dst='/etc/dovecot/conf.d/auth-passwdfile.conf.ext';; + named) dst='/etc/named.conf';; + bind9) dst='/etc/bind/named.conf';; + bind9-opt) dst='/etc/bind/named.conf.options';; + spamd) dst=$($BIN/v-list-sys-spamd-config plain);; + spamassassin) dst=$($BIN/v-list-sys-spamd-config plain);; + clamd) dst=$($BIN/v-list-sys-clamd-config plain);; + cron) dst='/etc/crontab';; + crond) dst='/etc/crontab';; + fail2ban) dst='/etc/fail2ban/jail.local';; + *) check_result $E_NOTEXIST "service $service doesn't exist" +esac + +# Checking config path +for config in $dst; do + if [ ! -e "$config" ]; then + check_result $E_NOTEXIST "$service config doesn't exist" + fi +done + +# Checking diff between src and dst configs +for config in $dst; do + diff -q $src $config >/dev/null + + if [ $? -ne 0 ]; then + cp $config $config.vst.back + cp $src $config + update="yes" + fi +done + +# Restarting service +if [ "$update" = 'yes' ] && [ "$restart" != 'no' ]; then + if [ "$service" = 'php' ]; then + if [ "$WEB_SYSTEM" = "nginx" ]; then + service=$WEB_BACKEND + else + service=$WEB_SYSTEM + fi + fi + if [[ "$service" =~ - ]]; then + service=$(echo ${service%-*}) + fi + + service $service restart >/dev/null 2>&1 + if [ $? -ne 0 ]; then + for config in $dst; do + mv -f $config.vst.back $config + done + check_result $E_RESTART "$service failed to start with new config" + fi +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event "$OK" "$ARGUMENTS" + +exit diff --git a/bin/v-list-sys-clamd-config b/bin/v-list-sys-clamd-config new file mode 100755 index 000000000..1bb614b96 --- /dev/null +++ b/bin/v-list-sys-clamd-config @@ -0,0 +1,73 @@ +#!/bin/bash +# info: list clamd config parameters +# options: [FORMAT] +# +# The function for obtaining the list of clamd config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh + +# JSON list function +json_list() { + echo '{ + "CONFIG": { + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "config_path: $config_path" +} + +# PLAIN list function +plain_list() { + echo "$config_path" +} + +# CSV list function +csv_list() { + echo "config_path" + echo "$config_path" +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +if [ -e '/etc/clamav/clamd.conf' ]; then + config_path='/etc/clamav/clamd.conf' +else + if [ -e '/etc/clamd.conf' ]; then + config_path='/etc/clamd.conf' + fi + if [ -e '/etc/clamd.d/clamd.conf' ]; then + config_path='/etc/clamav/clamd.conf' + fi +fi + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-dovecot-config b/bin/v-list-sys-dovecot-config new file mode 100755 index 000000000..873755866 --- /dev/null +++ b/bin/v-list-sys-dovecot-config @@ -0,0 +1,103 @@ +#!/bin/bash +# info: list dovecot config parameters +# options: [FORMAT] +# +# The function for obtaining the list of dovecot config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh + +# JSON list function +json_list() { + echo '{ + "CONFIG": { + "config_path": "'$config_path'", + "config_path1": "'$config_path1'", + "config_path2": "'$config_path2'", + "config_path3": "'$config_path3'", + "config_path4": "'$config_path4'", + "config_path5": "'$config_path5'", + "config_path6": "'$config_path6'", + "config_path7": "'$config_path7'", + "config_path8": "'$config_path8'" + } +}' +} + +# SHELL list function +shell_list() { + echo "config_path: $config_path" + echo "config_path1: $config_path1" + echo "config_path2: $config_path2" + echo "config_path3: $config_path3" + echo "config_path4: $config_path4" + echo "config_path5: $config_path5" + echo "config_path6: $config_path6" + echo "config_path7: $config_path7" + echo "config_path8: $config_path8" +} + +# PLAIN list function +plain_list() { + echo -en "$config_path\t" + echo -en "$config_path1\t" + echo -en "$config_path2\t" + echo -en "$config_path3\t" + echo -en "$config_path4\t" + echo -en "$config_path5\t" + echo -en "$config_path6\t" + echo -en "$config_path7\t" + echo -e "$config_path8\t" +} + +# CSV list function +csv_list() { + echo -n "config_path,config_path1,config_path2,config_path3," + echo "config_path4,config_path5,config_path6,config_path7,config_path8" + echo -n "$config_path,$config_path1,$config_path2,$config_path3," + echo -n "$config_path4,$config_path5,$config_path6,$config_path7," + echo "$config_path8" +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +if [ -e '/etc/dovecot.conf' ]; then + config_path='/etc/dovecot.conf' +else + config_path='/etc/dovecot/dovecot.conf' + config_path1='/etc/dovecot/conf.d/10-auth.conf' + config_path2='/etc/dovecot/conf.d/10-logging.conf' + config_path3='/etc/dovecot/conf.d/10-mail.conf' + config_path4='/etc/dovecot/conf.d/10-master.conf' + config_path5='/etc/dovecot/conf.d/10-ssl.conf' + config_path6='/etc/dovecot/conf.d/20-imap.conf' + config_path7='/etc/dovecot/conf.d/20-pop3.conf' + config_path8='/etc/dovecot/conf.d/auth-passwdfile.conf.ext' +fi + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-mysql-config b/bin/v-list-sys-mysql-config new file mode 100755 index 000000000..bf297aab0 --- /dev/null +++ b/bin/v-list-sys-mysql-config @@ -0,0 +1,82 @@ +#!/bin/bash +# info: list mysql config parameters +# options: [FORMAT] +# +# The function for obtaining the list of mysql config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh +source $VESTA/conf/vesta.conf + +# JSON list function +json_list() { + eval $(echo "$config"|egrep "$keys"|\ + sed -e "s/[ ]*=/=/" -e "s/=[ ]*/=\'/" -e "s/$/'/") + echo '{ + "CONFIG": { + "max_user_connections": "'$max_user_connections'", + "max_connections": "'$max_connections'", + "wait_timeout": "'$wait_timeout'", + "interactive_timeout": "'$interactive_timeout'", + "max_allowed_packet": "'$max_allowed_packet'", + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "$config" |egrep "$keys" |tr '=' ' ' + echo "config_path $config_path" +} + +# PLAIN list function +plain_list() { + echo "$config" |egrep "$keys" |tr '=' ' ' + echo "config_path $config_path" +} + +# CSV list function +csv_list() { + echo "$keys" |sed "s/|/,/g" + echo "$config" |egrep "$keys" |tr '=' ' ' |awk '{print $2}' |tr '\n' ',' + echo +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +config_path=$(find /etc/my* -name my.cnf) + +# Defining keys +keys="max_user_connections|max_connections|wait_timeout|interactive_timeout" +keys="${keys}|max_allowed_packet" + +# Reading config +config=$(cat $config_path|grep -v "^;") + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list |column -t;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-nginx-config b/bin/v-list-sys-nginx-config new file mode 100755 index 000000000..c365caa78 --- /dev/null +++ b/bin/v-list-sys-nginx-config @@ -0,0 +1,88 @@ +#!/bin/bash +# info: list nginx config parameters +# options: [FORMAT] +# +# The function for obtaining the list of nginx config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh + +# JSON list function +json_list() { + eval $(echo "$config" |egrep "$keys" |tr -d ';'| awk '{print $1"="$2}') + echo '{ + "CONFIG": { + "worker_processes": "'$worker_processes'", + "worker_connections": "'$worker_connections'", + "send_timeout": "'$send_timeout'", + "proxy_connect_timeout": "'$proxy_connect_timeout'", + "proxy_send_timeout": "'$proxy_send_timeout'", + "proxy_read_timeout": "'$proxy_read_timeout'", + "client_max_body_size": "'$client_max_body_size'", + "gzip": "'$gzip'", + "gzip_comp_level": "'$gzip_comp_level'", + "charset": "'$charset'", + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "$config" |egrep "$keys" |tr -d ';' + echo "config_path $config_path" +} + +# PLAIN list function +plain_list() { + echo "$config" |egrep "$keys" |tr -d ';' + echo "config_path $config_path" +} + +# CSV list function +csv_list() { + echo "$keys" |sed "s/ |/,/g" + echo "$config" |egrep "$keys" |awk '{print $2}' |tr -d ';' |tr '\n' ',' + echo +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +config_path='/etc/nginx/nginx.conf' + +# Defining keys +keys="worker_processes |worker_connections |send_timeout" +keys="$keys |proxy_connect_timeout |proxy_send_timeout" +keys="$keys |proxy_read_timeout |client_max_body_size" +keys="$keys |gzip |gzip_comp_level |charset " + + +# Reading nginx config +config=$(cat $config_path) + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list |column -t;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-pgsql-config b/bin/v-list-sys-pgsql-config new file mode 100755 index 000000000..f568f1079 --- /dev/null +++ b/bin/v-list-sys-pgsql-config @@ -0,0 +1,70 @@ +#!/bin/bash +# info: list postgresql config parameters +# options: [FORMAT] +# +# The function for obtaining the list of postgresql config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh + +# JSON list function +json_list() { + echo '{ + "CONFIG": { + "pg_hba_path": "'$pg_hba_path'", + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "config_path: $config_path" + echo "pg_hba_path: $pg_hba_path" +} + +# PLAIN list function +plain_list() { + echo -e "$config_path\t$pg_hba_path" +} + +# CSV list function +csv_list() { + echo "config_path,pg_hba_path" + echo "$config_path,$pg_hba_path" +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +config_path=$(find /etc/postgresql /var/lib/pgsql/data -name \ + postgresql.conf 2>/dev/null) +pg_hba_path=$(find /etc/postgresql /var/lib/pgsql/data -name \ + pg_hba.conf 2>/dev/null) + + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-php-config b/bin/v-list-sys-php-config new file mode 100755 index 000000000..b00902719 --- /dev/null +++ b/bin/v-list-sys-php-config @@ -0,0 +1,94 @@ +#!/bin/bash +# info: list php config parameters +# options: [FORMAT] +# +# The function for obtaining the list of php config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh +source $VESTA/conf/vesta.conf + +# JSON list function +json_list() { + eval $(echo "$config"|egrep "$keys"|\ + sed -e "s/[ ]*=/=/" -e "s/=[ ]*/=\'/" -e "s/$/'/") + echo '{ + "CONFIG": { + "memory_limit": "'$memory_limit'", + "max_execution_time": "'$max_execution_time'", + "max_input_time": "'$max_input_time'", + "upload_max_filesize": "'$upload_max_filesize'", + "post_max_size": "'$post_max_size'", + "display_errors": "'$display_errors'", + "error_reporting": "'$error_reporting'", + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "$config" |egrep "$keys" |tr -d '=' + echo "config_path $config_path" +} + +# PLAIN list function +plain_list() { + echo "$config" |egrep "$keys" |tr -d '=' + echo "config_path $config_path" +} + +# CSV list function +csv_list() { + echo "$keys" |sed "s/ |/,/g" + echo "$config" |egrep "$keys" |tr -d '=' |awk '{print $2}' |tr '\n' ',' + echo +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +config_path=$(find /etc/php* -name php.ini) +config_count=$(echo "$config_path" |wc -l) +if [ "$config_count" -gt 1 ]; then + if [ "$WEB_SYSTEM" = "nginx" ]; then + config_path=$(echo "$config_path"| grep fpm) + else + config_path=$(echo "$config_path"| grep apache) + fi +fi + + +# Defining keys +keys="memory_limit |max_execution_time |max_input_time" +keys="$keys |upload_max_filesize |post_max_size" +keys="$keys |display_errors |error_reporting " + +# Reading config +config=$(cat $config_path|grep -v "^;") + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list |column -t;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-proftpd-config b/bin/v-list-sys-proftpd-config new file mode 100755 index 000000000..f0b35502f --- /dev/null +++ b/bin/v-list-sys-proftpd-config @@ -0,0 +1,64 @@ +#!/bin/bash +# info: list proftpd config parameters +# options: [FORMAT] +# +# The function for obtaining the list of proftpd config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh + +# JSON list function +json_list() { + echo '{ + "CONFIG": { + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "config_path: $config_path" +} + +# PLAIN list function +plain_list() { + echo "$config_path" +} + +# CSV list function +csv_list() { + echo "config_path" + echo "$config_path" +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +config_path=$(find /etc/proftpd* -name proftpd.conf 2>/dev/null) + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-spamd-config b/bin/v-list-sys-spamd-config new file mode 100755 index 000000000..04d82c731 --- /dev/null +++ b/bin/v-list-sys-spamd-config @@ -0,0 +1,64 @@ +#!/bin/bash +# info: list spamassassin config parameters +# options: [FORMAT] +# +# The function for obtaining the list of spamassassin config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh + +# JSON list function +json_list() { + echo '{ + "CONFIG": { + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "config_path: $config_path" +} + +# PLAIN list function +plain_list() { + echo "$config_path" +} + +# CSV list function +csv_list() { + echo "config_path" + echo "$config_path" +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +config_path=$(find /etc/spamassassin /etc/mail -name local.cf 2>/dev/null) + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-list-sys-vsftpd-config b/bin/v-list-sys-vsftpd-config new file mode 100755 index 000000000..060d88422 --- /dev/null +++ b/bin/v-list-sys-vsftpd-config @@ -0,0 +1,64 @@ +#!/bin/bash +# info: list vsftpd config parameters +# options: [FORMAT] +# +# The function for obtaining the list of vsftpd config parameters. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +format=${1-shell} + +# Includes +source $VESTA/func/main.sh + +# JSON list function +json_list() { + echo '{ + "CONFIG": { + "config_path": "'$config_path'" + } +}' +} + +# SHELL list function +shell_list() { + echo "config_path: $config_path" +} + +# PLAIN list function +plain_list() { + echo "$config_path" +} + +# CSV list function +csv_list() { + echo "config_path" + echo "$config_path" +} + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config path +config_path=$(find /etc/vsftpd* -name vsftpd.conf 2>/dev/null) + +# Listing data +case $format in + json) json_list ;; + plain) plain_list ;; + csv) csv_list ;; + shell) shell_list;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +exit diff --git a/bin/v-open-fs-config b/bin/v-open-fs-config new file mode 100755 index 000000000..807bbec97 --- /dev/null +++ b/bin/v-open-fs-config @@ -0,0 +1,47 @@ +#!/bin/bash +# info: open config +# options: CONFIG +# +# The function opens/reads config files on the file system + +src_file=$1 + +# Checking arguments +if [ -z "$src_file" ]; then + echo "Usage: CONFIG" + exit 1 +fi + +# Checking vesta user +if [ ! -e "$VESTA/data/users/$user" ]; then + echo "Error: vesta user $user doesn't exist" + exit 3 +fi + +# Checking file on fs +if [ ! -e "$src_file" ]; then + echo "Error: $src_file file doesn't exist" + exit 3 +fi + +# Checking path +if [ ! -z "$src_file" ]; then + rpath=$(readlink -f "$src_file") + services="nginx|apache|httpd|php|ftp|bind|named|exim|dovecot|spamassassin" + services="$services|clam|mysql|postgresql|pgsql|cron|fail2ban|iptables" + spath=$(echo "$rpath" |egrep "$services") + if [ -z "$spath" ]; then + echo "Error: invalid source path $src_file" + exit 2 + fi +fi + +# Reading conf +cat "$src_file" 2>/dev/null +if [ $? -ne 0 ]; then + echo "Error: file $src_file was not opened" + exit 3 +fi + +# Exiting +exit diff --git a/web/edit/server/apache2/index.php b/web/edit/server/apache2/index.php new file mode 100644 index 000000000..d3c79bcb9 --- /dev/null +++ b/web/edit/server/apache2/index.php @@ -0,0 +1,58 @@ +o^#AZZ{my|_BL_|Esh=?&p^u$uqY>brR5iuenB4WIG z6;q5cBGzI=^hE9H)$RM?9*&>)-hMxAzPsn1d;Xtu?{7)cq2K=gguluBjwIQgB*`H` ztmL==ztzvlhrg1XI3xKb;epT{b&qI07U{h9wvxxkm{1Tpg-=3=xTN)}+usnqmA$;@ z3(o!p(RH^!FWR3!)jqHNcJkX~ui^Ynilz>agv$c;7#FAqauF*W1e|l^+ z{w|t$%s(}+y8Ua>?fj5iUkjO{_&)?}Qr}tOnt%>|%_lR?9CH7N?T%n)=nM$tk&c79 ztqI6tH+{Yu&p2nkuz?P89|ZGpF7mwo3Guj##Dp9<6a+7WO|yYLe+JF0+4+QMyXVAA z@5!0DOzZhQ^)nmSMH3hEOTO5&v$ANf2hEJ(~aLR!Ar{#DfbsTJS8Z`d6c zh~=tawZ#tc;OCt{uKNYkT^3Dj&HOdv@fOp&KEdZe?U<#Hj?b(x?_Q4nVq;7=Ej06y zmB(GF2=pG`JoL@(;$zWSe6*8!DI4aW`DB*ueY@dkWT*jeIro5G zwX>V`jQp8p!1w8%VDaz{Sg+v`kL|yRrcPP?w3EZm_GpW{Xa0Gw?2Uj={&vRtzrE)k zQETR#_lFpXWn3u4y^otYwEH>VAZxsEo9y9k<;aTMIeh>@$HKEy? zpT+;AbgiDe@649%S-Jn%S#td8$m2ekEbn3#e_no?m)w>G?uFHoZx#Ni3G;3BhDY7<`1G>g|2^5ECcItP1x11Rv-yBGE({BE z0(Z*W%S%(|2?0OU6<@x#_BK|;$M;WRs~+c#AuT^7AJYPPQV%=l+n(o*N +
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + + +
+ / + → ".$_SESSION['ok_msg']."
+
+
+ + +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ + + + + + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/web/templates/admin/edit_server_dovecot.html b/web/templates/admin/edit_server_dovecot.html new file mode 100644 index 000000000..50d9668ef --- /dev/null +++ b/web/templates/admin/edit_server_dovecot.html @@ -0,0 +1,171 @@ +
+
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + +
+ / + → ".$_SESSION['ok_msg']."
+
+
+
+ +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + + + + + +
+ + + +
+
+
+
diff --git a/web/templates/admin/edit_server_httpd.html b/web/templates/admin/edit_server_httpd.html new file mode 100644 index 000000000..a713b54ef --- /dev/null +++ b/web/templates/admin/edit_server_httpd.html @@ -0,0 +1,86 @@ +
+
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + +
+ / + + → ".$_SESSION['ok_msg']."
+
+
+
+ +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/web/templates/admin/edit_server_mysql.html b/web/templates/admin/edit_server_mysql.html new file mode 100644 index 000000000..d5fa8976d --- /dev/null +++ b/web/templates/admin/edit_server_mysql.html @@ -0,0 +1,155 @@ +
+
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + +
+ / + → ".$_SESSION['ok_msg']."
+
+
+
+ +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ max_connections +
+ +

+
+ max_user_connections +
+ +

+
+ wait_timeout +
+ +

+
+ interactive_timeout +
+ +

+
+ max_allowed_packet +
+ +

+
+ +
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ + + + + + + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/web/templates/admin/edit_server_nginx.html b/web/templates/admin/edit_server_nginx.html new file mode 100644 index 000000000..3bcd4f6b9 --- /dev/null +++ b/web/templates/admin/edit_server_nginx.html @@ -0,0 +1,213 @@ +
+
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + +
+ / + + → ".$_SESSION['ok_msg']."
+
+
+
+ +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ worker_processes +
+ +

+
+ worker_connections +
+ +

+
+ client_max_body_size +
+ +

+
+ send_timeout +
+ +

+
+ proxy_connect_timeout +
+ +

+
+ proxy_send_timeout +
+ +

+
+ proxy_read_timeout +
+ +

+
+ gzip +
+ +

+
+ gzip_comp_level +
+ +

+
+ charset +
+ +

+
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ + + + + + + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/web/templates/admin/edit_server_pgsql.html b/web/templates/admin/edit_server_pgsql.html new file mode 100644 index 000000000..314729a61 --- /dev/null +++ b/web/templates/admin/edit_server_pgsql.html @@ -0,0 +1,92 @@ +
+
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + +
+ / + → ".$_SESSION['ok_msg']."
+
+
+
+ +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ + + + + + + +
+ + + +
+
+
+
diff --git a/web/templates/admin/edit_server_php.html b/web/templates/admin/edit_server_php.html new file mode 100644 index 000000000..ef54c323e --- /dev/null +++ b/web/templates/admin/edit_server_php.html @@ -0,0 +1,175 @@ +
+
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + +
+ / + + → ".$_SESSION['ok_msg']."
+
+
+
+ +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ max_execution_time +
+ +

+
+ max_input_time +
+ +

+
+ memory_limit +
+ +

+
+ error_reporting +
+ +

+
+ display_errors +
+ +

+
+ post_max_size +
+ +

+
+ upload_max_filesize +
+ +

+
+ +
+ + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ + + + + + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/web/templates/admin/edit_server_service.html b/web/templates/admin/edit_server_service.html new file mode 100644 index 000000000..76cb75c89 --- /dev/null +++ b/web/templates/admin/edit_server_service.html @@ -0,0 +1,84 @@ +
+
+
+ + + + → ".htmlentities($_SESSION['error_msg']).""; + } else { + if (!empty($_SESSION['ok_msg'])) { + echo ""; + } + } + ?> + + +
+ / + → ".$_SESSION['ok_msg']."
+
+
+
+ +
+ + + +
+ + +
+ + + + + + + + +
+ + +
+
+ + + + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ + + +
+
+
+
\ No newline at end of file diff --git a/web/templates/admin/list_services.html b/web/templates/admin/list_services.html index 189d7d908..0428bbe8b 100644 --- a/web/templates/admin/list_services.html +++ b/web/templates/admin/list_services.html @@ -53,6 +53,7 @@
+
 ↵
 R
@@ -136,6 +137,7 @@
+
 ↵
 S
 R
@@ -169,8 +171,7 @@
:
-
: -
+
: