Bläddra i källkod

renamed SSL_CERT to SSL

Serghey Rodin 14 år sedan
förälder
incheckning
30d1240682

+ 1 - 1
bin/v_add_web_domain

@@ -205,7 +205,7 @@ v_str="$v_str TPL='$template'"
 v_str="$v_str ALIAS='$aliases'"
 v_str="$v_str $template_data"    # Inserting PHP, CGI and ELOG keys
 v_str="$v_str STATS='' STATS_AUTH=''"
-v_str="$v_str SSL_HOME='' SSL_CERT=''"
+v_str="$v_str SSL='' SSL_HOME=''"
 v_str="$v_str NGINX='' NGINX_EXT='' SUSPEND='no' DATE='$V_DATE'"
 
 # Registering domain

+ 2 - 2
bin/v_add_web_domain_alias

@@ -82,7 +82,7 @@ upd_web_domain_values
 del_web_config
 add_web_config
 
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
@@ -96,7 +96,7 @@ if [ ! -z "$NGINX" ]; then
     del_web_config
     add_web_config
 
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
         conf="$V_HOME/$user/conf/snginx.conf"

+ 1 - 1
bin/v_add_web_domain_cgi

@@ -64,7 +64,7 @@ del_web_config
 add_web_config
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config

+ 2 - 2
bin/v_add_web_domain_elog

@@ -64,7 +64,7 @@ del_web_config
 add_web_config
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
@@ -78,7 +78,7 @@ if [ ! -z "$NGINX" ]; then
     del_web_config
     add_web_config
 
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
         conf="$V_HOME/$user/conf/snginx.conf"

+ 1 - 1
bin/v_add_web_domain_nginx

@@ -68,7 +68,7 @@ conf="$V_HOME/$user/conf/nginx.conf"
 upd_web_domain_values
 add_web_config
 
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
     tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
     conf="$V_HOME/$user/conf/snginx.conf"

+ 5 - 5
bin/v_add_web_domain_ssl

@@ -49,7 +49,7 @@ is_domain_suspended 'web'
 is_package_full 'web_ssl'
 
 # Check ssl is not added
-is_web_domain_key_empty '$SSL_CERT'
+is_web_domain_key_empty '$SSL'
 
 # Checking ssl certificate
 is_web_domain_cert_valid
@@ -63,7 +63,7 @@ is_web_domain_cert_valid
 get_web_domain_values
 conf="$V_HOME/$user/conf/shttpd.conf"
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-SSL_CERT=$ssl
+SSL=$ssl
 SSL_HOME=$ssl_home
 
 # Checking ip ownership
@@ -76,8 +76,8 @@ upd_web_domain_values
 add_web_config
 
 # Adding certificate to user dir
-cp -f $V_USERS/$user/cert/$SSL_CERT.crt $ssl_cert
-cp -f $V_USERS/$user/cert/$SSL_CERT.key $ssl_key
+cp -f $V_USERS/$user/cert/$SSL.crt $ssl_cert
+cp -f $V_USERS/$user/cert/$SSL.key $ssl_key
 
 # Running template trigger
 if [ -x $V_WEBTPL/apache_$template.sh ]; then
@@ -115,7 +115,7 @@ fi
 increase_user_value "$user" '$U_WEB_SSL'
 
 # Adding ssl values
-update_web_domain_value '$SSL_CERT' "$SSL_CERT"
+update_web_domain_value '$SSL' "$SSL"
 update_web_domain_value '$SSL_HOME' "$SSL_HOME"
 
 # Logging

+ 2 - 2
bin/v_change_web_domain_ip

@@ -61,7 +61,7 @@ new=$ip
 replace_web_config
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     replace_web_config
@@ -75,7 +75,7 @@ if [ ! -z "$NGINX" ]; then
 fi
 
 # Checking nginx
-if [ ! -z "$SSL_CERT" ] && [ ! -z "$NGINX" ]; then 
+if [ ! -z "$SSL" ] && [ ! -z "$NGINX" ]; then 
     tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
     conf="$V_HOME/$user/conf/snginx.conf"
     replace_web_config

+ 7 - 7
bin/v_change_web_domain_sslcert

@@ -44,7 +44,7 @@ is_web_domain_valid
 is_domain_suspended 'web'
 
 # Check SSL is added
-is_web_domain_value_exist '$SSL_CERT'
+is_web_domain_value_exist '$SSL'
 
 # Checking ssl certificate
 is_web_domain_cert_valid
@@ -58,8 +58,8 @@ is_web_domain_cert_valid
 get_web_domain_values
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
 conf="$V_HOME/$user/conf/shttpd.conf"
-old_ssl="$SSL_CERT"
-SSL_CERT="$ssl"
+old_ssl="$SSL"
+SSL="$ssl"
 
 # Preparing domain values for the template substitution
 upd_web_domain_values
@@ -78,11 +78,11 @@ if [ ! -z "$NGINX" ]; then
 fi
 
 # Adding new certificate to user dir
-cp -f $V_USERS/$user/cert/$SSL_CERT.crt $ssl_cert
-cp -f $V_USERS/$user/cert/$SSL_CERT.key $ssl_key
+cp -f $V_USERS/$user/cert/$SSL.crt $ssl_cert
+cp -f $V_USERS/$user/cert/$SSL.key $ssl_key
 
 # Deleting old certificate
-check_cert=$(grep "SSL_CERT='$old_ssl'" $V_USERS/$user/web.conf |wc -l)
+check_cert=$(grep "SSL='$old_ssl'" $V_USERS/$user/web.conf |wc -l)
 if [ "$check_cert"  -lt 2 ]; then
     rm -f $V_HOME/$user/conf/$old_ssl.crt
     rm -f $V_HOME/$user/conf/$old_ssl.key
@@ -94,7 +94,7 @@ fi
 #----------------------------------------------------------#
 
 # Adding sslcert in config
-update_web_domain_value '$SSL_CERT' "$SSL_CERT"
+update_web_domain_value '$SSL' "$SSL"
 
 # Adding task to the vesta pipe
 restart_schedule 'web'

+ 1 - 1
bin/v_change_web_domain_sslhome

@@ -44,7 +44,7 @@ is_web_domain_valid
 is_domain_suspended 'web'
 
 # Check SSL is added
-is_web_domain_value_exist '$SSL_CERT'
+is_web_domain_value_exist '$SSL'
 
 
 #----------------------------------------------------------#

+ 4 - 4
bin/v_change_web_domain_tpl

@@ -62,7 +62,7 @@ conf="$V_HOME/$user/conf/httpd.conf"
 del_web_config
 
 # Deleting ssl vhost
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
@@ -139,10 +139,10 @@ if [ -x $V_WEBTPL/apache_$template.sh ]; then
 fi
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     # Defining variables for ssl template replace
-    ssl_cert="$V_HOME/$user/conf/$SSL_CERT.crt"
-    ssl_key="$V_HOME/$user/conf/$SSL_CERT.key"
+    ssl_cert="$V_HOME/$user/conf/$SSL.crt"
+    ssl_key="$V_HOME/$user/conf/$SSL.key"
     case $SSL_HOME in
         single) docroot="$V_HOME/$user/web/$domain/public_shtml" ;;
         same)   docroot="$V_HOME/$user/web/$domain/public_html" ;;

+ 7 - 7
bin/v_del_web_domain

@@ -57,16 +57,16 @@ conf="$V_HOME/$user/conf/httpd.conf"
 del_web_config
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
 
     # Deleting old certificate
-    check_cert=$(grep "SSL_CERT='$SSL_CERT'" $V_USERS/$user/web.conf |wc -l)
+    check_cert=$(grep "SSL='$SSL'" $V_USERS/$user/web.conf |wc -l)
     if [ "$check_cert" -lt 2 ]; then
-        rm -f $V_HOME/$user/conf/$SSL_CERT.crt
-        rm -f $V_HOME/$user/conf/$SSL_CERT.key
+        rm -f $V_HOME/$user/conf/$SSL.crt
+        rm -f $V_HOME/$user/conf/$SSL.key
     fi
 
 fi
@@ -77,7 +77,7 @@ if [ ! -z "$NGINX" ]; then
     conf="$V_HOME/$user/conf/nginx.conf"
     del_web_config
 
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
         conf="$V_HOME/$user/conf/snginx.conf"
@@ -117,7 +117,7 @@ rm -rf /var/log/httpd/domains/$domain.error*
 del_web_domain
 
 # Checking last ssl domain
-ssl_dom=$(grep -v "SSL_CERT=''" $V_USERS/$user/web.conf | wc -l)
+ssl_dom=$(grep -v "SSL=''" $V_USERS/$user/web.conf | wc -l)
 if [ "$ssl_dom" -eq '0' ]; then
     sed -i "s/ Include /#Include /"  $V_HOME/$user/conf/httpd.conf
 fi
@@ -135,7 +135,7 @@ fi
 # Checking last nginx domain
 conf='/etc/nginx/conf.d/vesta_users.conf'
 last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
-last_snginx=$(echo "$last_nginx" | grep -v "SSL_CERT=''")
+last_snginx=$(echo "$last_nginx" | grep -v "SSL=''")
 if [ -z "$last_snginx" ]; then
     sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : )
     if [ ! -z "$sline" ]; then

+ 2 - 2
bin/v_del_web_domain_alias

@@ -73,7 +73,7 @@ upd_web_domain_values
 del_web_config
 add_web_config
 
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
@@ -87,7 +87,7 @@ if [ ! -z "$NGINX" ]; then
     del_web_config
     add_web_config
 
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
         conf="$V_HOME/$user/conf/snginx.conf"

+ 1 - 1
bin/v_del_web_domain_cgi

@@ -63,7 +63,7 @@ del_web_config
 add_web_config
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config

+ 2 - 2
bin/v_del_web_domain_elog

@@ -64,7 +64,7 @@ del_web_config
 add_web_config
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
@@ -78,7 +78,7 @@ if [ ! -z "$NGINX" ]; then
     del_web_config
     add_web_config
 
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
         conf="$V_HOME/$user/conf/snginx.conf"

+ 2 - 2
bin/v_del_web_domain_nginx

@@ -57,7 +57,7 @@ conf="$V_HOME/$user/conf/nginx.conf"
 del_web_config
 
 # Checking ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
     conf="$V_HOME/$user/conf/snginx.conf"
     del_web_config
@@ -75,7 +75,7 @@ update_web_domain_value '$NGINX_EXT' ''
 # Checking last nginx domain
 conf='/etc/nginx/conf.d/vesta_users.conf'
 last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
-last_snginx=$(echo "$last_nginx" | grep -v "SSL_CERT=''")
+last_snginx=$(echo "$last_nginx" | grep -v "SSL=''")
 if [ -z "$last_snginx" ]; then
     sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : )
     if [ ! -z "$sline" ]; then

+ 7 - 7
bin/v_del_web_domain_ssl

@@ -43,7 +43,7 @@ is_web_domain_valid
 is_domain_suspended 'web'
 
 # Checking ssl is added
-is_web_domain_value_exist '$SSL_CERT'
+is_web_domain_value_exist '$SSL'
 
 
 #----------------------------------------------------------#
@@ -54,7 +54,7 @@ is_web_domain_value_exist '$SSL_CERT'
 get_web_domain_values
 conf="$V_HOME/$user/conf/shttpd.conf"
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-old_ssl="$SSL_CERT"
+old_ssl="$SSL"
 
 # Deleting domain
 del_web_config
@@ -67,7 +67,7 @@ if [ ! -z "$NGINX" ]; then
 fi
 
 # Deleting old certificate
-check_cert=$(grep "SSL_CERT='$old_ssl'" $V_USERS/$user/web.conf |wc -l)
+check_cert=$(grep "SSL='$old_ssl'" $V_USERS/$user/web.conf |wc -l)
 if [ "$check_cert"  -lt 2 ]; then
     rm -f $V_HOME/$user/conf/$old_ssl.crt
     rm -f $V_HOME/$user/conf/$old_ssl.key
@@ -79,11 +79,11 @@ fi
 #----------------------------------------------------------#
 
 # Deleting ssl in config
+update_web_domain_value '$SSL' ''
 update_web_domain_value '$SSL_HOME' ''
-update_web_domain_value '$SSL_CERT' ''
 
 # Checking last ssl domain
-ssl_dom=$(grep -v "SSL_CERT=''" $V_USERS/$user/web.conf)
+ssl_dom=$(grep -v "SSL=''" $V_USERS/$user/web.conf)
 main_conf='/etc/httpd/conf.d/vesta.conf'
 conf="$V_HOME/$user/conf/shttpd.conf"
 if [ -z "$ssl_dom" ]; then
@@ -94,7 +94,7 @@ fi
 # Checking last nginx domain
 conf='/etc/nginx/conf.d/vesta_users.conf'
 last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
-last_snginx=$(echo "$last_nginx" | grep -v "SSL_CERT=''")
+last_snginx=$(echo "$last_nginx" | grep -v "SSL=''")
 if [ -z "$last_snginx" ]; then
     sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : )
     if [ ! -z "$sline" ]; then
@@ -110,7 +110,7 @@ decrease_user_value "$user" '$U_WEB_SSL'
 restart_schedule 'web'
 
 # Logging
-log_history "$V_EVENT" "v_add_web_domain_ssl $user $domain $SSL_CERT $SSL_HOME"
+log_history "$V_EVENT" "v_add_web_domain_ssl $user $domain $SSL $SSL_HOME"
 log_event 'system' "$V_EVENT"
 
 exit

+ 1 - 1
bin/v_list_web_domain

@@ -96,7 +96,7 @@ conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
 fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS
- $STATS_AUTH $SSL_HOME $SSL_CERT $NGINX $NGINX_EXT $SUSPEND $DATE'
+ $STATS_AUTH $SSL $SSL_HOME $NGINX $NGINX_EXT $SUSPEND $DATE'
 
 # Listing domains
 case $format in 

+ 1 - 1
bin/v_list_web_domains

@@ -37,7 +37,7 @@ conf=$V_USERS/$user/web.conf
 
 # Defining fileds to select
 fields="\$DOMAIN \$IP \$U_DISK \$U_BANDWIDTH \$TPL \$ALIAS \$PHP \$CGI \$ELOG"
-fields="$fields \$STATS \$STATS_AUTH \$SSL_HOME \$SSL_CERT \$NGINX \$NGINX_EXT"
+fields="$fields \$STATS \$STATS_AUTH \$SSL \$SSL_HOME \$NGINX \$NGINX_EXT"
 fields="$fields \$SUSPEND \$DATE"
 
 # Listing domains

+ 1 - 1
bin/v_list_web_domains_ssl

@@ -36,7 +36,7 @@ is_user_valid
 conf="$V_USERS/$user/web.conf"
 
 # Defining fileds to select
-fields="\$DOMAIN \$SSL_HOME \$SSL_CERT"
+fields="\$DOMAIN \$SSL \$SSL_HOME"
 
 # Listing domains
 case $format in 

+ 2 - 2
bin/v_rebuild_web_domains

@@ -70,7 +70,7 @@ for domain in $(shell_list) ; do
     fi
 
     # Checking ssl
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         # Adding domain to the shttpd.conf
         conf="$V_HOME/$user/conf/tmp_shttpd.conf"
         tpl_file="$V_WEBTPL/apache_$TPL.stpl"
@@ -90,7 +90,7 @@ for domain in $(shell_list) ; do
         conf="$V_HOME/$user/conf/tmp_nginx.conf"
         add_web_config
 
-        if [ ! -z "$SSL_CERT" ]; then
+        if [ ! -z "$SSL" ]; then
             if [ "$SUSPEND" = 'yes' ]; then
                 proxy_string="rewrite ^(.*)\$ http://$url;"
             else

+ 2 - 2
bin/v_suspend_web_domain

@@ -61,7 +61,7 @@ del_web_config
 add_web_config
 
 # Check ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
@@ -75,7 +75,7 @@ if [ ! -z "$NGINX" ]; then
     del_web_config
     add_web_config
 
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         proxy_string="rewrite ^(.*)\$ http://$url;"
         tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
         conf="$V_HOME/$user/conf/snginx.conf"

+ 2 - 2
bin/v_unsuspend_web_domain

@@ -58,7 +58,7 @@ del_web_config
 add_web_config
 
 # Check ssl
-if [ ! -z "$SSL_CERT" ]; then
+if [ ! -z "$SSL" ]; then
     tpl_file="$V_WEBTPL/apache_$TPL.stpl"
     conf="$V_HOME/$user/conf/shttpd.conf"
     del_web_config
@@ -72,7 +72,7 @@ if [ ! -z "$NGINX" ]; then
     del_web_config
     add_web_config
 
-    if [ ! -z "$SSL_CERT" ]; then
+    if [ ! -z "$SSL" ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
         conf="$V_HOME/$user/conf/snginx.conf"

+ 1 - 1
func/cert.func

@@ -65,7 +65,7 @@ is_cert_valid() {
 
 is_cert_used() {
     # Parsing config
-    check_cert=$(grep "SSL_CERT='$ssl'" $V_USERS/$user/web.conf)
+    check_cert=$(grep "SSL='$ssl'" $V_USERS/$user/*.conf)
 
     # Checking result
     if [ ! -z "$check_cert" ]; then

+ 5 - 5
func/domain.func

@@ -688,7 +688,7 @@ upd_web_domain_values() {
             else
                 alias_string="$alias_string\n    ServerAlias $server_alias"
             fi
-            (( ++j))
+            j=2
             server_alias=''
         fi
         if [ "$i" -eq 1 ]; then
@@ -699,10 +699,10 @@ upd_web_domain_values() {
             aliases_idn="$aliases_idn,$dalias"
             server_alias="$server_alias $dalias"
         fi
-        (( ++i))
+        i=2
     done
 
-    if [ "$j" -gt 1 ]; then
+    if [ $j -gt 1 ]; then
         alias_string="$alias_string\n    ServerAlias $server_alias"
     else
         alias_string="ServerAlias $server_alias"
@@ -733,8 +733,8 @@ upd_web_domain_values() {
     fi
 
     # Defining SSL vars
-    ssl_cert="$V_HOME/$user/conf/$SSL_CERT.crt"
-    ssl_key="$V_HOME/$user/conf/$SSL_CERT.key"
+    ssl_cert="$V_HOME/$user/conf/$SSL.crt"
+    ssl_key="$V_HOME/$user/conf/$SSL.key"
     case $SSL_HOME in
         single) docroot="$V_HOME/$user/web/$domain/public_shtml" ;;
         same) docroot="$V_HOME/$user/web/$domain/public_html" ;;