diff --git a/bin/v-add-dns-domain b/bin/v-add-dns-domain
index f558cb6ba..55b5d5ce7 100755
--- a/bin/v-add-dns-domain
+++ b/bin/v-add-dns-domain
@@ -128,6 +128,12 @@ update_domain_zone
chmod 640 $conf
chown root:named $conf
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-add-remote-dns-domain $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
@@ -139,7 +145,7 @@ increase_user_value "$user" '$U_DNS_RECORDS' "$records"
# Restart named
if [ "$restart" != 'no' ]; then
- $BIN/v-restart-dns "$EVENT"
+ $BIN/v-restart-dns
fi
# Logging
diff --git a/bin/v-add-dns-on-web-alias b/bin/v-add-dns-on-web-alias
index a5b0eaf9e..6c6b55e0c 100755
--- a/bin/v-add-dns-on-web-alias
+++ b/bin/v-add-dns-on-web-alias
@@ -61,7 +61,7 @@ else
$user $dom $IP '' '' '' '' $restart > /dev/null
if [ $? -eq 0 ]; then
- $BIN/v-add-dns-domain-record \
+ $BIN/v-add-dns-record \
$user $dom "$sub" A $IP '' '' $restart
fi
else
@@ -71,7 +71,7 @@ else
rec=$(grep -w "RECORD='$sub'" $USER_DATA/dns/$dom.conf)
fi
if [ -z "$rec" ]; then
- $BIN/v-add-dns-domain-record \
+ $BIN/v-add-dns-record \
$user $dom "$sub" A $IP '' '' $restart > /dev/null
fi
fi
diff --git a/bin/v-add-dns-domain-record b/bin/v-add-dns-record
similarity index 93%
rename from bin/v-add-dns-domain-record
rename to bin/v-add-dns-record
index a6dd4bc12..580e9fd1d 100755
--- a/bin/v-add-dns-domain-record
+++ b/bin/v-add-dns-record
@@ -1,5 +1,5 @@
#!/bin/bash
-# info: add dns domain record
+# info: add dns record
# options: USER DOMAIN RECORD TYPE VALUE [PRIORITY] [ID] [RESTART]
#
# The call is used for adding new DNS record. Complex records of TXT, MX and
@@ -73,6 +73,12 @@ sort_dns_records
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-add-remote-dns-record $user $domain $id"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
@@ -85,7 +91,7 @@ increase_user_value "$user" '$U_DNS_RECORDS'
# Restart named
if [ "$restart" != 'no' ]; then
- $BIN/v-restart-dns "$EVENT"
+ $BIN/v-restart-dns
fi
# Logging
diff --git a/bin/v-add-mail-domain b/bin/v-add-mail-domain
index 13a167adf..6ab33de72 100755
--- a/bin/v-add-mail-domain
+++ b/bin/v-add-mail-domain
@@ -85,11 +85,11 @@ if [ "$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-domain-record $user $domain $record TXT "$policy"
+ $BIN/v-add-dns-record $user $domain $record TXT "$policy"
record='mail._domainkey'
selector="\"k=rsa\; p=$p\""
- $BIN/v-add-dns-domain-record $user $domain $record TXT "$selector"
+ $BIN/v-add-dns-record $user $domain $record TXT "$selector"
fi
fi
diff --git a/bin/v-add-mail-domain-dkim b/bin/v-add-mail-domain-dkim
index b94f4f689..161bb0855 100755
--- a/bin/v-add-mail-domain-dkim
+++ b/bin/v-add-mail-domain-dkim
@@ -58,11 +58,11 @@ if [ "$?" -eq 0 ]; then
p=$(cat $USER_DATA/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
record='_domainkey'
policy="\"t=y; o=~;\""
- $BIN/v-add-dns-domain-record $user $domain $record TXT "$policy"
+ $BIN/v-add-dns-record $user $domain $record TXT "$policy"
record='mail._domainkey'
selector="\"k=rsa\; p=$p\""
- $BIN/v-add-dns-domain-record $user $domain $record TXT "$selector"
+ $BIN/v-add-dns-record $user $domain $record TXT "$selector"
fi
diff --git a/bin/v-add-remote-dns-domain b/bin/v-add-remote-dns-domain
new file mode 100755
index 000000000..b0e6ab492
--- /dev/null
+++ b/bin/v-add-remote-dns-domain
@@ -0,0 +1,133 @@
+#!/bin/bash
+# info: add remote dns domain
+# options: USER DOMAIN
+#
+# The function synchronize dns domain with the remote server.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN'
+validate_format 'user' 'domain'
+is_system_enabled "$DNS_CLUSTER"
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Check dns exceptions
+ if [ -z "$DNS_CLUSTER_IGNORE" ]; then
+ DNS_CLUSTER_IGNORE='dns-cluster'
+ fi
+
+ # Sync domain
+ str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
+ eval $str
+ $send_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME
+
+ # Sync records
+ if [ "$TYPE" = 'ssh' ]; then
+ tmp=$(mktemp -u)
+ scp_cmd $USER_DATA/dns/$DOMAIN.conf $tmp
+ $send_cmd v-insert-dns-records $DNS_USER $DOMAIN $tmp
+ else
+ for str in $(cat $USER_DATA/dns/$DOMAIN.conf); do
+ str=$(echo "$str" | sed 's/"/\\"/g')
+ $send_cmd v-insert-dns-record $DNS_USER $DOMAIN "$str"
+ done
+ fi
+
+ # Rebuild dns zone
+ $send_cmd v-rebuild-dns-domain $DNS_USER $domain no
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed (rebuild)"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+done
+
+# Update pipe
+pipe="$VESTA/data/queue/dns-cluster.pipe"
+str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
+if [ ! -z "$str" ]; then
+ sed -i "$str d" $pipe
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-add-remote-dns-record b/bin/v-add-remote-dns-record
new file mode 100755
index 000000000..c87bf3d04
--- /dev/null
+++ b/bin/v-add-remote-dns-record
@@ -0,0 +1,123 @@
+#!/bin/bash
+# info: add remote dns domain record
+# options: USER DOMAIN ID
+#
+# The function synchronize dns domain with the remote server.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+id=$3
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'USER DOMAIN ID'
+validate_format 'user' 'domain' 'id'
+is_system_enabled "$DNS_CLUSTER"
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+is_object_valid "dns/$domain" 'ID' "$id"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Check dns exceptions
+ if [ -z "$DNS_CLUSTER_IGNORE" ]; then
+ DNS_CLUSTER_IGNORE='dns-cluster'
+ fi
+
+ # Sync record
+ str=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
+ str=$(echo "$str" | sed 's/"/\\"/g')
+ $send_cmd v-insert-dns-record $DNS_USER $domain "$str"
+
+ # Rebuild dns zone
+ $send_cmd v-rebuild-dns-domain $DNS_USER $domain no
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed (rebuild)"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+done
+
+# Update pipe
+pipe="$VESTA/data/queue/dns-cluster.pipe"
+str=$(grep -n "$SCRIPT $1 $2 $3$" $pipe | cut -f1 -d: | head -n1)
+if [ ! -z "$str" ]; then
+ sed -i "$str d" $pipe
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-change-dns-domain-exp b/bin/v-change-dns-domain-exp
index e491893b0..c9eb6ec7a 100755
--- a/bin/v-change-dns-domain-exp
+++ b/bin/v-change-dns-domain-exp
@@ -41,6 +41,12 @@ is_object_unsuspended 'dns' 'DOMAIN' "$domain"
# Changing exp
update_object_value 'dns' 'DOMAIN' "$domain" '$EXP' "$exp"
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-change-remote-dns-domain-exp $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
diff --git a/bin/v-change-dns-domain-ip b/bin/v-change-dns-domain-ip
index 9a3fb050c..ee5b14a9a 100755
--- a/bin/v-change-dns-domain-ip
+++ b/bin/v-change-dns-domain-ip
@@ -52,6 +52,12 @@ sed -i "s/$old/$ip/g" $USER_DATA/dns/$domain.conf
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-add-remote-dns-domain $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
@@ -59,7 +65,7 @@ update_domain_zone
# Restart named
if [ "$restart" != 'no' ]; then
- $BIN/v-restart-dns "$EVENT"
+ $BIN/v-restart-dns
fi
# Logging
diff --git a/bin/v-change-dns-domain-soa b/bin/v-change-dns-domain-soa
index f12af4e7b..fb722376a 100755
--- a/bin/v-change-dns-domain-soa
+++ b/bin/v-change-dns-domain-soa
@@ -3,7 +3,7 @@
# options: USER DOMAIN SOA
#
# The function for changing SOA record. This type of records can not be
-# modified by v-change-dns-domain-record call.
+# modified by v-change-dns-record call.
#----------------------------------------------------------#
@@ -46,6 +46,12 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$SOA' "$soa"
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-change-remote-dns-domain-soa $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
diff --git a/bin/v-change-dns-domain-tpl b/bin/v-change-dns-domain-tpl
index 0d88be40c..47785178b 100755
--- a/bin/v-change-dns-domain-tpl
+++ b/bin/v-change-dns-domain-tpl
@@ -1,6 +1,6 @@
#!/bin/bash
# info: change dns domain template
-# options: USER DOMAIN
+# options: USER DOMAIN TEMPLATE [RESTART]
#
# The function for changing the template of records. By updating old records
# will be removed and new records will be generated in accordance with
@@ -16,6 +16,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
template=$3
+restart=$4
# Includes
source $VESTA/conf/vesta.conf
@@ -27,7 +28,7 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
-check_args '3' "$#" 'USER DOMAIN TEMPLATE'
+check_args '3' "$#" 'USER DOMAIN TEMPLATE [RESTART]'
validate_format 'user' 'domain' 'template'
is_system_enabled "$DNS_SYSTEM"
is_object_valid 'user' 'USER' "$user"
@@ -69,13 +70,21 @@ cat $DNSTPL/$template.tpl |\
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-add-remote-dns-domain $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart named
-$BIN/v-restart-dns "$EVENT"
+if [ "$restart" != 'no' ]; then
+ $BIN/v-restart-dns
+fi
# Logging
log_history "changed dns template for $domain to $template" '' 'admin'
diff --git a/bin/v-change-dns-domain-ttl b/bin/v-change-dns-domain-ttl
index 1112aa9bd..7d9729e64 100755
--- a/bin/v-change-dns-domain-ttl
+++ b/bin/v-change-dns-domain-ttl
@@ -45,6 +45,12 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$TTL' "$ttl"
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-change-remote-dns-domain-ttl $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
diff --git a/bin/v-change-dns-domain-record b/bin/v-change-dns-record
similarity index 85%
rename from bin/v-change-dns-domain-record
rename to bin/v-change-dns-record
index d9a4310f6..3739bda38 100755
--- a/bin/v-change-dns-domain-record
+++ b/bin/v-change-dns-record
@@ -1,6 +1,6 @@
#!/bin/bash
# info: change dns domain record
-# options: USER DOMAIN ID VALUE [PRIORITY]
+# options: USER DOMAIN ID VALUE [PRIORITY] [RESTART]
#
# The function for changing DNS record.
@@ -18,6 +18,7 @@ id=$3
dvalue=$(idn -t --quiet -u "$4" )
dvalue=$(echo $dvalue | tr '[:upper:]' '[:lower:]')
priority=$5
+restart=$6
# Includes
source $VESTA/conf/vesta.conf
@@ -29,7 +30,7 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
-check_args '4' "$#" 'USER DOMAIN ID VALUE [PRIORITY]'
+check_args '4' "$#" 'USER DOMAIN ID VALUE [PRIORITY] [RESTART]'
validate_format 'user' 'domain' 'id' 'dvalue'
is_system_enabled "$DNS_SYSTEM"
is_object_valid 'user' 'USER' "$user"
@@ -62,13 +63,21 @@ sort_dns_records
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-add-remote-dns-domain $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart named
-$BIN/v-restart-dns "$EVENT"
+if [ "$restart" != 'no' ]; then
+ $BIN/v-restart-dns
+fi
# Logging
log_history "changed dns record on $domain to $dvalue"
diff --git a/bin/v-change-dns-domain-record-id b/bin/v-change-dns-record-id
similarity index 84%
rename from bin/v-change-dns-domain-record-id
rename to bin/v-change-dns-record-id
index 9a9b53585..69b6fdb93 100755
--- a/bin/v-change-dns-domain-record-id
+++ b/bin/v-change-dns-record-id
@@ -1,6 +1,6 @@
#!/bin/bash
# info: change dns domain record id
-# options: USER DOMAIN ID NEWID
+# options: USER DOMAIN ID NEWID [RESTART]
#
# The function for changing internal record id.
@@ -16,6 +16,7 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
domain_idn=$(idn -t --quiet -a "$domain")
id=$3
newid=$4
+restart=$5
# Includes
source $VESTA/conf/vesta.conf
@@ -27,7 +28,7 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
-check_args '4' "$#" 'USER DOMAIN ID NEWID'
+check_args '4' "$#" 'USER DOMAIN ID NEWID [RESTART]'
validate_format 'user' 'domain' 'id' 'newid'
is_system_enabled "$DNS_SYSTEM"
is_object_valid 'user' 'USER' "$user"
@@ -38,7 +39,6 @@ is_object_valid "dns/$domain" 'ID' "$id"
is_object_new "dns/$domain" 'ID' "$newid"
-
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
@@ -52,13 +52,21 @@ sort_dns_records
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-add-remote-dns-domain $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart named
-$BIN/v-restart-dns "$EVENT"
+if [ "$restart" != 'no' ]; then
+ $BIN/v-restart-dns
+fi
# Logging
log_history "changed dns record id on $domain"
diff --git a/bin/v-change-remote-dns-domain-exp b/bin/v-change-remote-dns-domain-exp
new file mode 100755
index 000000000..ea3d01ad1
--- /dev/null
+++ b/bin/v-change-remote-dns-domain-exp
@@ -0,0 +1,113 @@
+#!/bin/bash
+# info: change remote dns domain expiriation date
+# options: USER DOMAIN
+#
+# The function synchronize dns domain with the remote server.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN'
+validate_format 'user' 'domain'
+is_system_enabled "$DNS_CLUSTER"
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Check dns exceptions
+ if [ -z "$DNS_CLUSTER_IGNORE" ]; then
+ DNS_CLUSTER_IGNORE='dns-cluster'
+ fi
+
+ # Sync domain
+ str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
+ eval $str
+ $send_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME 'no'
+
+done
+
+# Update pipe
+pipe="$VESTA/data/queue/dns-cluster.pipe"
+str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
+if [ ! -z "$str" ]; then
+ sed -i "$str d" $pipe
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-change-remote-dns-domain-soa b/bin/v-change-remote-dns-domain-soa
new file mode 100755
index 000000000..e08f2d40d
--- /dev/null
+++ b/bin/v-change-remote-dns-domain-soa
@@ -0,0 +1,121 @@
+#!/bin/bash
+# info: change remote dns domain SOA
+# options: USER DOMAIN
+#
+# The function synchronize dns domain with the remote server.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN'
+validate_format 'user' 'domain'
+is_system_enabled "$DNS_CLUSTER"
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Check dns exceptions
+ if [ -z "$DNS_CLUSTER_IGNORE" ]; then
+ DNS_CLUSTER_IGNORE='dns-cluster'
+ fi
+
+ # Sync domain
+ str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
+ eval $str
+ $send_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME 'no'
+
+ # Rebuild dns zone
+ $send_cmd v-rebuild-dns-domain $DNS_USER $domain no
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed (rebuild)"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+done
+
+# Update pipe
+pipe="$VESTA/data/queue/dns-cluster.pipe"
+str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
+if [ ! -z "$str" ]; then
+ sed -i "$str d" $pipe
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-change-remote-dns-domain-ttl b/bin/v-change-remote-dns-domain-ttl
new file mode 100755
index 000000000..0b0d11296
--- /dev/null
+++ b/bin/v-change-remote-dns-domain-ttl
@@ -0,0 +1,120 @@
+#!/bin/bash
+# info: change remote dns domain TTL
+# options: USER DOMAIN
+#
+# The function synchronize dns domain with the remote server.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN'
+validate_format 'user' 'domain'
+is_system_enabled "$DNS_CLUSTER"
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Check dns exceptions
+ if [ -z "$DNS_CLUSTER_IGNORE" ]; then
+ DNS_CLUSTER_IGNORE='dns-cluster'
+ fi
+
+ # Sync domain
+ str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
+ eval $str
+ $send_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME 'no'
+
+ # Rebuild dns zone
+ $send_cmd v-rebuild-dns-domain $DNS_USER $domain no
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed (rebuild)"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+done
+
+# Update pipe
+pipe="$VESTA/data/queue/dns-cluster.pipe"
+str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
+if [ ! -z "$str" ]; then
+ sed -i "$str d" $pipe
+fi
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-delete-dns-domain b/bin/v-delete-dns-domain
index fa674d3d4..d9a8bf645 100755
--- a/bin/v-delete-dns-domain
+++ b/bin/v-delete-dns-domain
@@ -41,9 +41,15 @@ is_object_unsuspended 'dns' 'DOMAIN' "$domain"
records=$(wc -l $USER_DATA/dns/$domain.conf | cut -f 1 -d ' ')
# Deleting domain in named.conf
-sed -i "/\/$domain.db\"/d" /etc/named.conf
+sed -i "/\/$user\/conf\/dns\/$domain.db\"/d" /etc/named.conf
rm -f $HOMEDIR/$user/conf/dns/$domain.db
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-delete-remote-dns-domain $user $domain"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
@@ -62,7 +68,6 @@ if [ "$restart" != 'no' ]; then
$BIN/v-restart-dns "$EVENT"
fi
-
# Logging
log_history "deleted dns domain $domain"
log_event "$OK" "$EVENT"
diff --git a/bin/v-delete-dns-domains-src b/bin/v-delete-dns-domains-src
new file mode 100755
index 000000000..2e69d3c17
--- /dev/null
+++ b/bin/v-delete-dns-domains-src
@@ -0,0 +1,54 @@
+#!/bin/bash
+# info: delete dns domains based on SRC field
+# options: USER SRC [RESTART]
+#
+# The function for deleting DNS domains related to a certain host.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+src=$2
+restart=$3
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER SRC [RESTART]'
+validate_format 'user' 'src'
+is_system_enabled "$DNS_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+# Starting delete loop
+for domain in $(search_objects 'dns' 'SRC' "$src" 'DOMAIN'); do
+ $BIN/v-delete-dns-domain "$user" "$domain" 'no'
+done
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+# Restart named
+if [ "$restart" != 'no' ]; then
+ $BIN/v-restart-dns "$EVENT"
+fi
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit
diff --git a/bin/v-delete-dns-on-web-alias b/bin/v-delete-dns-on-web-alias
index 50c1e1d71..0d6d05677 100755
--- a/bin/v-delete-dns-on-web-alias
+++ b/bin/v-delete-dns-on-web-alias
@@ -63,7 +63,7 @@ else
fi
if [ ! -z "$rec" ]; then
eval "$rec"
- $BIN/v-delete-dns-domain-record $user "$root" "$ID"
+ $BIN/v-delete-dns-record $user "$root" "$ID"
fi
fi
fi
diff --git a/bin/v-delete-dns-domain-record b/bin/v-delete-dns-record
similarity index 84%
rename from bin/v-delete-dns-domain-record
rename to bin/v-delete-dns-record
index c2b1491b6..7998cf1b6 100755
--- a/bin/v-delete-dns-domain-record
+++ b/bin/v-delete-dns-record
@@ -1,6 +1,6 @@
#!/bin/bash
# info: delete dns record
-# options: USER DOMAIN ID
+# options: USER DOMAIN ID [RESTART]
#
# The function for deleting a certain record of DNS zone.
@@ -14,6 +14,7 @@ user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
id=$3
+restart=$4
# Includes
source $VESTA/conf/vesta.conf
@@ -25,7 +26,7 @@ source $VESTA/func/domain.sh
# Verifications #
#----------------------------------------------------------#
-check_args '3' "$#" 'USER DOMAIN ID'
+check_args '3' "$#" 'USER DOMAIN ID [RESTART]'
validate_format 'user' 'domain' 'id'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
@@ -44,6 +45,12 @@ sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf
# Updating zone
update_domain_zone
+# dns-cluster
+if [ ! -z "$DNS_CLUSTER" ]; then
+ cmd="v-delete-remote-dns-record $user $domain $id"
+ echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
+fi
+
#----------------------------------------------------------#
# Vesta #
@@ -55,7 +62,9 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
decrease_user_value "$user" '$U_DNS_RECORDS'
# Restart named
-$BIN/v-restart-dns "$EVENT"
+if [ "$restart" != 'no' ]; then
+ $BIN/v-restart-dns
+fi
# Logging
log_history "deleted dns record $id on $domain"
diff --git a/bin/v-delete-mail-domain-dkim b/bin/v-delete-mail-domain-dkim
index 880283317..2e7634334 100755
--- a/bin/v-delete-mail-domain-dkim
+++ b/bin/v-delete-mail-domain-dkim
@@ -46,10 +46,10 @@ rm -f $HOMEDIR/$user/conf/mail/$domain/dkim.pem
# Checking dns domain
check_dns_domain=$(is_object_valid 'dns' 'DOMAIN' "$domain")
if [ "$?" -eq 0 ]; then
- records=$($BIN/v-list-dns-domain-records $user $domain plain)
+ records=$($BIN/v-list-dns-records $user $domain plain)
dkim_records=$(echo "$records" |grep -w '_domainkey' | cut -f 1 -d ' ')
for id in $dkim_records; do
- $BIN/v-delete-dns-domain-record $user $domain $id
+ $BIN/v-delete-dns-record $user $domain $id
done
fi
diff --git a/bin/v-delete-remote-dns-domain b/bin/v-delete-remote-dns-domain
new file mode 100755
index 000000000..a11d803e6
--- /dev/null
+++ b/bin/v-delete-remote-dns-domain
@@ -0,0 +1,109 @@
+#!/bin/bash
+# info: delete remote dns domain
+# options: USER DOMAIN
+#
+# The function synchronize dns with the remote server.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN'
+validate_format 'user' 'domain'
+is_system_enabled "$DNS_CLUSTER"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Check dns exceptions
+ if [ -z "$DNS_CLUSTER_IGNORE" ]; then
+ DNS_CLUSTER_IGNORE='dns-cluster'
+ fi
+
+ # Sync domain
+ $send_cmd v-delete-dns-domain $DNS_USER $domain 'no'
+
+done
+
+# Update pipe
+pipe="$VESTA/data/queue/dns-cluster.pipe"
+str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
+if [ ! -z "$str" ]; then
+ sed -i "$str d" $pipe
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-delete-remote-dns-record b/bin/v-delete-remote-dns-record
new file mode 100755
index 000000000..d7355b095
--- /dev/null
+++ b/bin/v-delete-remote-dns-record
@@ -0,0 +1,105 @@
+#!/bin/bash
+# info: delete remote dns domain record
+# options: USER DOMAIN ID
+#
+# The function synchronize dns with the remote server.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+id=$3
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'USER DOMAIN ID'
+validate_format 'user' 'domain' 'id'
+is_system_enabled "$DNS_CLUSTER"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Sync domain
+ $send_cmd v-delete-dns-record $DNS_USER $domain $id 'no'
+
+done
+
+# Update pipe
+pipe="$VESTA/data/queue/dns-cluster.pipe"
+str=$(grep -n "$SCRIPT $1 $2 &3$" $pipe | cut -f1 -d: | head -n1)
+if [ ! -z "$str" ]; then
+ sed -i "$str d" $pipe
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-insert-dns-domain b/bin/v-insert-dns-domain
new file mode 100755
index 000000000..b06a78f7b
--- /dev/null
+++ b/bin/v-insert-dns-domain
@@ -0,0 +1,62 @@
+#!/bin/bash
+# info: insert dns domain
+# options: USER DATA [SRC] [FLUSH]
+#
+# The function inserts raw record to the dns.conf
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+data=$2
+src=$3
+flush=$4
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DATA [SRC]'
+validate_format 'user' 'data'
+is_system_enabled "$DNS_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+# Prepare values for the insert
+eval $data
+dns_rec="DOMAIN='$DOMAIN' IP='$IP' TPL='$TPL' TTL='$TTL' EXP='$EXP'"
+dns_rec="$dns_rec SOA='$SOA' SRC='$src' RECORDS='$RECORDS'"
+dns_rec="$dns_rec SUSPENDED='$SUSPENDED' TIME='$TIME' DATE='$DATE'"
+sed -i "/DOMAIN='$DOMAIN'/d" $USER_DATA/dns.conf 2> /dev/null
+echo "$dns_rec" >> $USER_DATA/dns.conf
+chmod 660 $USER_DATA/dns.conf
+
+# Flush dns records
+if [ "$flush" != 'no' ]; then
+ rm -f $USER_DATA/dns/$DOMAIN.conf
+ touch $USER_DATA/dns/$DOMAIN.conf
+ chmod 660 $USER_DATA/dns/$DOMAIN.conf
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit
diff --git a/bin/v-insert-dns-record b/bin/v-insert-dns-record
new file mode 100755
index 000000000..37d5a4b9e
--- /dev/null
+++ b/bin/v-insert-dns-record
@@ -0,0 +1,49 @@
+#!/bin/bash
+# info: insert dns record
+# options: USER DOMAIN DATA
+#
+# The function inserts raw dns record to the domain conf
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+data=$3
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'USER DOMAIN DATA'
+validate_format 'user' 'domain' 'data'
+is_system_enabled "$DNS_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+# Insert values
+echo "$data" >> $USER_DATA/dns/$domain.conf
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit
diff --git a/bin/v-insert-dns-records b/bin/v-insert-dns-records
new file mode 100755
index 000000000..83b561e34
--- /dev/null
+++ b/bin/v-insert-dns-records
@@ -0,0 +1,52 @@
+#!/bin/bash
+# info: inserts dns records
+# options: USER DOMAIN DATA_FILE
+#
+# The function copy dns record to the domain conf
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+data_file=$3
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'USER DOMAIN DATAFILE'
+validate_format 'user' 'domain' 'data_file'
+is_system_enabled "$DNS_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+# Insert values
+if [ -e "$data_file" ]; then
+ mv -f $data_file $USER_DATA/dns/$domain.conf
+ chmod 660 $USER_DATA/dns/$domain.conf
+fi
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit
diff --git a/bin/v-list-dns-domains b/bin/v-list-dns-domains
index 10ccafa5b..07cda1c6a 100755
--- a/bin/v-list-dns-domains
+++ b/bin/v-list-dns-domains
@@ -32,7 +32,7 @@ is_object_valid 'user' 'USER' "$user"
# Defining config and fields
conf=$USER_DATA/dns.conf
-fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $RECORDS $SUSPENDED $TIME $DATE'
+fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $SRC $RECORDS $SUSPENDED $TIME $DATE'
# Listing domains
case $format in
diff --git a/bin/v-list-dns-domains-src b/bin/v-list-dns-domains-src
new file mode 100755
index 000000000..0ac5cae3f
--- /dev/null
+++ b/bin/v-list-dns-domains-src
@@ -0,0 +1,51 @@
+#!/bin/bash
+# info: list dns domains
+# options: USER [FORMAT]
+#
+# The function for obtaining all DNS domains of a user.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+format=${2-shell}
+
+# Includes
+source $VESTA/func/main.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '1' "$#" 'USER [FORMAT]'
+validate_format 'user'
+is_object_valid 'user' 'USER' "$user"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+# Defining config and fields
+conf=$USER_DATA/dns.conf
+fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $SRC $RECORDS $SUSPENDED $TIME $DATE'
+
+# Listing domains
+case $format in
+ json) json_list ;;
+ plain) nohead=1; shell_list ;;
+ shell) fields='$DOMAIN $IP $SRC $DATE';
+ shell_list| column -t ;;
+ *) check_args '1' '0' 'USER [FORMAT]';;
+esac
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-list-dns-domain-records b/bin/v-list-dns-records
similarity index 100%
rename from bin/v-list-dns-domain-records
rename to bin/v-list-dns-records
diff --git a/bin/v-rebuild-dns-domain b/bin/v-rebuild-dns-domain
new file mode 100755
index 000000000..5f5790271
--- /dev/null
+++ b/bin/v-rebuild-dns-domain
@@ -0,0 +1,77 @@
+#!/bin/bash
+# info: rebuild dns domain
+# options: USER DOMAIN [RESTART]
+#
+# The function rebuilds DNS configuration files.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+restart=$3
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/domain.sh
+source $VESTA/func/rebuild.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN [RESTART]'
+validate_format 'user' 'domain'
+is_system_enabled "$DNS_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+user_domains=0
+user_records=0
+suspended_dns=0
+conf="$USER_DATA/dns.conf"
+
+# Defining user name servers
+ns=$(get_user_value '$NS')
+i=1
+for nameserver in ${ns//,/ };do
+ eval ns$i="$nameserver"
+ i=$((i + 1))
+done
+
+# Remove old user's zone
+sed -i "/\/$user\/conf\/dns/d" /etc/named.conf
+
+# Starting loop
+rebuild_dns_domain_conf
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+# Updating counters
+update_user_value "$user" '$U_DNS_DOMAINS' "$user_domains"
+update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
+update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
+
+# Restart named
+if [ "$restart" != 'no' ]; then
+ $BIN/v-restart-dns "$EVENT"
+fi
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit
diff --git a/bin/v-rebuild-dns-domains b/bin/v-rebuild-dns-domains
index 72f95f785..2623d5c3f 100755
--- a/bin/v-rebuild-dns-domains
+++ b/bin/v-rebuild-dns-domains
@@ -2,7 +2,7 @@
# info: rebuild dns domains
# options: USER [RESTART]
#
-# The function rebuilds BIND configuration files for all dns domains.
+# The function rebuilds DNS configuration files.
#----------------------------------------------------------#
diff --git a/bin/v-rebuild-web-domains b/bin/v-rebuild-web-domains
index f9f7d12b9..d1eaf5b0f 100755
--- a/bin/v-rebuild-web-domains
+++ b/bin/v-rebuild-web-domains
@@ -2,7 +2,7 @@
# info: rebuild dns domains
# options: USER [RESTART]
#
-# The function rebuilds BIND configuration files for all dns domains.
+# The function rebuilds web configuration files.
#----------------------------------------------------------#
diff --git a/bin/v-suspend-dns-domain-record b/bin/v-suspend-dns-record
similarity index 100%
rename from bin/v-suspend-dns-domain-record
rename to bin/v-suspend-dns-record
diff --git a/bin/v-sync-dns-cluster b/bin/v-sync-dns-cluster
new file mode 100755
index 000000000..61051af45
--- /dev/null
+++ b/bin/v-sync-dns-cluster
@@ -0,0 +1,157 @@
+#!/bin/bash
+# info: synchronize dns domains
+#
+# The function synchronize all dns domains.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+verbose=$1
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/remote.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+is_system_enabled "$DNS_CLUSTER"
+
+if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then
+ echo "Error: dns-cluster.conf doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+fi
+
+number_of_proc=$(ps auxf | grep -v grep | grep $VESTA/bin/$SCRIPT | wc -l)
+if [ "$number_of_proc" -gt 2 ]; then
+ echo "Error: another sync process already exists"
+ log_event "$E_EXISTS $EVENT"
+ exit $E_EXISTS
+fi
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+old_ifs="$IFS"
+IFS=$'\n'
+
+# Starting cluster loop
+for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+
+ # Get host values
+ eval $cluster_str
+
+ # Check connection type
+ if [ -z "TYPE" ]; then
+ TYPE='api'
+ fi
+
+ # Print hostname
+ if [ ! -z "$verbose" ]; then
+ echo "HOSTNAME: $HOSTNAME"
+ echo "TYPE: $TYPE"
+ fi
+
+ # Switch on connection type
+ case $TYPE in
+ ssh) send_cmd="send_ssh_cmd" ;;
+ *) send_cmd="send_api_cmd" ;;
+ esac
+
+ # Check host connection
+ $send_cmd v-list-sys-config
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Check recipient dns user
+ if [ -z "$DNS_USER" ]; then
+ DNS_USER='dns-cluster'
+ fi
+ if [ ! -z "$verbose" ]; then
+ echo "DNS_USER: $DNS_USER"
+ fi
+ $send_cmd v-list-user $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: dns user $DNS_USER doesn't exist"
+ log_event "$E_NOTEXIST $EVENT"
+ exit $E_NOTEXIST
+ fi
+
+ # Check dns exceptions
+ if [ -z "$DNS_CLUSTER_IGNORE" ]; then
+ DNS_CLUSTER_IGNORE='dns-cluster'
+ fi
+
+ # Create userlist
+ user_list=$(ls $VESTA/data/users)
+ for exception in $(echo -e "${DNS_CLUSTER_IGNORE//,/\n}"); do
+ user_list=$(echo "$user_list" | grep -v "^$exception$")
+ done
+
+ # Clean source records
+ $send_cmd v-delete-dns-domains-src $DNS_USER $HOSTNAME no
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed (cleanup)"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+ # Clean queue
+ rm -f $VESTA/data/queue/dns-cluster.pipe
+ touch $VESTA/data/queue/dns-cluster.pipe
+ chmod 660 $VESTA/data/queue/dns-cluster.pipe
+
+ # Start user loop
+ for user in $user_list; do
+
+ # Sync domain
+ for str in $(cat $VESTA/data/users/$user/dns.conf); do
+ eval $str
+ if [ ! -z "$verbose" ]; then
+ echo "DOMAIN: $DOMAIN"
+ fi
+ $send_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME
+
+ # Sync record
+ if [ "$TYPE" = 'ssh' ]; then
+ tmp=$(mktemp -u)
+ scp_cmd $USER_DATA/$user/dns/$DOMAIN.conf $tmp
+ $send_cmd v-insert-dns-records $DNS_USER $DOMAIN $tmp
+ else
+ for str in $(cat $USER_DATA/$user/dns/$DOMAIN.conf); do
+ str=$(echo "$str" | sed 's/"/\\"/g')
+ $send_cmd v-insert-dns-record \
+ $DNS_USER $DOMAIN "$str"
+ done
+ fi
+ done
+ done
+
+ # Rebuild dns zones
+ $send_cmd v-rebuild-dns-domains $DNS_USER
+ if [ $? -ne 0 ]; then
+ echo "Error: $TYPE connection to $HOST failed (rebuild)"
+ log_event "$E_CONNECT $EVENT"
+ exit $E_CONNECT
+ fi
+
+done
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+exit
diff --git a/bin/v-unsuspend-dns-domain-record b/bin/v-unsuspend-dns-record
similarity index 100%
rename from bin/v-unsuspend-dns-domain-record
rename to bin/v-unsuspend-dns-record
diff --git a/bin/v-update-sys-queue b/bin/v-update-sys-queue
index 9a132fef1..6bb433b97 100755
--- a/bin/v-update-sys-queue
+++ b/bin/v-update-sys-queue
@@ -32,27 +32,29 @@ PATH=$PATH:$BIN
#----------------------------------------------------------#
check_args '1' "$#" 'QUEUE'
-b_task=$(ps auxf |grep -v "grep" |grep "$VESTA/bin/v-update-sys-queue backup")
-b_task=$(echo "$b_task" |grep -v sudo |wc -l)
-if [ "$b_task" -gt 2 ]; then
- exit
-fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
+b_task=$(ps auxf |grep -v "grep" |grep "$VESTA/bin/v-update-sys-queue backup")
+b_task=$(echo "$b_task" |grep -v sudo |wc -l)
+d_task=$(ps auxf |grep -v "grep" |grep "$VESTA/bin/v-update-sys-queue dns")
+d_task=$(echo "$d_task" |grep -v sudo |wc -l)
+if [ "$b_task" -gt 2 ] || [ "$d_task" -gt 2 ]; then
+ exit
+fi
+
# Defining pipe functions
case $queue in
- restart) bash $VESTA/data/queue/restart.pipe;
- rm $VESTA/data/queue/restart.pipe;
- touch $VESTA/data/queue/restart.pipe;;
- webstats) bash $VESTA/data/queue/webstats.pipe > /dev/null 2>&1 ;;
- backup) bash $VESTA/data/queue/backup.pipe > /dev/null 2>&1 ;;
- disk) bash $VESTA/data/queue/disk.pipe;;
- traffic) bash $VESTA/data/queue/traffic.pipe;;
- *) check_args '1' '0' 'QUEUE'
+ restart) bash $VESTA/data/queue/$queue.pipe ;;
+ webstats) bash $VESTA/data/queue/$queue.pipe > /dev/null 2>&1 ;;
+ backup) bash $VESTA/data/queue/$queue.pipe > /dev/null 2>&1 ;;
+ disk) bash $VESTA/data/queue/$queue.pipe ;;
+ traffic) bash $VESTA/data/queue/$queue.pipe ;;
+ dns-cluster) bash $VESTA/data/queue/$queue.pipe ;;
+ *) check_args '1' '0' 'QUEUE' ;;
esac
diff --git a/func/rebuild.sh b/func/rebuild.sh
index c08cfafc7..4cd7343e3 100644
--- a/func/rebuild.sh
+++ b/func/rebuild.sh
@@ -429,10 +429,10 @@ rebuild_mail_domain_conf() {
chmod 660 $HOMEDIR/$user/conf/mail/$domain/dkim.pem
# Deleting old dkim records
- records=$($BIN/v-list-dns-domain-records $user $domain plain)
+ records=$($BIN/v-list-dns-records $user $domain plain)
dkim_records=$(echo "$records" |grep -w '_domainkey'|cut -f 1 -d ' ')
for id in $dkim_records; do
- $BIN/v-delete-dns-domain-record $user $domain $id
+ $BIN/v-delete-dns-record $user $domain $id
done
# Adding dkim dns records
@@ -441,11 +441,11 @@ rebuild_mail_domain_conf() {
p=$(cat $pub|grep -v ' KEY---'|tr -d '\n')
record='_domainkey'
policy="\"t=y; o=~;\""
- $BIN/v-add-dns-domain-record $user $domain $record TXT "$policy"
+ $BIN/v-add-dns-record $user $domain $record TXT "$policy"
record='mail._domainkey'
slct="\"k=rsa\; p=$p\""
- $BIN/v-add-dns-domain-record $user $domain $record TXT "$slct"
+ $BIN/v-add-dns-record $user $domain $record TXT "$slct"
fi
fi
diff --git a/func/remote.sh b/func/remote.sh
new file mode 100644
index 000000000..2a2ab249e
--- /dev/null
+++ b/func/remote.sh
@@ -0,0 +1,63 @@
+send_api_cmd() {
+ if [ -z $PORT ]; then
+ PORT=8083
+ fi
+ if [ -z $USER ]; then
+ USER=admin
+ fi
+
+ auth="user=$USER&password=$PASSWORD&returncode=yes"
+ cmd="cmd=$1"
+ args="arg1=$2&arg2=$3&arg3=$4&arg4=$5&arg5=$6&arg6=$7&arg7=$8&arg8=$9"
+ answer=$(curl -s -k --data "$auth&$cmd&$args" https://$HOST:$PORT/api/)
+ if [ "$answer" != '0' ]; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+send_ssh_cmd() {
+ if [ -z $PORT ]; then
+ PORT=22
+ fi
+ if [ -z $USER ]; then
+ USER=admin
+ fi
+ if [ -z "$IDENTITY_FILE" ] && [ "$USER" = 'root' ]; then
+ IDENTITY_FILE="/root/.ssh/id_rsa"
+ fi
+ if [ -z "$IDENTITY_FILE" ]; then
+ IDENTITY_FILE="/home/$USER/.ssh/id_rsa"
+ fi
+
+ if [ "$USER" = 'root' ]; then
+ args="$VESTA/bin/$1 \"$2\" \"$3\" \"$4\" \"$5\""
+ else
+ args="sudo $VESTA/bin/$1 \"$2\" \"$3\" \"$4\" \"$5\""
+ fi
+ ssh -i $IDENTITY_FILE $USER@$HOST -p $PORT "$args" > /dev/null 2>&1
+ if [ "$?" -ne '0' ]; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+scp_cmd() {
+ if [ -z $PORT ]; then
+ PORT=22
+ fi
+ if [ -z $USER ]; then
+ USER=admin
+ fi
+ if [ -z "$IDENTITY_FILE" ]; then
+ IDENTITY_FILE="/home/admin/.ssh/id_rsa"
+ fi
+ scp -P $PORT -i $IDENTITY_FILE $1 $USER@$HOST:$2 > /dev/null 2>&1
+ if [ "$?" -ne '0' ]; then
+ return 1
+ else
+ return 0
+ fi
+}
diff --git a/web/add/dns/index.php b/web/add/dns/index.php
index 72ca29480..0526246b7 100644
--- a/web/add/dns/index.php
+++ b/web/add/dns/index.php
@@ -105,7 +105,7 @@ if (!empty($_POST['ok_rec'])) {
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
} else {
// Add DNS Record
- exec (VESTA_CMD."v-add-dns-domain-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
+ exec (VESTA_CMD."v-add-dns-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
$v_type = $_POST['v_type'];
if ($return_var != 0) {
$error = implode('
', $output);
diff --git a/web/bulk/dns/index.php b/web/bulk/dns/index.php
index 286580f14..dc672c3d8 100644
--- a/web/bulk/dns/index.php
+++ b/web/bulk/dns/index.php
@@ -23,11 +23,11 @@ if ($_SESSION['user'] == 'admin') {
}
} else {
switch ($action) {
- case 'delete': $cmd='v-delete-dns-domain-record';
+ case 'delete': $cmd='v-delete-dns-record';
break;
- case 'suspend': $cmd='v-suspend-dns-domain-record';
+ case 'suspend': $cmd='v-suspend-dns-record';
break;
- case 'unsuspend': $cmd='v-unsuspend-dns-domain-record';
+ case 'unsuspend': $cmd='v-unsuspend-dns-record';
break;
default: header("Location: /list/dns/?domain=".$domain); exit;
}
@@ -41,7 +41,7 @@ if ($_SESSION['user'] == 'admin') {
}
} else {
switch ($action) {
- case 'delete': $cmd='v-delete-dns-domain-record';
+ case 'delete': $cmd='v-delete-dns-record';
break;
default: header("Location: /list/dns/?domain=".$domain); exit;
}
diff --git a/web/delete/dns/index.php b/web/delete/dns/index.php
index 69ee31699..6b6798d81 100644
--- a/web/delete/dns/index.php
+++ b/web/delete/dns/index.php
@@ -36,7 +36,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
- exec (VESTA_CMD."v-delete-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
+ exec (VESTA_CMD."v-delete-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
if ($return_var != 0) {
$error = implode('
', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
diff --git a/web/edit/dns/index.php b/web/edit/dns/index.php
index af7ed6a4b..c2a660426 100644
--- a/web/edit/dns/index.php
+++ b/web/edit/dns/index.php
@@ -152,7 +152,7 @@ if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
} else {
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
- exec (VESTA_CMD."v-list-dns-domain-records ".$user." ".$v_domain." 'json'", $output, $return_var);
+ exec (VESTA_CMD."v-list-dns-records ".$user." ".$v_domain." 'json'", $output, $return_var);
if ($return_var != 0) {
$error = implode('
', $output);
if (empty($error)) $error = __('Error code:',$return_var);
@@ -184,7 +184,7 @@ if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
if (($v_val != $_POST['v_val']) || ($v_priority != $_POST['v_priority']) && (empty($_SESSION['error_msg']))) {
$v_val = escapeshellarg($_POST['v_val']);
$v_priority = escapeshellarg($_POST['v_priority']);
- exec (VESTA_CMD."v-change-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var);
+ exec (VESTA_CMD."v-change-dns-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var);
if ($return_var != 0) {
$error = implode('
', $output);
if (empty($error)) $error = __('Error code:',$return_var);
@@ -198,7 +198,7 @@ if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
if (($_GET['record_id'] != $_POST['v_record_id']) && (empty($_SESSION['error_msg']))) {
$v_old_record_id = escapeshellarg($_GET['record_id']);
- exec (VESTA_CMD."v-change-dns-domain-record-id ".$v_username." ".$v_domain." ".$v_old_record_id." ".$v_record_id, $output, $return_var);
+ exec (VESTA_CMD."v-change-dns-record-id ".$v_username." ".$v_domain." ".$v_old_record_id." ".$v_record_id, $output, $return_var);
if ($return_var != 0) {
$error = implode('
', $output);
if (empty($error)) $error = __('Error code:',$return_var);
diff --git a/web/list/dns/index.php b/web/list/dns/index.php
index 06f4419b2..eb7f65282 100644
--- a/web/list/dns/index.php
+++ b/web/list/dns/index.php
@@ -23,7 +23,7 @@ if (empty($_GET['domain'])){
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_dns.html');
}
} else {
- exec (VESTA_CMD."v-list-dns-domain-records '".$user."' '".$_GET['domain']."' 'json'", $output, $return_var);
+ exec (VESTA_CMD."v-list-dns-records '".$user."' '".$_GET['domain']."' 'json'", $output, $return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data, true);
unset($output);
diff --git a/web/suspend/dns/index.php b/web/suspend/dns/index.php
index ffe0c9789..5e268a5f5 100644
--- a/web/suspend/dns/index.php
+++ b/web/suspend/dns/index.php
@@ -35,7 +35,7 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
- exec (VESTA_CMD."v-suspend-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
+ exec (VESTA_CMD."v-suspend-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
if ($return_var != 0) {
$error = implode('
', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
diff --git a/web/templates/admin/list_dns.html b/web/templates/admin/list_dns.html
index 56cb6417d..d886d9248 100644
--- a/web/templates/admin/list_dns.html
+++ b/web/templates/admin/list_dns.html
@@ -46,8 +46,8 @@
|
@@ -100,10 +100,15 @@
|
diff --git a/web/unsuspend/dns/index.php b/web/unsuspend/dns/index.php
index dcb042246..bc90ba97b 100644
--- a/web/unsuspend/dns/index.php
+++ b/web/unsuspend/dns/index.php
@@ -35,7 +35,7 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
- exec (VESTA_CMD."v-unsuspend-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
+ exec (VESTA_CMD."v-unsuspend-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
if ($return_var != 0) {
$error = implode(' ', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
|