diff --git a/bin/v-add-web-domain-alias b/bin/v-add-web-domain-alias index cb75568e..a48b278c 100755 --- a/bin/v-add-web-domain-alias +++ b/bin/v-add-web-domain-alias @@ -55,6 +55,7 @@ get_domain_values 'web' # Preparing domain values for the template substitution local_ip=$(get_real_ip $IP) +ipv6=$IP6 if [ -z "$ALIAS" ]; then ALIAS="$aliases" else @@ -62,12 +63,35 @@ else fi prepare_web_domain_values -# Rebuilding vhost -del_web_config "$WEB_SYSTEM" "$TPL.tpl" -add_web_config "$WEB_SYSTEM" "$TPL.tpl" -if [ "$SSL" = 'yes' ]; then - del_web_config "$WEB_SYSTEM" "$TPL.stpl" - add_web_config "$WEB_SYSTEM" "$TPL.stpl" +if [ ! -z "$local_ip" ]; then + old=$local_ip + del_web_config "$WEB_SYSTEM" "$TPL.tpl" + add_web_config "$WEB_SYSTEM" "$TPL.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + add_web_config "$WEB_SYSTEM" "$TPL.stpl" + fi + + # Rebuilding proxy configuration + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi + fi +fi + +# Rebuilding vhost IPv6 +if [ ! -z "$IP6" ]; then + old=$IP6 + del_web_config "$WEB_SYSTEM" "$TPL.tpl" + add_web_config "$WEB_SYSTEM" "$TPL.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + add_web_config "$WEB_SYSTEM" "$TPL.stpl" + fi fi # Rebuilding proxy configuration @@ -78,6 +102,15 @@ if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" fi + # Rebuilding proxy configuration + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi + fi fi diff --git a/bin/v-change-dns-domain-ip b/bin/v-change-dns-domain-ip index 65b12cb5..810fe8a4 100755 --- a/bin/v-change-dns-domain-ip +++ b/bin/v-change-dns-domain-ip @@ -57,6 +57,7 @@ fi get_domain_values 'dns' old=$IP new=$ip +ipv6=$IP6 if [ -z "$old" ]; then #Create new @@ -71,7 +72,6 @@ else sed -i "s/$old/$ip/g" $USER_DATA/dns/$domain.conf else #Delete configs - ip=$old remove_dns_config_records fi fi diff --git a/bin/v-change-dns-domain-ipv6 b/bin/v-change-dns-domain-ipv6 index 6717d3c2..2f810b69 100755 --- a/bin/v-change-dns-domain-ipv6 +++ b/bin/v-change-dns-domain-ipv6 @@ -55,6 +55,7 @@ fi get_domain_values 'dns' old=$IP6 new=$ipv6 +ip=$IP if [ -z "$old" ]; then #Create new diff --git a/bin/v-delete-user-ips b/bin/v-delete-user-ips index 7f8e3224..34b7935c 100755 --- a/bin/v-delete-user-ips +++ b/bin/v-delete-user-ips @@ -36,7 +36,7 @@ fi #----------------------------------------------------------# # Parsing user ips -ip_list=$(grep -H "OWNER='$user'" $VESTA/data/ips/* | cut -f 1 -d:) +ip_list=$(grep -H -A10 "OWNER='$user'" $VESTA/data/ips/* |grep "VERSION='4'" | cut -f 1 -d '-') for ip in $ip_list; do ip=$(basename $ip) diff --git a/bin/v-delete-user-ipv6s b/bin/v-delete-user-ipv6s new file mode 100755 index 00000000..35a41c5c --- /dev/null +++ b/bin/v-delete-user-ipv6s @@ -0,0 +1,63 @@ +#!/bin/bash +# info: delete user ips +# options: USER +# +# The function deletes all user's ip addresses. + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument definition +user=$1 + +# Includes +source $VESTA/func/main.sh +source $VESTA/func/ipv6.sh +source $VESTA/conf/vesta.conf + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +check_args '1' "$#" 'USER' +is_format_valid 'user' +is_object_valid 'user' 'USER' "$user" +is_object_unsuspended 'user' 'USER' "$user" +if [ "$user" = 'admin' ]; then + exit +fi + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Parsing user ips +ip_list=$(grep -H -A10 "OWNER='$user'" $VESTA/data/ips/* |grep "VERSION='6'" | cut -f 1 -d '-') + +for ip in $ip_list; do + ip=$(basename $ip) + + # Checking webdomains and users + is_ip_key_empty '$U_WEB_DOMAINS' + is_ip_key_empty '$U_SYS_USERS' + + # Assig ip to main account + update_ip_value '$OWNER' 'admin' + update_ip_value '$STATUS' 'dedicated' + increase_user_value 'admin' '$IP_OWNED' + increase_user_value 'admin' '$IP_AVAIL' +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event "$OK" "$ARGUMENTS" + +exit \ No newline at end of file diff --git a/bin/v-delete-web-domain b/bin/v-delete-web-domain index 3c0f4680..db19ed0c 100755 --- a/bin/v-delete-web-domain +++ b/bin/v-delete-web-domain @@ -22,6 +22,7 @@ restart=$3 source $VESTA/func/main.sh source $VESTA/func/domain.sh source $VESTA/func/ip.sh +source $VESTA/func/ipv6.sh source $VESTA/conf/vesta.conf # Additional argument formatting @@ -56,55 +57,61 @@ fi get_domain_values 'web' local_ip=$(get_real_ip $IP) -# Deleting domain from web.conf -sed -i "/DOMAIN='$domain'/ d" $USER_DATA/web.conf - -# Deleting vhost configuration IPv4 -if [ ! -z "$local_ip" ]; then - old=$local_ip - del_web_config "$WEB_SYSTEM" "$TPL.tpl" - - # Deleting SSL configuration and certificates - if [ "$SSL" = 'yes' ]; then - del_web_config "$WEB_SYSTEM" "$TPL.stpl" - rm -f $HOMEDIR/$user/conf/web/ssl.$domain.* - rm -f $USER_DATA/ssl/$domain.* - fi - - # Deleting proxy - if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" - if [ "$SSL" = 'yes' ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" - fi - if [ -e "/etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf" ]; then - sed -i "/=$domain:/d" /etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf - fi - fi +if [ -z "$IP6" ]; then + # Deleting domain from web.conf + sed -i "/DOMAIN='$domain'/ d" $USER_DATA/web.conf fi # Deleting vhost configuration IPv4 -if [ ! -z "$ipv6" ]; then - old=$IP6 - del_web_config "$WEB_SYSTEM" "$TPL.tpl" +if [ ! -z "$local_ip" ]; then + old=$local_ip + del_web_config "$WEB_SYSTEM" "$TPL.tpl" - # Deleting SSL configuration and certificates - if [ "$SSL" = 'yes' ]; then - del_web_config "$WEB_SYSTEM" "$TPL.stpl" - rm -f $HOMEDIR/$user/conf/web/ssl.$domain.* - rm -f $USER_DATA/ssl/$domain.* - fi + # Deleting SSL configuration and certificates + if [ "$SSL" = 'yes' ]; then + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + rm -f $HOMEDIR/$user/conf/web/ssl.$domain.* + rm -f $USER_DATA/ssl/$domain.* + fi - # Deleting proxy - if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" - if [ "$SSL" = 'yes' ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" - fi - if [ -e "/etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf" ]; then - sed -i "/=$domain:/d" /etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf - fi - fi + # Deleting proxy + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi + if [ -e "/etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf" ]; then + sed -i "/=$domain:/d" /etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf + fi + fi +fi + +# Deleting vhost configuration IPv6 +web_domain=$(grep DOMAIN $USER_DATA/web.conf |wc -l) +if [ ! -z "$IP6" ] && [ "$web_domain" -gt '0' ]; then + # Deleting domain from web.conf + sed -i "/DOMAIN='$domain'/d" $USER_DATA/web.conf + + old=$IP6 + del_web_config "$WEB_SYSTEM" "$TPL.tpl" + + # Deleting SSL configuration and certificates + if [ "$SSL" = 'yes' ]; then + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + rm -f $HOMEDIR/$user/conf/web/ssl.$domain.* + rm -f $USER_DATA/ssl/$domain.* + fi + + # Deleting proxy + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi + if [ -e "/etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf" ]; then + sed -i "/=$domain:/d" /etc/$PROXY_SYSTEM/conf.d/01_caching_pool.conf + fi + fi fi # Deleting web stats @@ -140,7 +147,7 @@ rm -rf $HOMEDIR/$user/web/$domain # Decreasing user counters decrease_ip_value "$local_ip" -decrease_ipv6_value "$ipv6" +decrease_ipv6_value "$IP6" decrease_user_value "$user" '$U_WEB_DOMAINS' if [ "$SSL" = 'yes' ]; then decrease_user_value "$user" '$U_WEB_SSL' diff --git a/bin/v-suspend-web-domain b/bin/v-suspend-web-domain index 7bd658ce..1b8a0241 100755 --- a/bin/v-suspend-web-domain +++ b/bin/v-suspend-web-domain @@ -53,24 +53,48 @@ local_ip=$(get_real_ip $IP) # Preparing domain values for the template substitution prepare_web_domain_values -# Rebuilding vhost -del_web_config "$WEB_SYSTEM" "$TPL.tpl" -add_web_config "$WEB_SYSTEM" "$TPL.tpl" -if [ "$SSL" = 'yes' ]; then - del_web_config "$WEB_SYSTEM" "$TPL.stpl" - add_web_config "$WEB_SYSTEM" "$TPL.stpl" -fi - -# Rebuilding proxy configuration -if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" - add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" +# Rebuilding vhost IPv4 +if [ ! -z "$local_ip" ]; then + old=$local_ip + del_web_config "$WEB_SYSTEM" "$TPL.tpl" + add_web_config "$WEB_SYSTEM" "$TPL.tpl" if [ "$SSL" = 'yes' ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" - add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + add_web_config "$WEB_SYSTEM" "$TPL.stpl" + fi + + # Rebuilding proxy configuration + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi fi fi +# Rebuilding vhost IPv6 +if [ ! -z "$IP6" ]; then + old=$IP6 + del_web_config "$WEB_SYSTEM" "$TPL.tpl" + add_web_config "$WEB_SYSTEM" "$TPL.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + add_web_config "$WEB_SYSTEM" "$TPL.stpl" + fi + + # Rebuilding proxy configuration + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi + fi + fi + #----------------------------------------------------------# # Vesta # diff --git a/bin/v-unsuspend-web-domain b/bin/v-unsuspend-web-domain index 91bc1e16..b3ad2b4b 100755 --- a/bin/v-unsuspend-web-domain +++ b/bin/v-unsuspend-web-domain @@ -51,21 +51,45 @@ local_ip=$(get_real_ip $IP) # Preparing domain values for the template substitution prepare_web_domain_values -# Rebuilding vhost -del_web_config "$WEB_SYSTEM" "$TPL.tpl" -add_web_config "$WEB_SYSTEM" "$TPL.tpl" -if [ "$SSL" = 'yes' ]; then - del_web_config "$WEB_SYSTEM" "$TPL.stpl" - add_web_config "$WEB_SYSTEM" "$TPL.stpl" -fi - -# Rebuilding proxy configuration -if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" - add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" +# Rebuilding vhost IPv4 +if [ ! -z "$local_ip" ]; then + old=$local_ip + del_web_config "$WEB_SYSTEM" "$TPL.tpl" + add_web_config "$WEB_SYSTEM" "$TPL.tpl" if [ "$SSL" = 'yes' ]; then - del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" - add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + add_web_config "$WEB_SYSTEM" "$TPL.stpl" + fi + + # Rebuilding proxy configuration + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi + fi +fi + +# Rebuilding vhost IPv6 +if [ ! -z "$IP6" ]; then + old=$IP6 + del_web_config "$WEB_SYSTEM" "$TPL.tpl" + add_web_config "$WEB_SYSTEM" "$TPL.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$WEB_SYSTEM" "$TPL.stpl" + add_web_config "$WEB_SYSTEM" "$TPL.stpl" + fi + + # Rebuilding proxy configuration + if [ ! -z "$PROXY_SYSTEM" ] && [ ! -z "$PROXY" ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.tpl" + if [ "$SSL" = 'yes' ]; then + del_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + add_web_config "$PROXY_SYSTEM" "$PROXY.stpl" + fi fi fi diff --git a/install/rhel/5/dovecot/dovecot.conf b/install/rhel/5/dovecot/dovecot.conf index 544d851e..07f0d900 100644 --- a/install/rhel/5/dovecot/dovecot.conf +++ b/install/rhel/5/dovecot/dovecot.conf @@ -1,3 +1,4 @@ +listen = *, :: protocols = imap imaps pop3 pop3s log_path = /var/log/dovecot.log ssl_cert_file = /usr/local/vesta/ssl/certificate.crt diff --git a/install/rhel/5/named/named.conf b/install/rhel/5/named/named.conf index 472bd829..38c1b6c0 100644 --- a/install/rhel/5/named/named.conf +++ b/install/rhel/5/named/named.conf @@ -6,6 +6,7 @@ options { version "get lost"; allow-transfer {"none";}; recursion no; + listen-on-v6 { any; }; }; diff --git a/install/rhel/6/dovecot/dovecot.conf b/install/rhel/6/dovecot/dovecot.conf index b44bd6a8..0a855351 100644 --- a/install/rhel/6/dovecot/dovecot.conf +++ b/install/rhel/6/dovecot/dovecot.conf @@ -1,4 +1,4 @@ protocols = imap pop3 -listen = * +listen = *, :: base_dir = /var/run/dovecot/ !include conf.d/*.conf diff --git a/install/rhel/6/named/named.conf b/install/rhel/6/named/named.conf index 472bd829..38c1b6c0 100644 --- a/install/rhel/6/named/named.conf +++ b/install/rhel/6/named/named.conf @@ -6,6 +6,7 @@ options { version "get lost"; allow-transfer {"none";}; recursion no; + listen-on-v6 { any; }; }; diff --git a/install/rhel/7/dovecot/dovecot.conf b/install/rhel/7/dovecot/dovecot.conf index b44bd6a8..0a855351 100644 --- a/install/rhel/7/dovecot/dovecot.conf +++ b/install/rhel/7/dovecot/dovecot.conf @@ -1,4 +1,4 @@ protocols = imap pop3 -listen = * +listen = *, :: base_dir = /var/run/dovecot/ !include conf.d/*.conf diff --git a/install/rhel/7/named/named.conf b/install/rhel/7/named/named.conf index 472bd829..38c1b6c0 100644 --- a/install/rhel/7/named/named.conf +++ b/install/rhel/7/named/named.conf @@ -6,6 +6,7 @@ options { version "get lost"; allow-transfer {"none";}; recursion no; + listen-on-v6 { any; }; }; diff --git a/install/vst-install-debian.sh b/install/vst-install-debian.sh index 8f08bd7a..8a556dc0 100755 --- a/install/vst-install-debian.sh +++ b/install/vst-install-debian.sh @@ -1200,7 +1200,7 @@ $VESTA/bin/v-update-sys-ip # Get main ipv6 ipv6=$(ip addr show | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | grep -ve "^fe80" | tail -1) -if [ ! -z "$ipv6" ]; then +if [ ! -z "$ipv6" ] && [ "::1" != "$ipv6" ]; then netmask="ip addr show | grep '$ipv6' | awk -F '/' '{print $2}' | awk '{print $1}'" netmask=$(eval $netmask) $VESTA/bin/v-add-sys-ipv6 $ipv6 $netmask diff --git a/install/vst-install-rhel.sh b/install/vst-install-rhel.sh index af98ab03..800d94bc 100755 --- a/install/vst-install-rhel.sh +++ b/install/vst-install-rhel.sh @@ -1245,7 +1245,7 @@ $VESTA/bin/v-update-sys-ip # Get main ipv6 ipv6=$(ip addr show | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | grep -ve "^fe80" | tail -1) -if [ ! -z "$ipv6" ]; then +if [ ! -z "$ipv6" ] && [ "::1" != "$ipv6" ]; then netmask="ip addr show | grep '$ipv6' | awk -F '/' '{print $2}' | awk '{print $1}'" netmask=$(eval $netmask) $VESTA/bin/v-add-sys-ipv6 $ipv6 $netmask diff --git a/install/vst-install-ubuntu.sh b/install/vst-install-ubuntu.sh index f7280c93..4b630663 100755 --- a/install/vst-install-ubuntu.sh +++ b/install/vst-install-ubuntu.sh @@ -1195,7 +1195,7 @@ $VESTA/bin/v-update-sys-ip # Get main ipv6 ipv6=$(ip addr show | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | grep -ve "^fe80" | tail -1) -if [ ! -z "$ipv6" ]; then +if [ ! -z "$ipv6" ] && [ "::1" != "$ipv6" ]; then netmask="ip addr show | grep '$ipv6' | awk -F '/' '{print $2}' | awk '{print $1}'" netmask=$(eval $netmask) $VESTA/bin/v-add-sys-ipv6 $ipv6 $netmask diff --git a/upd/add_ipv6.sh b/upd/add_ipv6.sh index 552961a3..9faf6a30 100755 --- a/upd/add_ipv6.sh +++ b/upd/add_ipv6.sh @@ -33,7 +33,7 @@ ipv6use="" if [ ! -z "$ipv6" ] && [ "::1" != "$ipv6" ]; then netmask="ip addr show | grep '$ipv6' | awk -F '/' '{print \$2}' | awk '{print \$1}'" netmask=$(eval $netmask) - $VESTA/bin/v-add-sys-ipv6 $ipv6 $netmask + $BIN/v-add-sys-ipv6 $ipv6 $netmask $BIN/v-update-firewall-ipv6 ipv6use=$ipv6 fi