| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #!/bin/bash
- # info: delete web domain cgi support
- # options: user domain
- #
- # The function for deleting cgi support (adds -ExecCGI directive into
- # configuration file). It is recommended to apply this function only for a
- # temporary use (for lightening the consequences of DDoS, for example);
- # otherwise it is preferable to use templates.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument defenition
- user=$1
- domain=$(idn -t --quiet -u "$2" )
- domain_idn=$(idn -t --quiet -a "$domain")
- # Importing variables
- source $VESTA/conf/vesta.conf
- source $VESTA/func/shared.sh
- 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_object_valid 'user' 'USER' "$user"
- # Checking user is active
- is_object_suspended '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'
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- get_domain_values 'web'
- tpl_file="$WEBTPL/apache_$TPL.tpl"
- conf="$HOMEDIR/$user/conf/web/httpd.conf"
- CGI='no'
- # Preparing domain values for the template substitution
- upd_web_domain_values
- # Recreating vhost
- del_web_config
- add_web_config
- # Checking ssl
- if [ "$SSL" = 'yes' ]; then
- tpl_file="$WEBTPL/apache_$TPL.stpl"
- conf="$HOMEDIR/$user/conf/web/shttpd.conf"
- del_web_config
- add_web_config
- fi
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Deleting cgi in config
- update_domain_value 'web' '$CGI' 'no'
- # Adding task to the vesta pipe
- $BIN/v_restart_web
- # Logging
- log_history "$EVENT" "v_add_web_domain_cgi $user $domain"
- log_event "$OK" "$EVENT"
- exit
|