Browse Source

Merge branch 'main' into feature/user-roles

Kristan Kenney 5 years ago
parent
commit
2a7002f34a
100 changed files with 436 additions and 136 deletions
  1. 29 18
      CHANGELOG.md
  2. 1 1
      README.md
  3. 12 2
      bin/v-add-dns-domain
  4. 1 1
      bin/v-add-dns-on-web-alias
  5. 4 1
      bin/v-add-dns-record
  6. 1 1
      bin/v-add-domain
  7. 2 2
      bin/v-add-letsencrypt-domain
  8. 1 1
      bin/v-add-mail-account
  9. 4 1
      bin/v-add-mail-account-alias
  10. 4 1
      bin/v-add-mail-account-autoreply
  11. 1 1
      bin/v-add-mail-account-forward
  12. 3 1
      bin/v-add-mail-account-fwd-only
  13. 12 3
      bin/v-add-mail-domain
  14. 3 1
      bin/v-add-mail-domain-antispam
  15. 2 1
      bin/v-add-mail-domain-antivirus
  16. 2 1
      bin/v-add-mail-domain-catchall
  17. 4 1
      bin/v-add-mail-domain-dkim
  18. 1 1
      bin/v-add-mail-domain-smtp-relay
  19. 1 1
      bin/v-add-mail-domain-ssl
  20. 1 1
      bin/v-add-remote-dns-domain
  21. 1 1
      bin/v-add-remote-dns-record
  22. 1 1
      bin/v-add-sys-webmail
  23. 13 14
      bin/v-add-web-domain
  24. 4 2
      bin/v-add-web-domain-alias
  25. 2 1
      bin/v-add-web-domain-allow-users
  26. 1 1
      bin/v-add-web-domain-backend
  27. 1 1
      bin/v-add-web-domain-fast-cgi-cache
  28. 3 1
      bin/v-add-web-domain-ftp
  29. 1 1
      bin/v-add-web-domain-httpauth
  30. 1 1
      bin/v-add-web-domain-proxy
  31. 119 0
      bin/v-add-web-domain-redirect
  32. 1 1
      bin/v-add-web-domain-ssl
  33. 1 1
      bin/v-add-web-domain-ssl-force
  34. 1 1
      bin/v-add-web-domain-ssl-hsts
  35. 1 1
      bin/v-add-web-domain-ssl-preset
  36. 2 1
      bin/v-add-web-domain-stats
  37. 1 1
      bin/v-add-web-domain-stats-user
  38. 3 1
      bin/v-change-dns-domain-exp
  39. 3 2
      bin/v-change-dns-domain-ip
  40. 3 1
      bin/v-change-dns-domain-soa
  41. 2 1
      bin/v-change-dns-domain-tpl
  42. 2 1
      bin/v-change-dns-domain-ttl
  43. 2 1
      bin/v-change-dns-record
  44. 3 1
      bin/v-change-dns-record-id
  45. 1 1
      bin/v-change-domain-owner
  46. 3 1
      bin/v-change-mail-account-password
  47. 4 1
      bin/v-change-mail-account-quota
  48. 2 1
      bin/v-change-mail-domain-catchall
  49. 2 1
      bin/v-change-mail-domain-sslcert
  50. 1 1
      bin/v-change-remote-dns-domain-exp
  51. 1 1
      bin/v-change-remote-dns-domain-soa
  52. 1 1
      bin/v-change-remote-dns-domain-ttl
  53. 2 1
      bin/v-change-web-domain-backend-tpl
  54. 1 1
      bin/v-change-web-domain-dirlist
  55. 1 1
      bin/v-change-web-domain-docroot
  56. 2 1
      bin/v-change-web-domain-ftp-password
  57. 2 1
      bin/v-change-web-domain-ftp-path
  58. 1 1
      bin/v-change-web-domain-httpauth
  59. 4 1
      bin/v-change-web-domain-ip
  60. 3 2
      bin/v-change-web-domain-name
  61. 4 1
      bin/v-change-web-domain-proxy-tpl
  62. 3 1
      bin/v-change-web-domain-sslcert
  63. 4 1
      bin/v-change-web-domain-sslhome
  64. 2 1
      bin/v-change-web-domain-stats
  65. 2 1
      bin/v-change-web-domain-tpl
  66. 1 1
      bin/v-delete-dns-domain
  67. 1 1
      bin/v-delete-dns-domains-src
  68. 1 1
      bin/v-delete-dns-on-web-alias
  69. 2 1
      bin/v-delete-dns-record
  70. 1 1
      bin/v-delete-domain
  71. 1 1
      bin/v-delete-letsencrypt-domain
  72. 2 1
      bin/v-delete-mail-account
  73. 2 1
      bin/v-delete-mail-account-alias
  74. 2 1
      bin/v-delete-mail-account-autoreply
  75. 2 1
      bin/v-delete-mail-account-forward
  76. 2 1
      bin/v-delete-mail-account-fwd-only
  77. 2 1
      bin/v-delete-mail-domain
  78. 2 1
      bin/v-delete-mail-domain-antispam
  79. 2 1
      bin/v-delete-mail-domain-antivirus
  80. 2 1
      bin/v-delete-mail-domain-catchall
  81. 1 1
      bin/v-delete-mail-domain-dkim
  82. 1 1
      bin/v-delete-mail-domain-smtp-relay
  83. 1 1
      bin/v-delete-mail-domain-ssl
  84. 1 1
      bin/v-delete-remote-dns-domain
  85. 1 1
      bin/v-delete-remote-dns-record
  86. 1 1
      bin/v-delete-sys-webmail
  87. 4 1
      bin/v-delete-web-domain
  88. 2 2
      bin/v-delete-web-domain-alias
  89. 2 1
      bin/v-delete-web-domain-allow-users
  90. 2 1
      bin/v-delete-web-domain-backend
  91. 1 1
      bin/v-delete-web-domain-fast-cgi-cache
  92. 2 1
      bin/v-delete-web-domain-ftp
  93. 1 1
      bin/v-delete-web-domain-httpauth
  94. 2 1
      bin/v-delete-web-domain-proxy
  95. 76 0
      bin/v-delete-web-domain-redirect
  96. 2 1
      bin/v-delete-web-domain-ssl
  97. 1 1
      bin/v-delete-web-domain-ssl-force
  98. 1 1
      bin/v-delete-web-domain-ssl-hsts
  99. 1 1
      bin/v-delete-web-domain-stats
  100. 1 1
      bin/v-delete-web-domain-stats-user

+ 29 - 18
CHANGELOG.md

@@ -4,14 +4,16 @@ All notable changes to this project will be documented in this file.
 ## [DEVELOPMENT]
 ### Features
 - Introduced single sign-on support for phpMyAdmin.
-- Introduced support for NGINX Fast CGI Cache.
+- Introduced support for NGINX FastCGI cache.
 - Introduced support for SMTP Relay / smarthosts (server-wide or per-domain).
-- Introduced the ability to choose which webmail client to use per-domain (Roundcube or Rainloop)
+- Introduced the ability to choose which webmail client to use per-domain (Roundcube or Rainloop).
 - Added B2 Backup Support for Remote Backup Location - thanks **@rez0n**!
-- Added template support for osticket - thanks **@madito**!
-- Install phpMyAdmin directly from source and provide a migration script for existing installations.
+- Added template support for osTicket - thanks **@madito**!
+- Packages for phpMyAdmin, Roundcube, and Rainloop will be pulled directly from their upstream source instead of APT for new installations.
+- Added DNS records view to mail domains which provides DKIM, SPF, and other entries to use with an external provider.
 - Added an upgrade script to provide in-place upgrades to php7.4 (or any other version).
 
+
 ### Bugfixes
 - Fixed an issue where user name was duplicated when editing FTP users. (#1411)
 - Fixed an issue where the iptables service would appear to be in a stopped state when fail2ban is stopped. (#1374)
@@ -19,29 +21,38 @@ All notable changes to this project will be documented in this file.
 - Fixed an issue with the dark theme where available updates were incorrectly displayed.
 - Fixed an issue where local and FTP backup files were not deleted when running `v-delete-user-backup`. (#1421)
 - Fixed an issue where IP addresses could not be deleted. (#1423)
-- Fixed an issue where nginx web statistics authorization file was placed in the wrong directory.
-- Fixed multiple small issues in mail domain handling and webmail stack.
-- Fixed an issue which caused the custom docroot value to be not set when restoring a backup.
+- Fixed an issue where `v-rebuild-user` would incorrectly rebuild domain items in addition to user account configuration.
+- Fixed an issue which caused a web domain's custom document root value to be lost when restoring from backup.
 - Fixed an issue which caused a `NSPOSIXErrorDomain:100` error when using Safari/iOS (thanks **@stsimb**).
-- Fixed multiple small issues which occured when using PostgreSQL.
-- Fixed an issue where exim ignored the conigured mail quota limit.
-- Fixed an issue with the invalid character validation for mail auto replies.
-- Fixed an issue which caused Let's Encrypt to fail when using the Moodle template - thanks **@ArturoBlanco**.
+- Fixed an issue where exim ignored the configured mail quota limit.
+- Fixed an issue where invalid character validation was performed when editing mail auto replies.
+- Fixed an issue which caused Let's Encrypt to fail when using the Moodle template (thanks **@ArturoBlanco**).
 - Fixed an issue where the MySQL `wait_timeout` value was not saved due to wrong regexp attribute (thanks **@guicapanema**).
+- Fixed an issue where nginx web statistics authorization file was placed in the wrong directory.
+- Fixed several small issues that were reported when using PostgreSQL.
+- Improved reliability of mail domains and webmail clients.
+- Improved reliability of service restarts during upgrades.
 - Improved compatibility with Blesta / WHMCS plugins.
 - Improved API error handling routines - thanks **@danielalexis**!
-- Improved performance by enabling multithreading when creating backups using the `zstd` compression type.
+- Improved backup performance through the use of multi-threading when creating archives using the `zstd` compression type.
 - Improved error handling when creating firewall rules.
-- Improved overview to provide DKIM and other mail server settings in mail overview.
-- Improved removal handling to allow the remove of suspended users, domains, etc.
+- Improved handling of suspended users and domains to allow deletion without unsuspension.
 - Improved dependencies over package control to install `lsb-release` and `zstd`.
-- Improved SFTP connection handling, changing expect to be case insensitive in SFTP (thanks **@lazzurs**).
+- Improved SFTP connection handling to be case insensitive (thanks **@lazzurs**).
 - Improved domain validation to prevent creating subdomains when the top-level domain belongs to another account (thanks **@KuJoe** and **@sickcodes**).
 - Improved IDN domain handling to resolve issues with Let's Encrypt SSL and mail domain services.
-- Added private folder to openbasedir permission for all main templates.
+- Added private folder to openbasedir permissions for all main templates.
 - Disabled changing backup folder via Web UI because it used symbolic link instead of mount causing issues with restore mail / user files.
-- Fixed xss vulnerability in v-add-sys-ip and user history log (thanks **@numanturle**)
-- Fixed remote execution possibility when deleting ssh key (thanks **@numanturle**)
+- Fixed XSS vulnerability in `v-add-sys-ip` and user history log (thanks **@numanturle**).
+- Fixed remote code execution vulnerability which could occur when deleting SSH keys (thanks **@numanturle**).
+
+## [1.3.5] - Service Release
+### Features
+- No new features have been introduced in this release.
+
+### Bugfixes
+- Updated APT repository key for PHP from packages.sury.org (https://forum.hestiacp.com/t/apt-upgrade-failed-gpg-error-packages-sury-org)
+- Updated phpMyAdmin to v5.1.0.
 
 ## [1.3.4] - Service Release
 ### Features

+ 1 - 1
README.md

@@ -2,7 +2,7 @@
 
 [Hestia Control Panel](https://www.hestiacp.com/)
 ==================================================
-**Latest stable release:** Version 1.3.4 | [View Changelog](https://github.com/hestiacp/hestiacp/blob/release/CHANGELOG.md)<br>
+**Latest stable release:** Version 1.3.5 | [View Changelog](https://github.com/hestiacp/hestiacp/blob/release/CHANGELOG.md)<br>
 
 **Web:** [www.hestiacp.com](https://www.hestiacp.com/)<br>
 **Documentation:** [docs.hestiacp.com](https://docs.hestiacp.com/)<br>

+ 12 - 2
bin/v-add-dns-domain

@@ -18,7 +18,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 ip=$3
 ns1=$4
 ns2=$5
@@ -38,6 +38,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+domain_utf=$(idn -t --quiet -u "$domain_idn")
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -48,7 +49,16 @@ is_format_valid 'user' 'domain' 'ip'
 is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM'
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
-is_domain_new 'dns' "$domain"
+
+if [ "$($BIN/v-list-dns-domain $user $domain_utf plain |cut -f 1) " != "$domain" ]; then
+    is_domain_new 'dns' "$domain_utf"
+fi
+if [ "$($BIN/v-list-dns-domain $user $domain_idn plain |cut -f 1) " != "$domain" ]; then
+    is_domain_new 'dns' "$domain_idn"
+else
+    is_domain_new 'dns' "$domain"
+fi
+
 is_package_full 'DNS_DOMAINS'
 template=$(get_user_value '$DNS_TEMPLATE')
 is_dns_template_valid $template

+ 1 - 1
bin/v-add-dns-on-web-alias

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-alias=$(idn -t --quiet -a "$2" )
+alias=$2
 ip=$3
 restart=$4
 

+ 4 - 1
bin/v-add-dns-record

@@ -17,7 +17,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 record=$(idn -t --quiet -u "$3" )
 record=$(echo "$record" | tr '[:upper:]' '[:lower:]')
 rtype=$(echo "$4"| tr '[:lower:]' '[:upper:]')
@@ -71,6 +72,8 @@ fi
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 1 - 1
bin/v-add-domain

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 ip=$3
 restart="${4-yes}"
 

+ 2 - 2
bin/v-add-letsencrypt-domain

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 aliases=$3
 mail=${4// }
 
@@ -118,7 +118,7 @@ check_hestia_demo_mode
 if [ ! -z "$mail" ]; then
     root_domain=$domain
     domain="mail.$root_domain"
-    webmail=$(get_object_value "mail" "$domain" '$WEBMAIL');
+    webmail=$(get_object_value "mail" "DOMAIN" "$root_domain" '$WEBMAIL');
     if [ ! -z "$webmail" ]; then
         aliases="$WEBMAIL_ALIAS.$root_domain"
     fi

+ 1 - 1
bin/v-add-mail-account

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 account=$3
 password=$4; HIDE=4
 quota=${5-unlimited}

+ 4 - 1
bin/v-add-mail-account-alias

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 malias=$4
 
@@ -26,6 +27,8 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 4 - 1
bin/v-add-mail-account-autoreply

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 autoreply=$4
 
@@ -33,6 +34,8 @@ fi
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 1 - 1
bin/v-add-mail-account-forward

@@ -15,7 +15,7 @@
 # Argument definition
 user=$1
 domain=$2
-domain_idn=$(idn -t --quiet -a "$2" )
+domain_idn=$2
 account=$3
 email_forward=$4
 

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

@@ -15,7 +15,7 @@
 # Argument definition
 user=$1
 domain=$2
-domain_idn=$(idn -t --quiet -a "$2" )
+domain_idn=$2
 account=$3
 
 # Includes
@@ -33,6 +33,8 @@ fi
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 12 - 3
bin/v-add-mail-domain

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 antispam=${3-yes}
 antivirus=${4-yes}
 dkim=${5-yes}
@@ -36,7 +36,7 @@ fi
 # Additional argument formatting
 format_domain
 format_domain_idn
-
+domain_utf=$(idn -t --quiet -u "$domain_idn")
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -47,7 +47,16 @@ is_format_valid 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size'
 is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
-is_domain_new 'mail' "$domain"
+
+if [ "$($BIN/v-list-mail-domain $user $domain_utf plain |cut -f 1) " != "$domain" ]; then
+    is_domain_new 'mail' "$domain_utf"
+fi
+if [ "$($BIN/v-list-mail-domain $user $domain_idn plain |cut -f 1) " != "$domain" ]; then
+    is_domain_new 'mail' "$domain_idn"
+else
+    is_domain_new 'mail' "$domain"
+fi
+
 is_package_full 'MAIL_DOMAINS'
 is_dir_symlink $HOMEDIR/$user/mail
 

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

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh
@@ -24,6 +25,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 2 - 1
bin/v-add-mail-domain-antivirus

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 2 - 1
bin/v-add-mail-domain-catchall

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 email="$3"
 
 # Includes

+ 4 - 1
bin/v-add-mail-domain-dkim

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 dkim_size=${3-1024}
 
 # Includes
@@ -32,6 +33,8 @@ fi
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 1 - 1
bin/v-add-mail-domain-smtp-relay

@@ -13,7 +13,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 host=$3
 username=$4
 password=$5

+ 1 - 1
bin/v-add-mail-domain-ssl

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 ssl_dir=$3
 restart="$3"
 

+ 1 - 1
bin/v-add-remote-dns-domain

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 flush=$3
 
 

+ 1 - 1
bin/v-add-remote-dns-record

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 id=$3
 
 # Includes

+ 1 - 1
bin/v-add-sys-webmail

@@ -15,7 +15,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2")
+domain=$2
 webmail=$3
 restart="$4"
 quiet=$5

+ 13 - 14
bin/v-add-web-domain

@@ -20,7 +20,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ip=$3
 restart=$4      # will be moved to the end soon
 aliases=$5
@@ -32,22 +33,11 @@ source $HESTIA/func/domain.sh
 source $HESTIA/func/ip.sh
 source $HESTIA/conf/hestia.conf
 
-# Rewrite all aliases as puni code 
-aliases_list=$(echo $aliases | tr "," "\n")
-aliases=''
-for alias in $aliases_list
-do
-    if [ -z "$aliases" ]; then
-        aliases=$(idn -t --quiet -a "$alias" )
-    else
-        aliases=$aliases,$(idn -t --quiet -a "$alias" )
-    fi
-done
-
 # Additional argument formatting
 format_domain
 format_domain_idn
 format_aliases
+domain_utf=$(idn -t --quiet -u "$domain_idn")
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -59,7 +49,16 @@ is_format_valid 'user' 'domain' 'aliases' 'ip' 'proxy_ext'
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
 is_package_full 'WEB_DOMAINS' 'WEB_ALIASES'
-is_domain_new 'web' "$domain,$aliases"
+
+if [ "$($BIN/v-list-web-domain $user $domain_utf plain |cut -f 1) " != "$domain" ]; then
+    is_domain_new 'web' "$domain_utf,$aliases"
+fi
+if [ "$($BIN/v-list-web-domain $user $domain_idn plain |cut -f 1) " != "$domain" ]; then
+    is_domain_new 'web' "$domain_idn,$aliases"
+else
+    is_domain_new 'web' "$domain,$aliases"
+fi
+
 is_dir_symlink "$HOMEDIR/$user/web"
 is_dir_symlink "$HOMEDIR/$user/web/$domain"
 

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

@@ -15,8 +15,9 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
-aliases=$(idn -t --quiet -a "$3" )
+domain=$2
+domain_idn=$2
+aliases=$3
 restart="$4"
 
 # Includes
@@ -28,6 +29,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 format_aliases
 
 

+ 2 - 1
bin/v-add-web-domain-allow-users

@@ -16,7 +16,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 1 - 1
bin/v-add-web-domain-backend

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 template=${3-default}
 restart=$4
 

+ 1 - 1
bin/v-add-web-domain-fast-cgi-cache

@@ -15,7 +15,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 debug=$3
 
 # Includes

+ 3 - 1
bin/v-add-web-domain-ftp

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ftp_user=${1}_${3}
 password=$4; HIDE=4
 ftp_path=$5
@@ -27,6 +28,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 1 - 1
bin/v-add-web-domain-httpauth

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 auth_user=$3
 password=$4; HIDE=4
 restart=${5-yes}

+ 1 - 1
bin/v-add-web-domain-proxy

@@ -15,7 +15,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+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"

+ 119 - 0
bin/v-add-web-domain-redirect

@@ -0,0 +1,119 @@
+#!/bin/bash
+# info: Adding force redirect to domain
+# options: USER DOMAIN REDIRECT HTTPCODE [RESTART]
+# labels: hestia web
+#
+# example: v-add-web-domain-redirect user domain.tld domain.tld 
+# example: v-add-web-domain-redirect user domain.tld www.domain.tld 
+# example: v-add-web-domain-redirect user domain.tld shop.domain.tld  
+# example: v-add-web-domain-redirect user domain.tld different-domain.com
+# example: v-add-web-domain-redirect user domain.tld shop.different-domain.com
+# example: v-add-web-domain-redirect user domain.tld different-domain.com 302
+#
+# Function creates a forced redirect to a domain 
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+domain=$2
+redirect=$(echo $3 | idn);
+code=${4-301}
+restart=${5-no}
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'USER DOMAIN REDIRECT [HTTP-CODE] [RESTART]'
+is_format_valid 'user' 'domain'
+is_number_format_valid "$code" "code"
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_object_valid 'web' 'DOMAIN' "$domain"
+is_object_unsuspended 'web' 'DOMAIN' "$domain"
+
+
+scheme=0
+if [[ "$3" =~ http://|https:// ]]; then
+    scheme=1
+    regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
+    if ! [[ "$3" =~ $regex ]]; then
+        echo "Invalid redirect"
+        exit 2;
+    fi
+else
+    regex='[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
+    if ! [[ "$3" =~ $regex ]]; then
+        echo "Invalid redirect"
+        exit 2;
+    fi
+fi
+
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Check if proxy is active
+if [ "$WEB_SYSTEM" = 'nginx' ] || [ "$PROXY_SYSTEM" = 'nginx' ]; then
+    conf="$HOMEDIR/$user/conf/web/$domain/nginx.conf_redirect"
+    sconf="$HOMEDIR/$user/conf/web/$domain/nginx.ssl.conf_redirect"
+fi
+# Insert redirect commands
+if [ ! -z "$PROXY_SYSTEM" ] || [ "$WEB_SYSTEM" = 'nginx' ]; then
+    if [ "$scheme" = 1 ]; then
+        echo "   return $code $redirect\$request_uri;" > $conf        
+        if [ ! -e "$sconf" ]; then
+            ln -s "$conf" "$sconf"
+        fi
+    else
+        echo "if (\$host != \"$redirect\") {" > $conf
+        echo "   return $code \$scheme://$redirect\$request_uri;" >> $conf
+        echo "}" >> $conf
+        
+        if [ ! -e "$sconf" ]; then
+            ln -s "$conf" "$sconf"
+        fi
+    fi
+else
+    echo "Non supported please use .htaccess instead" 
+    exit 2;
+fi
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+if [ -z "$REDIRECT" ]; then
+    add_object_key "web" 'DOMAIN' "$domain" 'REDIRECT' 'U_DISK'
+    add_object_key "web" 'DOMAIN' "$domain" 'REDIRECT_CODE' 'U_DISK'
+fi
+
+update_object_value 'web' 'DOMAIN' "$domain" '$REDIRECT' "$redirect"
+update_object_value 'web' 'DOMAIN' "$domain" '$REDIRECT_CODE' "$code"
+
+if [ "$restart" = "yes" ]; then
+    # Restarting web server
+    $BIN/v-restart-web $restart
+    check_result $? "Web restart failed" >/dev/null
+    
+    $BIN/v-restart-proxy $restart
+    check_result $? "Proxy restart failed" >/dev/null
+fi
+
+# Logging
+log_history "Enable forced redirect $domain"
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 1 - 1
bin/v-add-web-domain-ssl

@@ -19,7 +19,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 ssl_dir=$3
 ssl_home=${4-same}
 restart="$5"

+ 1 - 1
bin/v-add-web-domain-ssl-force

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 1 - 1
bin/v-add-web-domain-ssl-hsts

@@ -12,7 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 1 - 1
bin/v-add-web-domain-ssl-preset

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 ssl=$3
 
 # Includes

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

@@ -17,7 +17,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 type=$3
 
 # Includes

+ 1 - 1
bin/v-add-web-domain-stats-user

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 stats_user=$3
 password=$4; HIDE=4
 restart=$5

+ 3 - 1
bin/v-change-dns-domain-exp

@@ -15,7 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 exp=$3
 
 # Includes
@@ -25,6 +26,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 3 - 2
bin/v-change-dns-domain-ip

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ip=$3
 restart=$4
 
@@ -26,7 +27,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
-
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 3 - 1
bin/v-change-dns-domain-soa

@@ -15,7 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 soa=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
 restart=$4
 
@@ -27,6 +28,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 2 - 1
bin/v-change-dns-domain-tpl

@@ -16,7 +16,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 template=$3
 restart=$4
 

+ 2 - 1
bin/v-change-dns-domain-ttl

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ttl=$3
 restart=$4
 

+ 2 - 1
bin/v-change-dns-record

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 id=$3
 record=$4
 type=$5

+ 3 - 1
bin/v-change-dns-record-id

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 id=$3
 newid=$4
 restart=$5
@@ -27,6 +28,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 1 - 1
bin/v-change-domain-owner

@@ -13,7 +13,7 @@
 #----------------------------------------------------------#
 
 # Argument definition
-domain=$(idn -t --quiet -a "$1" )
+domain=$1
 user=$2
 
 # Includes

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

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 password=$4; HIDE=4
 
@@ -26,6 +27,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 4 - 1
bin/v-change-mail-account-quota

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 quota=$4
 
@@ -26,6 +27,8 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 1
bin/v-change-mail-domain-catchall

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 email=$3
 
 # Includes

+ 2 - 1
bin/v-change-mail-domain-sslcert

@@ -13,7 +13,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 restart=$3
 
 # Includes

+ 1 - 1
bin/v-change-remote-dns-domain-exp

@@ -12,7 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 1 - 1
bin/v-change-remote-dns-domain-soa

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 1 - 1
bin/v-change-remote-dns-domain-ttl

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 2 - 1
bin/v-change-web-domain-backend-tpl

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 template=$3
 restart=$4
 

+ 1 - 1
bin/v-change-web-domain-dirlist

@@ -14,7 +14,7 @@
 
 # Argument defenition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 mode=$3
 
 # Includes

+ 1 - 1
bin/v-change-web-domain-docroot

@@ -21,7 +21,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Export target domain and directory
 # so they are correctly passed through to domain.sh

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

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ftp_user=$3
 password=$4; HIDE=4
 

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

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ftp_user=$3
 ftp_path=$4
 

+ 1 - 1
bin/v-change-web-domain-httpauth

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 auth_user=$3
 password=$4; HIDE=4
 

+ 4 - 1
bin/v-change-web-domain-ip

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ip=$3
 restart=$4
 
@@ -27,6 +28,8 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 3 - 2
bin/v-change-web-domain-name

@@ -14,8 +14,9 @@
 
 # Argument defenition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
-new_domain=$(idn -t --quiet -a "$3" )
+domain=$2
+domain_idn=$2
+new_domain=$3
 restart=$4
 
 # Includes

+ 4 - 1
bin/v-change-web-domain-proxy-tpl

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$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"
@@ -30,6 +31,8 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 3 - 1
bin/v-change-web-domain-sslcert

@@ -15,7 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ssl_dir=$3
 restart=$4
 
@@ -27,6 +28,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
 
 
 #----------------------------------------------------------#

+ 4 - 1
bin/v-change-web-domain-sslhome

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ssl_home=$3
 restart=$4
 
@@ -26,6 +27,8 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

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

@@ -15,7 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 type=$3
 
 # Includes

+ 2 - 1
bin/v-change-web-domain-tpl

@@ -15,7 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 template=$3
 restart=$4
 

+ 1 - 1
bin/v-delete-dns-domain

@@ -15,7 +15,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 restart="$3"
 
 # Includes

+ 1 - 1
bin/v-delete-dns-domains-src

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-src=$(idn -t --quiet -a "$2" )
+src=$2
 restart=$3
 
 # Includes

+ 1 - 1
bin/v-delete-dns-on-web-alias

@@ -15,7 +15,7 @@
 # Argument definition
 user=$1
 domain=$2
-domain_idn=$(idn -t --quiet -a "$2" )
+domain_idn=$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:]')

+ 2 - 1
bin/v-delete-dns-record

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 id=$3
 restart=$4
 

+ 1 - 1
bin/v-delete-domain

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 restart="${3-yes}"
 
 # Includes

+ 1 - 1
bin/v-delete-letsencrypt-domain

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 restart=$3
 mail=$4
 

+ 2 - 1
bin/v-delete-mail-account

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 
 # Includes

+ 2 - 1
bin/v-delete-mail-account-alias

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 malias=$4
 

+ 2 - 1
bin/v-delete-mail-account-autoreply

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 malias=$4
 

+ 2 - 1
bin/v-delete-mail-account-forward

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 forward=$4
 

+ 2 - 1
bin/v-delete-mail-account-fwd-only

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 account=$3
 
 # Includes

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

@@ -15,7 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 2 - 1
bin/v-delete-mail-domain-antispam

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 2 - 1
bin/v-delete-mail-domain-antivirus

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 2 - 1
bin/v-delete-mail-domain-catchall

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh

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

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 
 # Includes

+ 1 - 1
bin/v-delete-mail-domain-smtp-relay

@@ -13,7 +13,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

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

@@ -13,7 +13,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 1 - 1
bin/v-delete-remote-dns-domain

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 1 - 1
bin/v-delete-remote-dns-record

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 id=$3
 
 # Includes

+ 1 - 1
bin/v-delete-sys-webmail

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2")
+domain=$2
 restart="$3"
 quiet=$4
 

+ 4 - 1
bin/v-delete-web-domain

@@ -17,7 +17,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 restart=$3
 
 # Includes
@@ -29,6 +30,8 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
+# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 2
bin/v-delete-web-domain-alias

@@ -15,8 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
-dom_alias=$(idn -t --quiet -a "$3" )
+domain=$2
+dom_alias=$3
 restart=$4
 
 # Includes

+ 2 - 1
bin/v-delete-web-domain-allow-users

@@ -16,7 +16,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 
 # Includes
 source $HESTIA/func/main.sh

+ 2 - 1
bin/v-delete-web-domain-backend

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 restart=$3
 
 # Includes

+ 1 - 1
bin/v-delete-web-domain-fast-cgi-cache

@@ -13,7 +13,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 restart=$3
 
 # Includes

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

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 ftp_user=$3
 
 # Includes

+ 1 - 1
bin/v-delete-web-domain-httpauth

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 auth_user=$3
 restart=${4-yes}
 

+ 2 - 1
bin/v-delete-web-domain-proxy

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 restart=$3
 
 # Includes

+ 76 - 0
bin/v-delete-web-domain-redirect

@@ -0,0 +1,76 @@
+#!/bin/bash
+# info: Delete force redirect to domain
+# options: USER DOMAIN [RESTART]
+# labels: hestia web
+#
+# example: v-add-web-domain-redirect user domain.tld
+#
+# Function delete a forced redirect to a domain 
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+domain=$2
+restart=${3-no}
+
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN [RESTART]'
+is_format_valid 'user' 'domain'
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_object_valid 'web' 'DOMAIN' "$domain"
+is_object_unsuspended 'web' 'DOMAIN' "$domain"
+
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+
+
+# Check if proxy is active
+if [ "$WEB_SYSTEM" = 'nginx' ] || [ "$PROXY_SYSTEM" = 'nginx' ]; then
+    rm $HOMEDIR/$user/conf/web/$domain/nginx.conf_redirect
+    rm $HOMEDIR/$user/conf/web/$domain/nginx.ssl.conf_redirect
+else
+     echo "Non supported please use .htaccess instead" 
+     exit 2;
+fi
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+update_object_value 'web' 'DOMAIN' "$domain" '$REDIRECT' ""
+update_object_value 'web' 'DOMAIN' "$domain" '$REDIRECT_CODE' ""
+
+if [ "$restart" = "yes" ]; then
+    # Restarting web server
+    $BIN/v-restart-web $restart
+    check_result $? "Web restart failed" >/dev/null
+    
+    $BIN/v-restart-proxy $restart
+    check_result $? "Proxy restart failed" >/dev/null
+fi
+
+# Logging
+log_history "Enable forced redirect $domain"
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 2 - 1
bin/v-delete-web-domain-ssl

@@ -14,7 +14,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
+domain_idn=$2
 restart=$3
 
 # Includes

+ 1 - 1
bin/v-delete-web-domain-ssl-force

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 restart=$3
 
 # Includes

+ 1 - 1
bin/v-delete-web-domain-ssl-hsts

@@ -14,7 +14,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 restart=$3
 
 # Includes

+ 1 - 1
bin/v-delete-web-domain-stats

@@ -15,7 +15,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 domain_idn=$2
 
 # Includes

+ 1 - 1
bin/v-delete-web-domain-stats-user

@@ -17,7 +17,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -a "$2" )
+domain=$2
 restart=$3
 
 # Includes

Some files were not shown because too many files changed in this diff