suspend dns record page

This commit is contained in:
Serghey Rodin 2012-06-14 17:25:38 +03:00
commit b306202a80
19 changed files with 583 additions and 28 deletions

View file

@ -46,6 +46,7 @@ sed -i "/\/$domain.db\"/d" /etc/named.conf
# Adding suspend in config
update_object_value 'dns' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
sed -i "s/SUSPENDED='no'/SUSPENDED='yes'/g" $USER_DATA/dns/$domain.conf
increase_user_value "$user" '$SUSPENDED_DNS'
# Restart named

71
bin/v_suspend_dns_domain_record Executable file
View file

@ -0,0 +1,71 @@
#!/bin/bash
# info: suspend dns domain record
# options: user domain id [restart]
#
# The function suspends a certain domain record.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
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
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'user domain id [restart]'
validate_format 'user' 'domain' 'id'
is_system_enabled "$DNS_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_valid 'dns' 'DOMAIN' "$domain"
is_object_unsuspended 'dns' 'DOMAIN' "$domain"
is_object_valid "dns/$domain" 'ID' "$id"
is_object_unsuspended "dns/$domain" 'ID' "$id"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
line=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
eval $line
sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf
# Adding record
dns_rec="ID='$id' RECORD='$RECORD' TYPE='$TYPE' PRIORITY='$PRIORITY'"
dns_rec="$dns_rec VALUE='$VALUE' SUSPENDED='yes' TIME='$TIME' DATE='$DATE'"
echo "$dns_rec" >> $USER_DATA/dns/$domain.conf
# Sorting records
sort_dns_records
# Updating zone
update_domain_zone
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart named
if [ "$restart" != 'no' ]; then
$BIN/v_restart_dns "$EVENT"
fi
# Logging
log_event "$OK" "$EVENT"
exit

View file

@ -47,6 +47,8 @@ echo "zone \"$domain\" { type master; file \"/etc/namedb/$domain.db\"; };" \
# Unsuspending domain in config
update_object_value 'dns' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_DNS'
sed -i "s/SUSPENDED='yes'/SUSPENDED='no'/g" $USER_DATA/dns/$domain.conf
# Restart named
if [ "$restart" != 'no' ]; then

View file

@ -0,0 +1,70 @@
#!/bin/bash
# info: unsuspend dns domain record
# options: user domain id [restart]
#
# The function unsuspends a certain domain record.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
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
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'user domain id [restart]'
validate_format 'user' 'domain' 'id'
is_system_enabled "$DNS_SYSTEM"
is_object_valid 'user' 'USER' "$user"
is_object_valid 'dns' 'DOMAIN' "$domain"
is_object_unsuspended 'dns' 'DOMAIN' "$domain"
is_object_valid "dns/$domain" 'ID' "$id"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
line=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
eval $line
sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf
# Adding record
dns_rec="ID='$id' RECORD='$RECORD' TYPE='$TYPE' PRIORITY='$PRIORITY'"
dns_rec="$dns_rec VALUE='$VALUE' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
echo "$dns_rec" >> $USER_DATA/dns/$domain.conf
# Sorting records
sort_dns_records
# Updating zone
update_domain_zone
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart named
if [ "$restart" != 'no' ]; then
$BIN/v_restart_dns "$EVENT"
fi
# Logging
log_event "$OK" "$EVENT"
exit