v_delete_web_domain_cgi 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/vars.conf
  18. source $V_CONF/vesta.conf
  19. source $V_FUNC/shared.func
  20. source $V_FUNC/domain.func
  21. #----------------------------------------------------------#
  22. # Verifications #
  23. #----------------------------------------------------------#
  24. # Checking arg number
  25. check_args '2' "$#" 'user domain'
  26. # Checking argument format
  27. format_validation 'user' 'domain'
  28. # Checking web system is enabled
  29. is_system_enabled 'web'
  30. # Checking user
  31. is_user_valid
  32. # Checking user is active
  33. is_user_suspended
  34. # Checking domain exist
  35. is_web_domain_valid
  36. # Checking domain is not suspened
  37. is_domain_suspended 'web'
  38. # Checking cgi is added
  39. is_web_domain_value_exist '$CGI'
  40. #----------------------------------------------------------#
  41. # Action #
  42. #----------------------------------------------------------#
  43. get_web_domain_values
  44. tpl_file="$V_WEBTPL/apache_$TPL.tpl"
  45. conf="$V_HOME/$user/conf/httpd.conf"
  46. CGI='no'
  47. # Preparing domain values for the template substitution
  48. upd_web_domain_values
  49. # Recreating vhost
  50. del_web_config
  51. add_web_config
  52. # Checking ssl
  53. if [ "$SSL" = 'yes' ]; then
  54. tpl_file="$V_WEBTPL/apache_$TPL.stpl"
  55. conf="$V_HOME/$user/conf/shttpd.conf"
  56. del_web_config
  57. add_web_config
  58. fi
  59. #----------------------------------------------------------#
  60. # Vesta #
  61. #----------------------------------------------------------#
  62. # Deleting cgi in config
  63. update_web_domain_value '$CGI' 'no'
  64. # Adding task to the vesta pipe
  65. restart_schedule 'web'
  66. # Logging
  67. log_history "$V_EVENT" "v_add_web_domain_cgi $user $domain"
  68. log_event 'system' "$V_EVENT"
  69. exit