v_delete_web_domain_cgi 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. # Importing variables
  17. source $VESTA/conf/vesta.conf
  18. source $VESTA/func/shared.sh
  19. source $VESTA/func/domain.sh
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. # Checking arg number
  24. check_args '2' "$#" 'user domain'
  25. # Checking argument format
  26. validate_format 'user' 'domain'
  27. # Checking web system is enabled
  28. is_system_enabled 'WEB_SYSTEM'
  29. # Checking user
  30. is_object_valid 'user' 'USER' "$user"
  31. # Checking user is active
  32. is_object_suspended 'user' 'USER' "$user"
  33. # Checking domain exist
  34. is_domain_valid 'web'
  35. # Checking domain is not suspened
  36. is_domain_suspended 'web'
  37. # Checking cgi is added
  38. is_domain_value_exist 'web' '$CGI'
  39. #----------------------------------------------------------#
  40. # Action #
  41. #----------------------------------------------------------#
  42. get_domain_values 'web'
  43. tpl_file="$WEBTPL/apache_$TPL.tpl"
  44. conf="$HOMEDIR/$user/conf/web/httpd.conf"
  45. CGI='no'
  46. # Preparing domain values for the template substitution
  47. upd_web_domain_values
  48. # Recreating vhost
  49. del_web_config
  50. add_web_config
  51. # Checking ssl
  52. if [ "$SSL" = 'yes' ]; then
  53. tpl_file="$WEBTPL/apache_$TPL.stpl"
  54. conf="$HOMEDIR/$user/conf/web/shttpd.conf"
  55. del_web_config
  56. add_web_config
  57. fi
  58. #----------------------------------------------------------#
  59. # Vesta #
  60. #----------------------------------------------------------#
  61. # Deleting cgi in config
  62. update_domain_value 'web' '$CGI' 'no'
  63. # Adding task to the vesta pipe
  64. $BIN/v_restart_web
  65. # Logging
  66. log_history "$EVENT" "v_add_web_domain_cgi $user $domain"
  67. log_event "$OK" "$EVENT"
  68. exit