Эх сурвалжийг харах

Merge branch 'master' into madeITBelgium-patch-1

Made I.T 9 жил өмнө
parent
commit
ab32c4b4c4
100 өөрчлөгдсөн 586 нэмэгдсэн , 544 устгасан
  1. 16 23
      bin/v-add-dns-domain
  2. 17 10
      bin/v-add-dns-record
  3. 8 10
      bin/v-add-domain
  4. 6 0
      bin/v-add-letsencrypt-domain
  5. 7 4
      bin/v-add-mail-account
  6. 5 3
      bin/v-add-mail-account-alias
  7. 5 3
      bin/v-add-mail-account-autoreply
  8. 5 3
      bin/v-add-mail-account-forward
  9. 5 3
      bin/v-add-mail-account-fwd-only
  10. 7 11
      bin/v-add-mail-domain
  11. 5 3
      bin/v-add-mail-domain-antispam
  12. 5 3
      bin/v-add-mail-domain-antivirus
  13. 5 3
      bin/v-add-mail-domain-catchall
  14. 10 8
      bin/v-add-mail-domain-dkim
  15. 1 0
      bin/v-add-sys-sftp-jail
  16. 8 24
      bin/v-add-web-domain
  17. 17 19
      bin/v-add-web-domain-alias
  18. 2 4
      bin/v-add-web-domain-backend
  19. 5 2
      bin/v-add-web-domain-ftp
  20. 2 4
      bin/v-add-web-domain-proxy
  21. 24 11
      bin/v-add-web-domain-ssl
  22. 5 2
      bin/v-add-web-domain-stats
  23. 2 2
      bin/v-backup-user
  24. 5 2
      bin/v-change-dns-domain-exp
  25. 7 6
      bin/v-change-dns-domain-ip
  26. 7 6
      bin/v-change-dns-domain-soa
  27. 7 10
      bin/v-change-dns-domain-tpl
  28. 7 6
      bin/v-change-dns-domain-ttl
  29. 7 10
      bin/v-change-dns-record
  30. 7 7
      bin/v-change-dns-record-id
  31. 12 0
      bin/v-change-domain-owner
  32. 5 3
      bin/v-change-mail-account-password
  33. 5 3
      bin/v-change-mail-account-quota
  34. 6 5
      bin/v-change-mail-domain-catchall
  35. 2 4
      bin/v-change-sys-ip-nat
  36. 1 1
      bin/v-change-user-package
  37. 10 10
      bin/v-change-web-domain-backend-tpl
  38. 5 2
      bin/v-change-web-domain-ftp-password
  39. 5 2
      bin/v-change-web-domain-ftp-path
  40. 8 14
      bin/v-change-web-domain-ip
  41. 4 5
      bin/v-change-web-domain-name
  42. 7 7
      bin/v-change-web-domain-proxy-tpl
  43. 10 11
      bin/v-change-web-domain-sslcert
  44. 10 11
      bin/v-change-web-domain-sslhome
  45. 5 2
      bin/v-change-web-domain-stats
  46. 7 6
      bin/v-change-web-domain-tpl
  47. 4 1
      bin/v-check-letsencrypt-domain
  48. 2 4
      bin/v-delete-dns-domain
  49. 2 4
      bin/v-delete-dns-domains
  50. 2 4
      bin/v-delete-dns-domains-src
  51. 8 5
      bin/v-delete-dns-on-web-alias
  52. 7 6
      bin/v-delete-dns-record
  53. 8 10
      bin/v-delete-domain
  54. 5 3
      bin/v-delete-mail-account
  55. 5 3
      bin/v-delete-mail-account-alias
  56. 5 3
      bin/v-delete-mail-account-autoreply
  57. 6 6
      bin/v-delete-mail-account-forward
  58. 5 3
      bin/v-delete-mail-account-fwd-only
  59. 5 2
      bin/v-delete-mail-domain
  60. 5 3
      bin/v-delete-mail-domain-antispam
  61. 5 3
      bin/v-delete-mail-domain-antivirus
  62. 5 3
      bin/v-delete-mail-domain-catchall
  63. 1 1
      bin/v-delete-mail-domain-dkim
  64. 10 14
      bin/v-delete-web-domain
  65. 4 8
      bin/v-delete-web-domain-alias
  66. 7 6
      bin/v-delete-web-domain-backend
  67. 5 2
      bin/v-delete-web-domain-ftp
  68. 7 6
      bin/v-delete-web-domain-proxy
  69. 10 11
      bin/v-delete-web-domain-ssl
  70. 5 2
      bin/v-delete-web-domain-stats
  71. 5 9
      bin/v-delete-web-domains
  72. 5 2
      bin/v-get-dns-domain-value
  73. 5 2
      bin/v-get-mail-account-value
  74. 5 2
      bin/v-get-mail-domain-value
  75. 2 4
      bin/v-insert-dns-domain
  76. 2 4
      bin/v-insert-dns-record
  77. 2 4
      bin/v-insert-dns-records
  78. 2 4
      bin/v-rebuild-cron-jobs
  79. 2 4
      bin/v-rebuild-dns-domain
  80. 2 4
      bin/v-rebuild-dns-domains
  81. 4 8
      bin/v-rebuild-web-domains
  82. 12 0
      bin/v-restore-user
  83. 2 4
      bin/v-suspend-cron-job
  84. 2 4
      bin/v-suspend-cron-jobs
  85. 5 2
      bin/v-suspend-dns-domain
  86. 6 7
      bin/v-suspend-dns-record
  87. 8 10
      bin/v-suspend-domain
  88. 5 3
      bin/v-suspend-mail-account
  89. 4 3
      bin/v-suspend-mail-accounts
  90. 5 3
      bin/v-suspend-mail-domain
  91. 6 8
      bin/v-suspend-user
  92. 9 10
      bin/v-suspend-web-domain
  93. 5 9
      bin/v-suspend-web-domains
  94. 2 4
      bin/v-unsuspend-cron-job
  95. 2 4
      bin/v-unsuspend-cron-jobs
  96. 5 3
      bin/v-unsuspend-dns-domain
  97. 5 6
      bin/v-unsuspend-dns-record
  98. 8 10
      bin/v-unsuspend-domain
  99. 5 3
      bin/v-unsuspend-mail-account
  100. 5 3
      bin/v-unsuspend-mail-accounts

+ 16 - 23
bin/v-add-dns-domain

@@ -15,15 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | sed -e 's/\.*$//g' -e 's/^\.*//g')
-if [[ "$domain" =~ [[:upper:]] ]]; then
-    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
-fi
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+domain=$2
+domain_idn=$2
 ip=$3
 ns1=$4
 ns2=$5
@@ -40,6 +33,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -56,37 +53,35 @@ template=$(get_user_value '$DNS_TEMPLATE')
 is_dns_template_valid $template
 
 if [ ! -z "$ns1" ]; then
-    ns1=$(echo $4 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns1=$(echo $4 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns1'
 fi
 if [ ! -z "$ns2" ]; then
-    ns2=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns2=$(echo $5 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns2'
 fi
-
 if [ ! -z "$ns3" ]; then
-    ns3=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns3=$(echo $6 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns3'
 fi
 if [ ! -z "$ns4" ]; then
-    ns4=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns4=$(echo $7 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns4'
 fi
 if [ ! -z "$ns5" ]; then
-    ns5=$(echo $8 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns5=$(echo $8 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns5'
 fi
 if [ ! -z "$ns6" ]; then
-    ns6=$(echo $9 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns6=$(echo $9 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns6'
 fi
 if [ ! -z "$ns7" ]; then
-    ns7=$(echo ${10} | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns7=$(echo ${10} |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns7'
 fi
-
 if [ ! -z "$ns8" ]; then
-    ns8=$(echo ${11} | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns8=$(echo ${11} |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns8'
 fi
 
@@ -203,10 +198,8 @@ increase_user_value "$user" '$U_DNS_DOMAINS'
 increase_user_value "$user" '$U_DNS_RECORDS' "$records"
 
 # Restart named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed"
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed"
 
 # Logging
 log_history "added dns domain $domain"

+ 17 - 10
bin/v-add-dns-record

@@ -26,11 +26,6 @@ if [ -z "$priority" ]; then
     priority=10
 fi
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
@@ -44,7 +39,7 @@ fi
 # Add trailing dot at the end of NS/CNAME/MX/PTR/SRV record
 if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then
     trailing_dot=$(echo $dvalue | grep "\.$")
-    if [ -z $trailing_dot ]; then
+    if [ -z "$trailing_dot" ]; then
         dvalue="$dvalue."
     fi
 fi
@@ -55,6 +50,10 @@ if [[ "$dvalue" =~ [\;[:space:]] ]]; then
     dvalue='"'"$dvalue"'"'
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -110,6 +109,16 @@ if [ ! -z "$DNS_CLUSTER" ]; then
     fi
 fi
 
+# remove trailing dot at the end of NS/CNAME/MX/PTR/SRV record
+
+if [[ $rtype =~ NS|CNAME|MX|PTR|SRV ]]; then
+    trailing_dot2=$(echo $record | grep "\.$")
+    if [ ! -z $trailing_dot2 ]; then
+        record=$(echo "${record::-1}")
+    fi
+fi
+
+
 
 #----------------------------------------------------------#
 #                       Vesta                              #
@@ -121,10 +130,8 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
 increase_user_value "$user" '$U_DNS_RECORDS'
 
 # Restart named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? $E_RESTART 'dns failed to restart'
-fi
+$BIN/v-restart-dns $restart
+check_result $? $E_RESTART 'dns failed to restart'
 
 # Logging
 log_history "added $rtype dns record $record for $domain"

+ 8 - 10
bin/v-add-domain

@@ -64,16 +64,14 @@ if [ ! -z "$MAIL_SYSTEM" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 6 - 0
bin/v-add-letsencrypt-domain

@@ -51,6 +51,7 @@ get_domain_values 'web'
 # Registering LetsEncrypt user account
 $BIN/v-add-letsencrypt-user $user
 if [ "$?" -ne 0  ]; then
+    touch $VESTA/data/queue/letsencrypt.pipe
     sed -i "/ $domain /d" $VESTA/data/queue/letsencrypt.pipe
     send_notice "LETSENCRYPT" "Account registration failed"
     check_result $E_CONNECT "LE account registration" >/dev/null
@@ -65,6 +66,7 @@ i=1
 for alias in $(echo $domain,$aliases |tr ',' '\n' |sort -u); do
     $BIN/v-check-letsencrypt-domain $user $alias
     if [ "$?" -ne 0 ]; then
+        touch $VESTA/data/queue/letsencrypt.pipe
         sed -i "/ $domain /d" $VESTA/data/queue/letsencrypt.pipe
         send_notice "LETSENCRYPT" "$alias validation failed"
         check_result $E_INVALID "LE domain validation" >/dev/null
@@ -72,6 +74,7 @@ for alias in $(echo $domain,$aliases |tr ',' '\n' |sort -u); do
 
     # Checking LE limits per account
     if [ "$i" -gt 100 ]; then
+        touch $VESTA/data/queue/letsencrypt.pipe
         sed -i "/ $domain /d" $VESTA/data/queue/letsencrypt.pipe
         send_notice 'LETSENCRYPT' 'Limit of domains per account is reached'
         check_result $E_LIMIT "LE can't sign more than 100 domains"
@@ -86,6 +89,7 @@ ssl_dir=$($BIN/v-generate-ssl-cert "$domain" "$email" "US" "California" \
 # Signing CSR
 crt=$($BIN/v-sign-letsencrypt-csr $user $domain $ssl_dir)
 if [ "$?" -ne 0 ]; then
+    touch $VESTA/data/queue/letsencrypt.pipe
     sed -i "/ $domain /d" $VESTA/data/queue/letsencrypt.pipe
     send_notice "LETSENCRYPT" "$alias validation failed"
     check_result "$E_INVALID" "LE $domain validation"
@@ -107,6 +111,7 @@ fi
 $BIN/v-delete-web-domain-ssl $user $domain >/dev/null 2>&1
 $BIN/v-add-web-domain-ssl $user $domain $ssl_dir
 if [ "$?" -ne '0' ]; then
+    touch $VESTA/data/queue/letsencrypt.pipe
     sed -i "/ $domain /d" $VESTA/data/queue/letsencrypt.pipe
     send_notice 'LETSENCRYPT' "$domain certificate installation failed"
     check_result $? "SSL install" >/dev/null
@@ -141,6 +146,7 @@ fi
 send_notice 'LETSENCRYPT' "$domain SSL has been installed successfully"
 
 # Deleteing task from queue
+touch $VESTA/data/queue/letsencrypt.pipe
 sed -i "/ $domain /d" $VESTA/data/queue/letsencrypt.pipe
 
 # Logging

+ 7 - 4
bin/v-add-mail-account

@@ -11,10 +11,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
-account=$(echo $3 | tr '[:upper:]' '[:lower:]')
+domain=$2
+account=$3
 password=$4; HIDE=4
 quota=${5-unlimited}
 
@@ -23,6 +21,11 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+if [[ "$account" =~ [[:upper:]] ]]; then
+    account=$(echo "$account" |tr '[:upper:]' '[:lower:]')
+fi
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-alias

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 malias=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-autoreply

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 autoreply=$4
 
@@ -29,6 +27,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-forward

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 forward=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-fwd-only

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -28,6 +26,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 11
bin/v-add-mail-domain

@@ -11,15 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | sed -e 's/\.*$//g' -e 's/^\.*//g')
-if [[ "$domain" =~ [[:upper:]] ]]; then
-    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
-fi
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+domain=$2
 antispam=${3-yes}
 antivirus=${4-yes}
 dkim=${5-yes}
@@ -37,6 +29,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -123,10 +119,10 @@ if [ ! -z "$DNS_SYSTEM" ] && [ "$dkim" = 'yes' ]; then
         p=$(cat $USER_DATA/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
         record='_domainkey'
         policy="\"t=y; o=~;\""
-        $BIN/v-add-dns-record $user $domain $record TXT "$policy"
+        $BIN/v-add-dns-record $user $domain $record TXT "$policy" '' '' 'no'
 
         record='mail._domainkey'
-        selector="\"k=rsa\; p=$p\""
+        selector="\"v=DKIM1\; k=rsa\; p=$p\""
         $BIN/v-add-dns-record $user $domain $record TXT "$selector"
     fi
 fi

+ 5 - 3
bin/v-add-mail-domain-antispam

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-domain-antivirus

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-domain-catchall

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 email="$3"
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 10 - 8
bin/v-add-mail-domain-dkim

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 dkim_size=${3-1024}
 
 # Includes
@@ -28,6 +26,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -63,12 +65,12 @@ fi
 # Adding dns records
 if [ ! -z "$DNS_SYSTEM" ] && [ -e "$USER_DATA/dns/$domain.conf" ]; then
     p=$(cat $USER_DATA/mail/$domain.pub |grep -v ' KEY---' |tr -d '\n')
-    record="_domainkey.$domain_idn"
+    record="_domainkey"
     policy="\"t=y; o=~;\""
-    $BIN/v-add-dns-record $user $domain $record TXT "$policy"
+    $BIN/v-add-dns-record $user $domain $record TXT "$policy" '' '' 'no'
 
-    record="mail._domainkey.$domain_idn"
-    selector="\"k=rsa\; p=$p\""
+    record="mail._domainkey"
+    selector="\"v=DKIM1\; k=rsa\; p=$p\""
     $BIN/v-add-dns-record $user $domain $record TXT "$selector"
 fi
 
@@ -79,7 +81,7 @@ fi
 
 # Adding dkim in config
 update_object_value 'mail' 'DOMAIN' "$domain" '$DKIM' 'yes'
-increase_user_value "$user" '$U_MAIL_DKMI'
+increase_user_value "$user" '$U_MAIL_DKIM'
 
 # Logging
 log_history "enabled DKIM support for $domain"

+ 1 - 0
bin/v-add-sys-sftp-jail

@@ -45,6 +45,7 @@ fi
 
 # Enabling jailed sftp
 if [ -z "$sftp_i" ]; then
+    echo " " >> $config
     echo "Subsystem sftp internal-sftp" >> $config
     echo "Match Group sftp-only" >> $config
     echo "ChrootDirectory /chroot/%u" >> $config

+ 8 - 24
bin/v-add-web-domain

@@ -18,37 +18,23 @@
 # Argument definition
 user=$1
 domain=$2
+domain_idn=$2
 ip=$3
 restart=$4      # will be moved to the end soon
 aliases=$5
 proxy_ext=$6
 
-# Additional argument formatting
-if [[ "$domain" =~ [[:upper:]] ]]; then
-    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
-fi
-if [[ "$domain" =~ ^www\..* ]]; then
-    domain=$(echo "$domain" |sed -e "s/^www.//")
-fi
-if [[ "$domain" =~ .*\.$ ]]; then
-    domain=$(echo "$domain" |sed -e "s/\.$//")
-fi
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-if [ ! -z "$aliases" ] && [ "$aliases" != 'none' ]; then
-    aliases=$(echo $aliases |tr '[:upper:]' '[:lower:]' |tr ',' '\n')
-    aliases=$(echo "$aliases" |sed -e "s/\.$//" |sort -u |grep -v www.$domain)
-    aliases=$(echo "$aliases" |sed -e "/^$/d" |tr '\n' ',' |sed -e "s/,$//")
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+format_aliases
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -178,10 +164,8 @@ $BIN/v-restart-web $restart
 check_result $? "Web restart failed" >/dev/null
 
 # Restarting proxy server
-if [ ! -z "$PROXY_SYSTEM" ]; then
-    $BIN/v-restart-proxy $restart
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "added web domain $domain"

+ 17 - 19
bin/v-add-web-domain-alias

@@ -12,13 +12,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
-dom_alias=$(idn -t --quiet -u "$3" )
-dom_alias=$(echo $dom_alias | sed -e 's/\.*$//g' -e 's/^\.*//g')
-dom_alias=$(echo $dom_alias | tr '[:upper:]' '[:lower:]')
-dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
+domain=$2
+aliases=$3
 restart="$4"
 
 # Includes
@@ -27,6 +22,11 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+format_aliases
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -39,7 +39,7 @@ is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
 is_object_valid 'web' 'DOMAIN' "$domain"
 is_object_unsuspended 'web' 'DOMAIN' "$domain"
-is_domain_new 'web' "$dom_alias"
+is_domain_new 'web' "$aliases"
 is_package_full 'WEB_ALIASES'
 
 
@@ -53,9 +53,9 @@ get_domain_values 'web'
 # Preparing domain values for the template substitution
 local_ip=$(get_real_ip $IP)
 if [ -z "$ALIAS" ]; then
-    ALIAS="$dom_alias"
+    ALIAS="$aliases"
 else
-    ALIAS="$ALIAS,$dom_alias"
+    ALIAS="$ALIAS,$aliases"
 fi
 prepare_web_domain_values
 
@@ -87,17 +87,15 @@ update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
 increase_user_value "$user" '$U_WEB_ALIASES'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+# Restarting proxy server
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
 
-log_history "added $dom_alias as alias for $domain"
+log_history "added $aliases for $domain"
 log_event "$OK" "$ARGUMENTS"
 
 exit

+ 2 - 4
bin/v-add-web-domain-backend

@@ -67,10 +67,8 @@ cat $WEBTPL/$WEB_BACKEND/$template.tpl |\
 #----------------------------------------------------------#
 
 # Restart backend server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web-backend
-    check_result $? "Web backend restart failed" >/dev/null
-fi
+$BIN/v-restart-web-backend $restart
+check_result $? "Web backend restart failed" >/dev/null
 
 # Logging
 log_history "added $WEB_BACKEND backend configuration for $domain"

+ 5 - 2
bin/v-add-web-domain-ftp

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=${1}_${3}
 password=$4; HIDE=4
 ftp_path=$5
@@ -22,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 4
bin/v-add-web-domain-proxy

@@ -72,10 +72,8 @@ update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$template"
 update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions"
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-proxy
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 log_history "enabled proxy support for $domain"
 log_event "$OK" "$ARGUMENTS"

+ 24 - 11
bin/v-add-web-domain-ssl

@@ -16,18 +16,35 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ssl_dir=$3
 ssl_home=${4-same}
 restart="$5"
 
+# Additional argument formatting
+if [[ "$domain" =~ [[:upper:]] ]]; then
+    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
+fi
+if [[ "$domain" =~ ^www\..* ]]; then
+    domain=$(echo "$domain" |sed -e "s/^www.//")
+fi
+if [[ "$domain" =~ .*\.$ ]]; then
+    domain=$(echo "$domain" |sed -e "s/\.$//")
+fi
+
+domain=$(idn -t --quiet -u "$domain" )
+domain_idn=$(idn -t --quiet -a "$domain")
+
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -97,15 +114,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
 update_object_value 'web' 'DOMAIN' "$domain" '$SSL' "yes"
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "enabled ssl support for $domain"

+ 5 - 2
bin/v-add-web-domain-stats

@@ -15,8 +15,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 type=$3
 
 # Includes
@@ -24,6 +23,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 2
bin/v-backup-user

@@ -137,7 +137,7 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
         mkdir -p $tmpdir/web/$domain/vesta
 
         # Get domain variables
-        domain_idn=$(idn -t --quiet -a "$domain")
+        format_domain_idn
         get_domain_values 'web'
 
         # Backup web.conf
@@ -286,7 +286,7 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
         echo -e "$(date "+%F %T") $domain" |tee -a $BACKUP/$user.log
         mkdir -p $tmpdir/mail/$domain/conf
         mkdir -p $tmpdir/mail/$domain/vesta
-        domain_idn=$(idn -t --quiet -a "$domain")
+        format_domain_idn
 
         # Backup exim config
         if [[ "$MAIL_SYSTEM" =~ exim ]]; then

+ 5 - 2
bin/v-change-dns-domain-exp

@@ -12,14 +12,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 exp=$3
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 6
bin/v-change-dns-domain-ip

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ip=$3
 restart=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,10 +74,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns ip for $domain to $ip"

+ 7 - 6
bin/v-change-dns-domain-soa

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 soa=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
 restart=$4
 
@@ -22,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -65,10 +68,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed soa record for $domain to $soa"

+ 7 - 10
bin/v-change-dns-domain-tpl

@@ -13,20 +13,19 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
+domain=$2
 template=$3
 restart=$4
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -121,10 +120,8 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$TPL' "$template"
 update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns template for $domain to $template" '' 'admin'

+ 7 - 6
bin/v-change-dns-domain-ttl

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ttl=$3
 restart=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -64,10 +67,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed TTL for $domain to $ttl"

+ 7 - 10
bin/v-change-dns-record

@@ -11,22 +11,21 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
+domain=$2
 id=$3
 dvalue=$(idn -t --quiet -u "$4" )
 priority=$5
 restart=$6
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -105,10 +104,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns record on $domain to $dvalue"

+ 7 - 7
bin/v-change-dns-record-id

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 id=$3
 newid=$4
 restart=$5
@@ -23,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,10 +73,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns record id on $domain"

+ 12 - 0
bin/v-change-domain-owner

@@ -148,6 +148,18 @@ if [ ! -z "$mail_data" ]; then
     $BIN/v-unsuspend-mail-domain $user $domain no >> /dev/null 2>&1
     $BIN/v-rebuild-mail-domains $owner no
     $BIN/v-rebuild-mail-domains $user
+
+    # Checking exim username for later chowning
+    exim_user="exim";
+    check_exim_username=$(grep -c '^Debian-exim:' /etc/passwd)
+    if [ "$check_exim_username" -eq 1 ]; then
+        exim_user="Debian-exim"
+    fi
+    # Chowning mail conf files to exim user
+    if [ -d "$HOMEDIR/$user/conf/mail/$domain" ]; then
+        find $HOMEDIR/$user/conf/mail/$domain -user root \
+            -exec chown $exim_user {} \;
+    fi
 fi
 
 # Update counters

+ 5 - 3
bin/v-change-mail-account-password

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 password=$4; HIDE=4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-change-mail-account-quota

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 quota=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 5
bin/v-change-mail-domain-catchall

@@ -11,16 +11,18 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
-email="$3"
+domain=$2
+email=$3
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -53,7 +55,6 @@ fi
 # Change catchall in config
 update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' "$email"
 
-
 # Logging
 log_history "changed catchall email for $domain to $email"
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-change-sys-ip-nat

@@ -73,10 +73,8 @@ fi
 #----------------------------------------------------------#
 
 # Restart ftp server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-ftp
-    check_result $? "FTP restart failed" >/dev/null
-fi
+$BIN/v-restart-ftp $restart
+check_result $? "FTP restart failed" >/dev/null
 
 # Logging
 log_history "changed associated nat address on $ip to $nat_ip" '' 'admin'

+ 1 - 1
bin/v-change-user-package

@@ -43,7 +43,7 @@ is_package_avalable() {
             check_result $E_LIMIT "Package doesn't cover WEB_DOMAIN usage"
         fi
     fi
-    if [ "$DNS_DOMAINS" ! = 'unlimited' ]; then
+    if [ "$DNS_DOMAINS" != 'unlimited' ]; then
         if [ "$DNS_DOMAINS" -lt "$U_DNS_DOMAINS" ]; then
             check_result $E_LIMIT "Package doesn't cover DNS_DOMAIN usage"
         fi

+ 10 - 10
bin/v-change-web-domain-backend-tpl

@@ -11,11 +11,9 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 template=$3
-restart="$4"
-
+restart=$4
 
 # Includes
 source $VESTA/func/main.sh
@@ -23,6 +21,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -143,13 +145,11 @@ fi
 
 
 # Restarting web
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    $BIN/v-restart-web-backend
-    check_result $? "Web backend restart failed" >/dev/null
-fi
+$BIN/v-restart-web-backend $restart
+check_result $? "Web backend restart failed" >/dev/null
 
 # Logging
 log_history "changed backend template for $domain to $template"

+ 5 - 2
bin/v-change-web-domain-ftp-password

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=$3
 password=$4; HIDE=4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-change-web-domain-ftp-path

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=$3
 ftp_path=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 8 - 14
bin/v-change-web-domain-ip

@@ -21,6 +21,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -44,12 +48,6 @@ is_ip_valid "$ip" "$user"
 get_domain_values 'web'
 old=$(get_real_ip $IP)
 new=$ip
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-else
-    domain_idn=$domain
-fi
-
 
 # Replacing vhost
 replace_web_config "$WEB_SYSTEM" "$TPL.tpl"
@@ -78,15 +76,11 @@ decrease_ip_value "$old"
 update_object_value 'web' 'DOMAIN' "$domain" '$IP' "$3"
 
 # Restart web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "WEB restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "WEB restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed web domain $domain ip to $3"

+ 4 - 5
bin/v-change-web-domain-name

@@ -15,17 +15,16 @@ domain=$2
 new_domain=$3
 restart=$4
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 7
bin/v-change-web-domain-proxy-tpl

@@ -11,21 +11,23 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 template=$3
 default_extentions="jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,\
 exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm"
 extentions=${4-$default_extentions}
 restart="$5"
 
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -75,10 +77,8 @@ update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$PROXY"
 update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions"
 
 # Restarting proxy
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-proxy
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed proxy template for $domain to $template"

+ 10 - 11
bin/v-change-web-domain-sslcert

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ssl_dir=$3
 restart=$4
 
@@ -22,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,15 +74,11 @@ fi
 #----------------------------------------------------------#
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed ssl certificate for $domain"

+ 10 - 11
bin/v-change-web-domain-sslhome

@@ -7,8 +7,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ssl_home=$3
 restart=$4
 
@@ -17,6 +16,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -67,15 +70,11 @@ fi
 update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed ssl home for $domain to $ssl_home"

+ 5 - 2
bin/v-change-web-domain-stats

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 type=$3
 
 # Includes
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 6
bin/v-change-web-domain-tpl

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 template=$3
 restart=$4
 
@@ -23,6 +22,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -68,10 +71,8 @@ fi
 update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template"
 
 # Restarting web
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
 # Logging
 log_history "changed web domain template for $domain to $template" '' 'admin'

+ 4 - 1
bin/v-check-letsencrypt-domain

@@ -97,7 +97,10 @@ if [ "$WEB_SYSTEM" = 'nginx' ] || [ "$PROXY_SYSTEM" = 'nginx' ]; then
     fi
 else
     acme="$HOMEDIR/$user/web/$r_domain/public_html/.well-known/acme-challenge"
-    echo "$token" > $acme/$token.$thumb
+    if [ ! -d "$acme" ]; then
+        mkdir -p $acme
+    fi
+    echo "$token.$thumb" > $acme/$token
     chown -R $user:$user $HOMEDIR/$user/web/$r_domain/public_html/.well-known
 fi
 

+ 2 - 4
bin/v-delete-dns-domain

@@ -72,10 +72,8 @@ decrease_user_value "$user" '$U_DNS_DOMAINS'
 decrease_user_value "$user" '$U_DNS_RECORDS' "$records"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns $restart
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_history "deleted dns domain $domain"

+ 2 - 4
bin/v-delete-dns-domains

@@ -43,10 +43,8 @@ done
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-delete-dns-domains-src

@@ -44,10 +44,8 @@ done
 #----------------------------------------------------------#
 
 # Restart named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 8 - 5
bin/v-delete-dns-on-web-alias

@@ -11,11 +11,10 @@
 
 # Argument definition
 user=$1
-domain=$(echo $2 | sed -e 's/\.*$//g' -e 's/^\.*//g')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 dom_alias=$(idn -t --quiet -u "$3" )
-dom_alias=$(echo $dom_alias | sed -e 's/\.*$//g' -e 's/^\.*//g')
-dom_alias=$(echo $dom_alias | tr '[:upper:]' '[:lower:]')
+dom_alias=$(echo $dom_alias |sed -e 's/\.*$//g' -e 's/^\.*//g')
+dom_alias=$(echo $dom_alias |tr '[:upper:]' '[:lower:]')
 dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
 restart="$4"
 
@@ -24,6 +23,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -63,7 +66,7 @@ else
         fi
         if [ ! -z "$rec" ]; then
             eval "$rec"
-            $BIN/v-delete-dns-record $user "$root" "$ID"
+            $BIN/v-delete-dns-record $user "$root" "$ID" $restart
         fi
     fi
 fi

+ 7 - 6
bin/v-delete-dns-record

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 id=$3
 restart=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -70,10 +73,8 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
 decrease_user_value "$user" '$U_DNS_RECORDS'
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_history "deleted dns record $id on $domain"

+ 8 - 10
bin/v-delete-domain

@@ -69,16 +69,14 @@ if [ -z "$domain_found" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 5 - 3
bin/v-delete-mail-account

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-account-alias

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 malias=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-account-autoreply

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 malias=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 6
bin/v-delete-mail-account-forward

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 forward=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -38,9 +40,7 @@ is_object_valid "mail/$domain" 'ACCOUNT' "$account"
 is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account"
 fwd=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD')
 if [ -z "$(echo $fwd | grep -w $forward)" ]; then
-    echo "Error: forward $forward doesn't exist"
-    log_event "$E_NOTEXIST $ARGUMENTS"
-    exit $E_NOTEXIST
+    check_result $E_NOTEXIST "forward $forward doesn't exist"
 fi
 
 

+ 5 - 3
bin/v-delete-mail-account-fwd-only

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-delete-mail-domain

@@ -12,14 +12,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-domain-antispam

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-domain-antivirus

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-domain-catchall

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 1 - 1
bin/v-delete-mail-domain-dkim

@@ -61,7 +61,7 @@ fi
 
 # Updatoing config
 update_object_value 'mail' 'DOMAIN' "$domain" '$DKIM' 'no'
-decrease_user_value "$user" '$U_MAIL_DKMI'
+decrease_user_value "$user" '$U_MAIL_DKIM'
 
 # Logging
 log_history "disabled DKIM support on $domain"

+ 10 - 14
bin/v-delete-web-domain

@@ -23,6 +23,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -48,10 +52,6 @@ fi
 
 # Parsing domain values
 get_domain_values 'web'
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
 local_ip=$(get_real_ip $IP)
 
 # Deleting domain from web.conf
@@ -121,16 +121,12 @@ if [ ! -z "$ALIAS" ]; then
 fi
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    # Restartinh proxy server
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+# Restartinh proxy server
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "deleted web domain $domain"

+ 4 - 8
bin/v-delete-web-domain-alias

@@ -81,15 +81,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
 decrease_user_value "$user" '$U_WEB_ALIASES'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "deleted alias $dom_alias on $domain"

+ 7 - 6
bin/v-delete-web-domain-backend

@@ -11,14 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -66,10 +69,8 @@ rm -f $pool/$backend_type.conf
 #----------------------------------------------------------#
 
 # Restarting backend server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web-backend
-    check_result $? "Backend restart failed" >/dev/null
-fi
+$BIN/v-restart-web-backend $restart
+check_result $? "Backend restart failed" >/dev/null
 
 # Logging
 log_history "deleting backend support for $domain"

+ 5 - 2
bin/v-delete-web-domain-ftp

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=$3
 
 # Includes
@@ -20,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 6
bin/v-delete-web-domain-proxy

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart=$3
 
 # Includes
@@ -20,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -58,10 +61,8 @@ update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' ''
 update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' ''
 
 # Restart proxy server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-proxy
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "disabled proxy support for $domain"

+ 10 - 11
bin/v-delete-web-domain-ssl

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart=$3
 
 # Includes
@@ -20,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,15 +74,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SSL' 'no'
 decrease_user_value "$user" '$U_WEB_SSL'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "disabled ssl support for $domain"

+ 5 - 2
bin/v-delete-web-domain-stats

@@ -12,14 +12,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 9
bin/v-delete-web-domains

@@ -43,15 +43,11 @@ done
 #----------------------------------------------------------#
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 2
bin/v-get-dns-domain-value

@@ -11,13 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
 
 # Includes
 source $VESTA/func/main.sh
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-get-mail-account-value

@@ -11,14 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 key=$(echo "$4"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
 
 # Includes
 source $VESTA/func/main.sh
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-get-mail-domain-value

@@ -11,13 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
 
 # Includes
 source $VESTA/func/main.sh
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 4
bin/v-insert-dns-domain

@@ -74,10 +74,8 @@ chmod 660 $USER_DATA/dns.conf
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns $restart
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-insert-dns-record

@@ -45,10 +45,8 @@ echo "$data" >> $USER_DATA/dns/$domain.conf
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns $restart
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-insert-dns-records

@@ -48,10 +48,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-rebuild-cron-jobs

@@ -41,10 +41,8 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-rebuild-dns-domain

@@ -82,10 +82,8 @@ update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
 update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns "$restart"
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-rebuild-dns-domains

@@ -83,10 +83,8 @@ update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
 update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 4 - 8
bin/v-rebuild-web-domains

@@ -75,15 +75,11 @@ done
 $BIN/v-update-user-counters $user
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 12 - 0
bin/v-restore-user

@@ -517,6 +517,13 @@ if [ "$mail" != 'no' ] && [ ! -z "$MAIL_SYSTEM" ]; then
         domains=$(echo "$backup_domains" |egrep -f $tmpdir/selected.txt)
     fi
 
+    # Checking exim username for later chowning
+    exim_user="exim";
+    check_exim_username=$(grep -c '^Debian-exim:' /etc/passwd)
+    if [ "$check_exim_username" -eq 1 ]; then
+        exim_user="Debian-exim"
+    fi
+
     # Restoring dns domain
     for domain in $domains; do
         echo -e "$(date "+%F %T") $domain" |tee -a $tmpdir/restore.log
@@ -579,6 +586,11 @@ if [ "$mail" != 'no' ] && [ ! -z "$MAIL_SYSTEM" ]; then
                     -exec chown -h $user:mail {} \;
             fi
         fi
+
+        # Chowning mail conf files to exim user
+        find $HOMEDIR/$user/conf/mail/$domain_idn -user root \
+            -exec chown $exim_user {} \;
+
     done
 fi
 

+ 2 - 4
bin/v-suspend-cron-job

@@ -47,10 +47,8 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-suspend-cron-jobs

@@ -42,10 +42,8 @@ done
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 2
bin/v-suspend-dns-domain

@@ -11,14 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart="$3"
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 7
bin/v-suspend-dns-record

@@ -11,20 +11,19 @@
 
 # Argument definition
 user=$1
-domain="$2"
+domain=$2
 id=$3
-restart="$4"
-
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+restart=$4
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 8 - 10
bin/v-suspend-domain

@@ -71,16 +71,14 @@ if [ -z "$domain_found" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restat
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 5 - 3
bin/v-suspend-mail-account

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 4 - 3
bin/v-suspend-mail-accounts

@@ -11,14 +11,15 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-suspend-mail-domain

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 8
bin/v-suspend-user

@@ -74,16 +74,14 @@ fi
 #----------------------------------------------------------#
 
 # Restarting system services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Changing suspend value
 update_user_value "$user" '$SUSPENDED' 'yes'

+ 9 - 10
bin/v-suspend-web-domain

@@ -13,8 +13,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart=$3
 
 # Includes
@@ -23,6 +22,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -76,15 +79,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
 increase_user_value "$user" '$SUSPENDED_WEB'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 9
bin/v-suspend-web-domains

@@ -43,15 +43,11 @@ done
 #----------------------------------------------------------#
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-unsuspend-cron-job

@@ -47,10 +47,8 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-unsuspend-cron-jobs

@@ -42,10 +42,8 @@ done
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 3
bin/v-unsuspend-dns-domain

@@ -11,14 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
-restart="$3"
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 6
bin/v-unsuspend-dns-record

@@ -13,18 +13,17 @@
 user=$1
 domain=$2
 id=$3
-restart="$4"
-
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+restart=$4
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 8 - 10
bin/v-unsuspend-domain

@@ -70,16 +70,14 @@ if [ -z "$domain_found" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 5 - 3
bin/v-unsuspend-mail-account

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-unsuspend-mail-accounts

@@ -11,14 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно