v_delete_web_domain_cgi 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # info: delete web domain cgi support
  3. # options: user domain
  4. #
  5. # The function for deleting cgi support (adds -ExecCGI directive into
  6. # configuration file). It is recommended to apply this function only for a
  7. # temporary use (for lightening the consequences of DDoS, for example);
  8. # otherwise it is preferable to use templates.
  9. #----------------------------------------------------------#
  10. # Variable&Function #
  11. #----------------------------------------------------------#
  12. # Argument defenition
  13. user=$1
  14. domain=$(idn -t --quiet -u "$2" )
  15. domain_idn=$(idn -t --quiet -a "$domain")
  16. # Includes
  17. source $VESTA/conf/vesta.conf
  18. source $VESTA/func/main.sh
  19. source $VESTA/func/domain.sh
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. check_args '2' "$#" 'user domain'
  24. validate_format 'user' 'domain'
  25. is_system_enabled "$WEB_SYSTEM"
  26. is_object_valid 'user' 'USER' "$user"
  27. is_object_unsuspended 'user' 'USER' "$user"
  28. is_object_valid 'web' 'DOMAIN' "$domain"
  29. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  30. is_object_value_exist 'web' 'DOMAIN' "$domain" '$CGI'
  31. #----------------------------------------------------------#
  32. # Action #
  33. #----------------------------------------------------------#
  34. get_domain_values 'web'
  35. tpl_file="$WEBTPL/apache_$TPL.tpl"
  36. conf="$HOMEDIR/$user/conf/web/httpd.conf"
  37. CGI='no'
  38. # Preparing domain values for the template substitution
  39. upd_web_domain_values
  40. # Recreating vhost
  41. del_web_config
  42. add_web_config
  43. # Checking ssl
  44. if [ "$SSL" = 'yes' ]; then
  45. tpl_file="$WEBTPL/apache_$TPL.stpl"
  46. conf="$HOMEDIR/$user/conf/web/shttpd.conf"
  47. del_web_config
  48. add_web_config
  49. fi
  50. #----------------------------------------------------------#
  51. # Vesta #
  52. #----------------------------------------------------------#
  53. # Update config
  54. update_object_value 'web' 'DOMAIN' "$domain" '$CGI' 'no'
  55. # Restart web server
  56. $BIN/v_restart_web "$EVENT"
  57. # Logging
  58. log_history "$EVENT"
  59. log_event "$OK" "$EVENT"
  60. exit