v_add_web_domain_cgi 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/bin/bash
  2. # info: adding cgi for domain
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. domain=$(idn -t --quiet -u "$2" )
  9. domain_idn=$(idn -t --quiet -a "$domain")
  10. # Importing variables
  11. source $VESTA/conf/vars.conf
  12. source $V_FUNC/shared_func.sh
  13. source $V_FUNC/domain_func.sh
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. # Checking arg number
  18. check_args '2' "$#" 'user domain'
  19. # Checking argument format
  20. format_validation 'user' 'domain'
  21. # Checking web system is enabled
  22. is_system_enabled 'web'
  23. # Checking user
  24. is_user_valid
  25. # Checking user is active
  26. is_user_suspended
  27. # Checking domain exist
  28. is_web_domain_valid
  29. # Checking domain is not suspened
  30. is_domain_suspended 'web_domains'
  31. # Checking cgi is not added
  32. is_web_domain_key_empty '$CGI'
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Get template name
  37. tpl_name=$(get_web_domain_value '$TPL')
  38. tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
  39. # Defining config
  40. conf="$V_HOME/$user/conf/httpd.conf"
  41. # Defining search phrase
  42. search_phrase='ScriptAlias '
  43. # Defining replace string
  44. str_repl=" ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin/"
  45. # Adding cgi-bin support
  46. httpd_change_config
  47. # Defining search phrase
  48. search_phrase='Options '
  49. # Defining replace string
  50. str_repl=' Options +Includes -Indexes +ExecCGI'
  51. # Adding execscgi support
  52. httpd_change_config
  53. # Checking ssl
  54. ssl=$(get_web_domain_value '$SSL')
  55. if [ "$ssl" = 'yes' ]; then
  56. # Get ssl template name
  57. tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
  58. # Defining ssl config
  59. conf="$V_HOME/$user/conf/shttpd.conf"
  60. # Defining search phrase
  61. search_phrase='ScriptAlias '
  62. # Defining replace string
  63. str_repl=" ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin/"
  64. # Adding cgi-bin support
  65. httpd_change_config
  66. # Defining search phrase
  67. search_phrase='Options '
  68. # Defining replace string
  69. str_repl=' Options +Includes -Indexes +ExecCGI'
  70. # Adding execscgi support
  71. httpd_change_config
  72. fi
  73. #----------------------------------------------------------#
  74. # Vesta #
  75. #----------------------------------------------------------#
  76. # Adding elog in config
  77. update_web_domain_value '$CGI' 'yes'
  78. # Adding task to the vesta pipe
  79. restart_schedule 'web'
  80. # Logging
  81. log_history "$V_EVENT" "v_del_web_domain_cgi $user $domain"
  82. log_event 'system' "$V_EVENT"
  83. exit $OK