v_add_web_domain_cgi 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. # info: add cgi support for domain
  3. # options: user domain
  4. #
  5. # The function switches on cgi support by adding +ExecCGI directive into
  6. # webserver configuration file. The use of this function is provided for
  7. # cases, when temporary cgi support is necessary, for other cases use of
  8. # templates is recommended.
  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 not added
  39. is_web_domain_key_empty '$CGI'
  40. #----------------------------------------------------------#
  41. # Action #
  42. #----------------------------------------------------------#
  43. # Parsing domain values
  44. get_web_domain_values
  45. tpl_file="$V_WEBTPL/apache_$TPL.tpl"
  46. conf="$V_HOME/$user/conf/httpd.conf"
  47. CGI='yes'
  48. # Preparing domain values for the template substitution
  49. upd_web_domain_values
  50. # Recreating vhost
  51. del_web_config
  52. add_web_config
  53. # Checking ssl
  54. if [ "$SSL" = 'yes' ]; then
  55. tpl_file="$V_WEBTPL/apache_$TPL.stpl"
  56. conf="$V_HOME/$user/conf/shttpd.conf"
  57. del_web_config
  58. add_web_config
  59. fi
  60. #----------------------------------------------------------#
  61. # Vesta #
  62. #----------------------------------------------------------#
  63. # Adding elog in config
  64. update_web_domain_value '$CGI' 'yes'
  65. # Adding task to the vesta pipe
  66. restart_schedule 'web'
  67. # Logging
  68. log_history "$V_EVENT" "v_delete_web_domain_cgi $user $domain"
  69. log_event 'system' "$V_EVENT"
  70. exit