mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 13:54:28 -07:00
suspend dns record page
This commit is contained in:
parent
a968f9bd4a
commit
b306202a80
19 changed files with 583 additions and 28 deletions
|
@ -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
71
bin/v_suspend_dns_domain_record
Executable 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
|
|
@ -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
|
||||
|
|
70
bin/v_unsuspend_dns_domain_record
Executable file
70
bin/v_unsuspend_dns_domain_record
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue