Refactoring stage IV (web)

This commit is contained in:
Serghey Rodin 2012-03-29 01:08:43 +03:00
commit 0fb633a8c4
62 changed files with 467 additions and 994 deletions

View file

@ -70,7 +70,7 @@ sync_cron_jobs
increase_user_value $user '$U_CRON_JOBS'
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -45,7 +45,7 @@ sync_cron_jobs
#----------------------------------------------------------#
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -109,7 +109,7 @@ increase_user_value "$user" '$U_DNS_DOMAINS'
increase_user_value "$user" '$U_DNS_RECORDS' "$records"
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -79,7 +79,7 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
increase_user_value "$user" '$U_DNS_RECORDS'
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -106,7 +106,7 @@ fi
# Adding task to the vesta pipe
if [ "$web_restart" = 'yes' ]; then
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
fi
# Logging

View file

@ -22,7 +22,7 @@ domain_idn=$(idn -t --quiet -a "$domain")
ip=$3
template=${4-default}
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -33,32 +33,15 @@ source $VESTA/func/ip.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain ip [template]'
# Checking argument format
validate_format 'user' 'domain' 'ip' 'template'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain
is_domain_new 'dns'
# Checking ip
is_domain_new 'web'
is_ip_valid
is_ip_avalable
# Checking package
is_package_full 'WEB_DOMAINS'
# Checking template
templates=$(get_user_value '$WEB_TPL')
is_apache_template_valid
@ -89,7 +72,6 @@ group="$user"
email="$user@$domain"
docroot="$HOMEDIR/$user/web/$domain/public_html"
docroot_string="DocumentRoot $docroot"
conf="$HOMEDIR/$user/conf/web/httpd.conf"
tpl_file="$WEBTPL/apache_$template.tpl"
@ -192,34 +174,26 @@ fi
# Vesta #
#----------------------------------------------------------#
# Increasing ip value
# Increasing counters
increase_ip_value "$ip"
# Increasing domain value
increase_user_value "$user" '$U_WEB_DOMAINS'
increase_user_value "$user" '$U_WEB_ALIASES'
# Defining domain variables
v_str="DOMAIN='$domain'"
v_str="$v_str IP='$ip' IP6=''"
v_str="$v_str U_DISK='0'"
v_str="$v_str U_BANDWIDTH='0'"
v_str="$v_str TPL='$template'"
v_str="$v_str ALIAS='$aliases'"
v_str="$v_str $template_data" # Inserting PHP, CGI and ELOG keys
v_str="$v_str STATS='' STATS_AUTH=''"
v_str="$v_str SSL='no' SSL_HOME='single'"
v_str="$v_str NGINX='' NGINX_EXT='' SUSPENDED='no' DATE='$DATE'"
str="DOMAIN='$domain' IP='$ip' IP6='' ALIAS='$aliases' TPL='$template'"
str="$str $template_data SSL='no' SSL_HOME='single' NGINX='' NGINX_EXT=''"
str="$str STATS='' STATS_USER='' U_DISK='0' U_BANDWIDTH='0' SUSPENDED='no'"
str="$str TIME='$TIME' DATE='$DATE'"
# Registering domain
echo "$v_str" >> $USER_DATA/web.conf
echo "$str" >> $USER_DATA/web.conf
chmod 660 $USER_DATA/web.conf
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_delete_web_domain $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -19,7 +19,7 @@ dom_alias=$(idn -t --quiet -u "$3" )
dom_alias=$(echo $dom_alias | tr '[:upper:]' '[:lower:]')
dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -29,31 +29,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain dom_alias'
# Checking argument format
validate_format 'user' 'domain' 'dom_alias'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking alias on the server
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_domain_new 'web' "$dom_alias"
# Checking package
is_package_full 'WEB_ALIASES'
@ -109,15 +92,15 @@ fi
#----------------------------------------------------------#
# Adding new alias
update_domain_value 'web' '$ALIAS' "$ALIAS"
update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
# Update counters
increase_user_value "$user" '$U_WEB_ALIASES'
# Adding task to the vesta pipe
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
log_history "$EVENT" "v_delete_web_domain_alias $user $domain $dom_alias"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -27,29 +27,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking cgi is not added
is_domain_key_empty 'web' '$CGI'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_empty 'web' 'DOMAIN' "$domain" '$CGI'
#----------------------------------------------------------#
@ -82,14 +67,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Adding elog in config
update_domain_value 'web' '$CGI' 'yes'
# Update config value
update_object_value 'web' 'DOMAIN' "$domain" '$CGI' 'yes'
# Adding task to the vesta pipe
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_delete_web_domain_cgi $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -15,7 +15,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -25,29 +25,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking errorlog is not added
is_domain_key_empty 'web' '$ELOG'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_empty 'web' 'DOMAIN' "$domain" '$ELOG'
#----------------------------------------------------------#
@ -96,14 +81,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Adding elog in config
update_domain_value 'web' '$ELOG' 'yes'
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$ELOG' 'yes'
# Adding task to the vesta pipe
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_delete_web_domain_elog $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -29,31 +29,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain [template] [extentions]'
# Checking argument format
validate_format 'user' 'domain' 'template' 'extentions'
# Checking proxy system is enabled
is_system_enabled 'proxy'
# Checking user
is_system_enabled "$PROXY_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Check nginx is not added
is_domain_key_empty 'web' '$NGINX'
# Checking template
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_empty 'web' 'DOMAIN' "$domain" '$NGINX'
is_nginx_template_valid
@ -106,14 +89,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Adding nginx params to config
update_domain_value 'web' '$NGINX' "$NGINX"
update_domain_value 'web' '$NGINX_EXT' "$extentions"
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$NGINX' "$NGINX"
update_object_value 'web' 'DOMAIN' "$domain" '$NGINX_EXT' "$extentions"
# Adding task to the vesta pipe
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
log_history "$EVENT" "v_delete_web_domain_nginx $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -21,7 +21,7 @@ domain_idn=$(idn -t --quiet -a "$domain")
ssl_dir=$3
ssl_home=${4-single}
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -32,31 +32,15 @@ source $VESTA/func/ip.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain ssl_dir [ssl_home]'
# Checking argument format
validate_format 'user' 'domain' 'ssl_dir'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Check ssl is not added
is_domain_key_empty 'web' '$SSL'
# Checking ssl certificate
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_empty 'web' 'DOMAIN' "$domain" '$SSL'
is_sys_ip_owner
is_web_domain_cert_valid
@ -80,9 +64,6 @@ conf="$HOMEDIR/$user/conf/web/shttpd.conf"
tpl_file="$WEBTPL/apache_$TPL.stpl"
SSL_HOME="$ssl_home"
# Checking ip ownership
is_sys_ip_owner
# Preparing domain values for the template substitution
upd_web_domain_values
@ -139,11 +120,14 @@ fi
increase_user_value "$user" '$U_WEB_SSL'
# Adding ssl values
update_domain_value 'web' '$SSL_HOME' "$SSL_HOME"
update_domain_value 'web' '$SSL' 'yes'
update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
update_object_value 'web' 'DOMAIN' "$domain" '$SSL' "yes"
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_delete_web_domain_ssl $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -1,103 +0,0 @@
#!/bin/bash
# info: add password protection to web domain statistics
# options: user domain auth_user auth_password
#
# The call is used for securing the web statistics page.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
domain=$(idn -t --quiet -u "$2" )
auth_user=$3
auth_pass=$4
# Importing variables
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '4' "$#" 'user domain auth_user auth_password'
# Checking argument format
validate_format 'user' 'domain' 'auth_user' 'auth_pass'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Definining statistic dir
stat_dir="$HOMEDIR/$user/web/$domain/stats"
# Adding htaccess file
if [ ! -e "$stat_dir/.htaccess" ]; then
echo "AuthUserFile $stat_dir/.htpasswd" > $stat_dir/.htaccess
echo "AuthName \"Only for admins\"" >> $stat_dir/.htaccess
echo "AuthType Basic" >> $stat_dir/.htaccess
echo "Require valid-user" >> $stat_dir/.htaccess
echo "" >> $stat_dir/.htaccess
fi
# Generating htaccess user and password
if [ ! -e "$stat_dir/.htpasswd" ]; then
htpasswd -bc $stat_dir/.htpasswd "$auth_user" "$auth_pass" &>/dev/null
else
htpasswd -b $stat_dir/.htpasswd "$auth_user" "$auth_pass" &>/dev/null
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Get current value
curr_val=$(get_domain_value 'web' '$STATS_AUTH')
check_uniq=$(echo "$curr_val" | grep -w "$auth_user")
# Checking current users
if [ -z "$curr_val" ] || [ "$curr_val" = 'no' ]; then
a_users="$auth_user"
else
if [ -z "$check_uniq" ]; then
a_users="$curr_val,$auth_user"
else
a_users="$curr_val"
fi
fi
# Adding stats user in config
update_domain_value 'web' '$STATS_AUTH' "$a_users"
# Hiding password
EVENT="$DATE $SCRIPT $user $domain $auth_user *****"
# Logging
log_history "$EVENT" "v_delete_web_domain_stat_auth $user $domain $auth_user"
log_event "$OK" "$EVENT"
exit

View file

@ -19,7 +19,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
type=$3
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -29,32 +29,15 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain type'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_object_valid 'user' 'USER' "$user" "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking statistic type
is_system_enabled "$WEB_SYSTEM"
is_type_valid "$STATS_SYSTEM" "$type"
# Check statistic is not added
is_domain_key_empty 'web' '$STATS'
is_object_valid 'user' 'USER' "$user" "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_empty 'web' 'DOMAIN' "$domain" '$STATS'
#----------------------------------------------------------#
@ -87,14 +70,14 @@ cat $WEBTPL/$type.tpl |\
# Vesta #
#----------------------------------------------------------#
# Adding command to pipe
# Schedule statistic processing
echo "$BIN/v_update_web_domain_stat $user $domain" >> $V_QUEUE/stats.pipe
# Adding stats in config
update_domain_value 'web' '$STATS' "$type"
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$STATS' "$type"
# Logging
log_history "$EVENT" "v_delete_web_domain_stat $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

72
bin/v_add_web_domain_stats_user Executable file
View file

@ -0,0 +1,72 @@
#!/bin/bash
# info: add password protection to web domain statistics
# options: user domain stats_user stats_password
#
# The call is used for securing the web statistics page.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
domain=$(idn -t --quiet -u "$2" )
stats_user=$3
stats_pass=$4
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '4' "$#" 'user domain stats_user stats_pass'
validate_format 'user' 'domain' 'stats_user' 'stats_pass'
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_empty 'web' 'DOMAIN' "$domain" '$STATS_USER'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Definining statistic dir
stats_dir="$HOMEDIR/$user/web/$domain/stats"
# Adding htaccess file
rm -f $stats_dir/.htaccess
echo "AuthUserFile $stats_dir/.htpasswd
AuthName \"Web Statistics\"
AuthType Basic
Require valid-user" > $stats_dir/.htaccess
# Generating htaccess user and password
rm -f $stats_dir/.htpasswd
htpasswd -bc $stats_dir/.htpasswd "$stats_user" "$stats_pass" &>/dev/null
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Adding stats user in config
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_USER' "$stats_user"
# Hiding password
EVENT="DATE='$DATE' TIME='$TIME' COMMAND='$SCRIPT'"
EVENT="$EVENT ARGUMENTS='$user $domain $stats_user *****'"
# Logging
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -64,7 +64,7 @@ sync_cron_jobs
#----------------------------------------------------------#
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -53,7 +53,7 @@ update_domain_zone
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -70,7 +70,7 @@ update_domain_zone
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -51,7 +51,7 @@ update_domain_zone
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -79,7 +79,7 @@ update_domain_zone
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -50,7 +50,7 @@ update_domain_zone
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -16,7 +16,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
ip=$3
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -27,28 +27,14 @@ source $VESTA/func/ip.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain ip'
# Checking argument format
validate_format 'user' 'domain' 'ip'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking ip
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_ip_valid
is_ip_avalable
@ -90,20 +76,18 @@ fi
# Vesta #
#----------------------------------------------------------#
# Increasing ip value
# Update counters
increase_ip_value "$new"
# Decreasing old ip value
decrease_ip_value "$old"
# Adding ip in config
update_domain_value 'web' '$IP' "$new"
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$IP' "$ip"
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "$SCRIPT $user $domain $old_ip"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -16,7 +16,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
ssl_dir=$3
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -26,31 +26,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain ssl_dir'
# Checking argument format
validate_format 'user' 'domain' 'ssl_dir'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Check SSL is added
is_domain_value_exist 'web' '$SSL'
# Checking ssl certificate
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$SSL'
is_web_domain_cert_valid
@ -86,11 +69,11 @@ fi
# Vesta #
#----------------------------------------------------------#
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "$SCRIPT $user $domain $tmpdir"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -11,7 +11,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
ssl_home=$3
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -21,29 +21,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain ssl_home'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Check SSL is added
is_domain_value_exist 'web' '$SSL'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$SSL'
#----------------------------------------------------------#
@ -55,7 +40,7 @@ get_domain_values 'web'
old_ssl_home=$SSL_HOME
SSL_HOME=$ssl_home
tpl_file="$WEBTPL/apache_$TPL.stpl"
conf="$HOMEDIR/$user/conf/shttpd.conf"
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
# Parsing tpl_option
case $SSL_HOME in
@ -72,7 +57,7 @@ replace_web_config
# Checking nginx config
if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/snginx.conf"
conf="$HOMEDIR/$user/conf/web//snginx.conf"
replace_web_config
fi
@ -81,14 +66,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Adding sslhome in config
update_domain_value 'web' '$SSL_HOME' "$SSL_HOME"
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "$SCRIPT $user $domain $old_ssl_home"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -16,7 +16,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
template=$3
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -26,29 +26,13 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain template'
# Checking argument format
validate_format 'user' 'domain' 'template'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking template
templates=$(get_user_value '$WEB_TPL')
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_apache_template_valid
@ -176,20 +160,20 @@ fi
#----------------------------------------------------------#
# Changing tpl in config
update_domain_value 'web' '$TPL' "$template"
update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template"
# Updating db keys
for keys in $(cat $WEBTPL/apache_$template.descr|grep -v '#'); do
key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
value=$(echo "$keys" |cut -f 2 -d \')
update_domain_value 'web' "$key" "$value"
update_object_value 'web' 'DOMAIN' "$domain" "$key" "$value"
done
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_change_web_domain_tpl $user $domain $old_tpl"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -53,7 +53,7 @@ sync_cron_jobs
decrease_user_value "$user" '$U_CRON_JOBS'
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -45,7 +45,7 @@ sync_cron_jobs
#----------------------------------------------------------#
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_history "$EVENT"

View file

@ -59,7 +59,7 @@ decrease_user_value "$user" '$U_DNS_RECORDS' "$records"
# Restart named
if [ "$restart" != 'no' ]; then
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
fi

View file

@ -50,7 +50,7 @@ update_domain_zone
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -42,7 +42,7 @@ done
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -98,7 +98,7 @@ fi
# Adding task to the vesta pipe
if [ "$web_restart" = 'yes' ]; then
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
fi
# Logging

View file

@ -16,8 +16,9 @@
user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
restart=$3
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -28,26 +29,13 @@ source $VESTA/func/ip.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
@ -119,7 +107,7 @@ sed -i "/DOMAIN='$domain'/ d" $USER_DATA/web.conf
# Checking last ssl domain
ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf | wc -l)
if [ "$ssl_dom" -eq '0' ]; then
sed -i "s/ Include /#Include /" $HOMEDIR/$user/conf/web/httpd.conf
sed -i "s/ Include /#Include /" $HOMEDIR/$user/conf/web/httpd.conf
fi
# Checking last domain
@ -152,22 +140,18 @@ if [ -z "$last_nginx" ]; then
rm -f $HOMEDIR/$user/conf/web/nginx.conf
fi
# Decreasing ip value
# Decrease counters
decrease_ip_value "$IP"
# Decreasing domain value
decrease_user_value "$user" '$U_WEB_DOMAINS'
# Decreasing web aliases
decrease_user_value "$user" '$U_WEB_ALIASES' "$aliases"
# Decreasing web ssl
if [ "$SSL" = 'yes' ]; then
decrease_user_value "$user" '$U_WEB_SSL'
fi
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
if [ "$restart" != 'no' ]; then
$BIN/v_restart_web "$EVENT"
fi
# Logging
log_history "$EVENT"

View file

@ -17,7 +17,7 @@ domain_idn=$(idn -t --quiet -a "$domain" )
dom_alias=$(idn -t --quiet -u "$3" )
dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -27,36 +27,21 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '3' "$#" 'user domain dom_alias'
# Checking argument format
validate_format 'user' 'domain' 'dom_alias'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking alias is added
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
get_domain_values 'web'
check_alias=$(echo ${ALIAS//,/ }|grep -w "$dom_alias")
if [ -z "$check_alias" ]; then
echo "Error: alias not exist"
log_event 'debug' "$E_NOTEXIST $EVENT"
if [ -z "$(echo $ALIAS | tr ',' '\n' | grep ^$dom_alias$)" ]; then
echo "Error: alias $dom_alias not exist"
log_event "$E_NOTEXIST" "$EVENT"
exit $E_NOTEXIST
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
@ -105,17 +90,17 @@ fi
# Vesta #
#----------------------------------------------------------#
# Deleting alias
update_domain_value 'web' '$ALIAS' "$ALIAS"
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
# Update counters
decrease_user_value "$user" '$U_WEB_ALIASES'
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_add_web_domain_alias $user $domain $dom_alias"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -17,7 +17,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -27,29 +27,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking cgi is added
is_domain_value_exist 'web' '$CGI'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$CGI'
#----------------------------------------------------------#
@ -81,14 +66,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Deleting cgi in config
update_domain_value 'web' '$CGI' 'no'
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$CGI' 'no'
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_add_web_domain_cgi $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -16,7 +16,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -26,29 +26,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user" "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Check errorlog is added
is_domain_value_exist 'web' '$ELOG'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$ELOG'
#----------------------------------------------------------#
@ -97,14 +82,14 @@ fi
# Vesta #
#----------------------------------------------------------#
# Deleting elog in config
update_domain_value 'web' '$ELOG' 'no'
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$ELOG' 'no'
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_add_web_domain_elog $user $domain"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -14,7 +14,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -24,29 +24,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking ssl is added
is_domain_value_exist 'web' '$NGINX'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$NGINX'
#----------------------------------------------------------#
@ -56,13 +41,13 @@ is_domain_value_exist 'web' '$NGINX'
# Defining domain parameters
get_domain_values 'web'
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/nginx.conf"
conf="$HOMEDIR/$user/conf/web/nginx.conf"
del_web_config
# Checking ssl
if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/snginx.conf"
conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config
fi
@ -71,9 +56,9 @@ fi
# Vesta #
#----------------------------------------------------------#
# Deleting nginx keys
update_domain_value 'web' '$NGINX' ''
update_domain_value 'web' '$NGINX_EXT' ''
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$NGINX' ''
update_object_value 'web' 'DOMAIN' "$domain" '$NGINX_EXT' ''
# Checking last nginx domain
conf='/etc/nginx/conf.d/vesta_users.conf'
@ -89,11 +74,11 @@ if [ -z "$last_nginx" ]; then
rm -f $HOMEDIR/$user/conf/web/nginx.conf
fi
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_add_web_domain_nginx $user $domain $NGINX $NGINX_EXT"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -14,7 +14,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -24,29 +24,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking ssl is added
is_domain_value_exist 'web' '$SSL'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$SSL'
#----------------------------------------------------------#
@ -79,13 +64,13 @@ chown -R $user:$user $tmpdir
# Vesta #
#----------------------------------------------------------#
# Deleting ssl in config
update_domain_value 'web' '$SSL' 'no'
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$SSL' 'no'
# Checking last ssl domain
ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf)
main_conf='/etc/httpd/conf.d/vesta.conf'
conf="$HOMEDIR/$user/conf/shttpd.conf"
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
if [ -z "$ssl_dom" ]; then
sed -i "/Include ${conf////\/}/d" $main_conf
rm -f $conf
@ -96,19 +81,18 @@ conf='/etc/nginx/conf.d/vesta_users.conf'
last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf)
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
if [ -z "$last_snginx" ]; then
if [ -z "$last_nginx" ]; then
sed -i "/$user\/conf\/snginx.conf/d" $conf
rm -f $HOMEDIR/$user/conf/snginx.conf
sed -i "/$user\/conf\/web\/snginx.conf/d" $conf
rm -f $HOMEDIR/$user/conf/web/snginx.conf
fi
# Decreasing domain value
decrease_user_value "$user" '$U_WEB_SSL'
# Adding task to the vesta pipe
$BIN/v_restart_web
# Restart web server
$BIN/v_restart_web "$EVENT"
# Logging
log_history "$EVENT" "v_add_web_domain_ssl $user $domain $tmpdir $SSL_HOME"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -14,7 +14,7 @@
user=$1
domain=$(idn -t --quiet -u "$2" )
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -24,29 +24,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain'
# Checking argument format
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking stats enabled
is_domain_value_exist 'web' '$STATS'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS'
#----------------------------------------------------------#
@ -54,16 +39,16 @@ is_domain_value_exist 'web' '$STATS'
#----------------------------------------------------------#
# Defining statistic type
type=$(get_domain_value 'web' '$STATS')
get_domain_values 'web'
# Defining statistic dir
stat_dir="$HOMEDIR/$user/web/$domain/stats"
stats_dir="$HOMEDIR/$user/web/$domain/stats"
# Deleting dir content
rm -rf $stat_dir/*
rm -rf $stats_dir/*
# Deleting config
rm -f $HOMEDIR/$user/conf/$type.$domain.conf
rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
#----------------------------------------------------------#
@ -73,11 +58,11 @@ rm -f $HOMEDIR/$user/conf/$type.$domain.conf
# Deleting pipe command
sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
# Deleting stats
update_domain_value 'web' '$STATS' ''
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$STATS' ''
# Logging
log_history "$EVENT" "v_add_web_domain_stat $user $doman $type"
log_history "$EVENT"
log_event "$OK" "$EVENT"
exit

View file

@ -1,6 +1,6 @@
#!/bin/bash
# info: disable webdomain stats authentication support
# options: user domain [auth_user]
# options: user domain
#
# The function removes authentication of statistics system. If the script is
# called without naming a certain user, all users will be removed. After
@ -15,9 +15,8 @@
# Argument defenition
user=$1
domain=$(idn -t --quiet -u "$2" )
auth_user=$3
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -27,29 +26,14 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '2' "$#" 'user domain [auth_user]'
# Checking argument format
check_args '2' "$#" 'user domain'
validate_format 'user' 'domain'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
# Checking stats auth enabled
is_domain_value_exist 'web' '$STATS_AUTH'
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS_USER'
#----------------------------------------------------------#
@ -57,50 +41,16 @@ is_domain_value_exist 'web' '$STATS_AUTH'
#----------------------------------------------------------#
# Definining statistic dir
stat_dir="$HOMEDIR/$user/web/$domain/stats"
# Checking auth_user
if [ ! -z "$auth_user" ]; then
validate_format 'auth_user'
htpasswd -D $stat_dir/.htpasswd "$auth_user" &>/dev/null
fi
# Checking htpasswd current users
lines=$(wc -l $stat_dir/.htpasswd |cut -f 1 -d ' ')
if [ -z "$auth_user" ] || [ "$lines" -eq '0' ]; then
rm -f $stat_dir/.htpasswd
rm -f $stat_dir/.htaccess
fi
rm -f $HOMEDIR/$user/web/$domain/stats/.htpasswd
rm -f $HOMEDIR/$user/web/$domain/stats/.htaccess
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Checking auth_user
if [ ! -z "$auth_user" ]; then
# Get current value
curr_val=$(get_domain_value 'web' '$STATS_AUTH')
# Deleteting auth_user
new_val=$(echo "$curr_val" |\
sed -e "s/,/\n/g"|\
sed -e "s/^$auth_user$//g"|\
sed -e "/^$/d"|\
sed -e ':a;N;$!ba;s/\n/,/g')
# Checking it was last user
if [ -z "$new_val" ]; then
new_val=''
fi
else
# User empty, deleting all
new_val=''
fi
# Deleting stats auth_user
update_domain_value 'web' '$STATS_AUTH' "$new_val"
# Update config
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_USER' ''
# Logging
log_history "$EVENT"

View file

@ -12,26 +12,18 @@
# Argument defenition
user=$1
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
validate_format 'user'
# Checking web system is enabled
is_system_enabled 'WEB_SYSTEM'
# Checking user
is_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user"
@ -39,26 +31,9 @@ is_object_valid 'user' 'USER' "$user"
# Action #
#----------------------------------------------------------#
# Defining config
conf="$USER_DATA/web.conf"
# Defining fileds to select
field='$DOMAIN'
# Defining search string
search_string="SUSPENDED='no'"
# Parsing domain list
domains=$(dom_clear_search)
# Starting delete loop
for domain in $domains; do
$BIN/v_delete_web_domain "$user" "$domain"
rv="$?"
if [ "$rv" -ne '0' ]; then
log_event 'debug' "$rv $EVENT"
exit $rv
fi
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
$BIN/v_delete_web_domain "$user" "$domain" 'no'
done

View file

@ -17,7 +17,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
source $VESTA/func/domain.sh
@ -27,31 +27,19 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '3' "$#" 'user domain key'
# Checking argument format
validate_format 'user' 'domain'
# Checking user
is_object_valid 'user' 'USER' "$user"
# Checking user is active
is_object_unsuspended 'user' 'USER' "$user"
# Checking domain exist
is_domain_valid 'web'
# Checking domain is not suspened
is_domain_suspended 'web'
is_object_valid 'web' 'DOMAIN' "$domain"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
value=$(get_domain_value 'web' "$key")
echo "$value"
get_domain_values 'web'
eval echo $key
#----------------------------------------------------------#

View file

@ -40,7 +40,7 @@ sync_cron_jobs
#----------------------------------------------------------#
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -121,7 +121,7 @@ update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -228,7 +228,7 @@ update_user_value "$user" '$U_WEB_SSL' "$user_ssl"
update_user_value "$user" '$U_WEB_ALIASES' "$user_aliases"
# Adding task to the vesta pipe
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -11,6 +11,9 @@
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
EVENT=${1-$EVENT}
#----------------------------------------------------------#
# Action #
@ -20,8 +23,11 @@ source $VESTA/conf/vesta.conf
if [ "$CRON_SYSTEM" = 'crond' ]; then
/etc/init.d/crond 'reload' &>/dev/null
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
/etc/init.d/crond 'restart' &>/dev/null
if [ $? -ne 0 ]; then
log_event "$E_RESTART" "$EVENT"
exit $E_RESTART
fi
fi
fi

View file

@ -10,9 +10,9 @@
#----------------------------------------------------------#
# Includes
source /etc/profile.d/vesta.sh
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
EVENT=${1-$EVENT}
#----------------------------------------------------------#
# Action #
@ -21,9 +21,11 @@ source $VESTA/conf/vesta.conf
if [ "$DNS_SYSTEM" = 'bind' ]; then
/etc/init.d/named reload &>/dev/null
if [ $? -ne 0 ]; then
#$VESTA/func/report_issue 'sys' 'cron'
echo "$E_RESTART $1"
exit $E_RESTART
/etc/init.d/named restart &>/dev/null
if [ $? -ne 0 ]; then
log_event "$E_RESTART" "$EVENT"
exit $E_RESTART
fi
fi
fi

View file

@ -9,56 +9,48 @@
# Variable&Function #
#----------------------------------------------------------#
# Importing variables
# Includes
source $VESTA/conf/vesta.conf
# Restart functions
apache() {
/etc/init.d/httpd status &>/dev/null
if [ $? -eq 0 ]; then
/etc/init.d/httpd graceful &>/dev/null
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
else
/etc/init.d/httpd start &>/dev/null
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
fi
}
nginx() {
/etc/init.d/nginx status &>/dev/null
if [ $? -eq 0 ]; then
/etc/init.d/nginx reload &>/dev/null
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
else
/etc/init.d/nginx start &>/dev/null
if [ $? -ne 0 ]; then
echo "$E_RESTART $1"
exit $E_RESTART
fi
fi
}
source $VESTA/func/shared.sh
EVENT=${1-$EVENT}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Checking system
if [ "$WEB_SYSTEM" = 'apache' ]; then
apache $1
/etc/init.d/httpd status &>/dev/null
if [ $? -eq 0 ]; then
/etc/init.d/httpd graceful &>/dev/null
if [ $? -ne 0 ]; then
log_event "$E_RESTART" "$EVENT"
exit $E_RESTART
fi
else
/etc/init.d/httpd start &>/dev/null
if [ $? -ne 0 ]; then
log_event "$E_RESTART" "$EVENT"
exit $E_RESTART
fi
fi
fi
if [ "$PROXY_SYSTEM" = 'nginx' ]; then
nginx $1
/etc/init.d/nginx status &>/dev/null
if [ $? -eq 0 ]; then
/etc/init.d/nginx reload &>/dev/null
if [ $? -ne 0 ]; then
log_event "$E_RESTART" "$EVENT"
exit $E_RESTART
fi
else
/etc/init.d/nginx start &>/dev/null
if [ $? -ne 0 ]; then
log_event "$E_RESTART" "$EVENT"
exit $E_RESTART
fi
fi
fi
@ -66,5 +58,4 @@ fi
# Vesta #
#----------------------------------------------------------#
# Logging
exit

View file

@ -48,7 +48,7 @@ sync_cron_jobs
# Restart crond
if [ "$restart" != 'no' ]; then
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
fi
# Logging

View file

@ -41,7 +41,7 @@ done
#----------------------------------------------------------#
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -50,7 +50,7 @@ increase_user_value "$user" '$SUSPENDED_DNS'
# Restart named
if [ "$restart" != 'no' ]; then
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
fi
# Logging

View file

@ -42,7 +42,7 @@ done
#----------------------------------------------------------#
# Adding task to the vesta pipe
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -75,9 +75,9 @@ fi
#----------------------------------------------------------#
# Adding task to the vesta pipe
$BIN/v_restart_cron
$BIN/v_restart_web
$BIN/v_restart_dns
$BIN/v_restart_cron "$EVENT"
$BIN/v_restart_web "$EVENT"
$BIN/v_restart_dns "$EVENT"
# Changing suspend value
update_user_value "$user" '$SUSPENDED' 'yes'

View file

@ -99,7 +99,7 @@ update_domain_value 'web' '$SUSPENDED' 'yes'
increase_user_value "$user" '$SUSPENDED_WEB'
# Adding task to the vesta pipe
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -48,7 +48,7 @@ sync_cron_jobs
# Restart crond
if [ "$restart" != 'no' ]; then
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
fi
# Logging

View file

@ -41,7 +41,7 @@ done
#----------------------------------------------------------#
# Restart crond
$BIN/v_restart_cron
$BIN/v_restart_cron "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -50,7 +50,7 @@ decrease_user_value "$user" '$SUSPENDED_DNS'
# Restart named
if [ "$restart" != 'no' ]; then
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
fi
# Logging

View file

@ -42,7 +42,7 @@ done
#----------------------------------------------------------#
# Restart named
$BIN/v_restart_dns
$BIN/v_restart_dns "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -72,9 +72,9 @@ fi
#----------------------------------------------------------#
# Adding task to the vesta pipe
$BIN/v_restart_cron
$BIN/v_restart_web
$BIN/v_restart_dns
$BIN/v_restart_cron "$EVENT"
$BIN/v_restart_web "$EVENT"
$BIN/v_restart_dns "$EVENT"
# Changing suspend value
update_user_value "$user" '$SUSPENDED' 'no'

View file

@ -94,7 +94,7 @@ update_domain_value 'web' '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_WEB'
# Adding task to the vesta pipe
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
# Logging
log_event "$OK" "$EVENT"

View file

@ -95,7 +95,7 @@ increase_user_value "$user" '$IP_OWNED'
# Adding task to the vesta pipe
if [ "$web_restart" = 'yes' ]; then
$BIN/v_restart_web
$BIN/v_restart_web "$EVENT"
fi
# Logging