v_change_dns_domain_soa 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. # info: change dns domain soa record
  3. # options: user domain soa
  4. #
  5. # The function for changing SOA record. This type of records can not be
  6. # modified by v_change_dns_domain_record call.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument defenition
  11. user=$1
  12. domain=$(idn -t --quiet -u "$2" )
  13. domain_idn=$(idn -t --quiet -a "$domain")
  14. soa=$3
  15. # Includes
  16. source $VESTA/conf/vesta.conf
  17. source $VESTA/func/main.sh
  18. source $VESTA/func/domain.sh
  19. #----------------------------------------------------------#
  20. # Verifications #
  21. #----------------------------------------------------------#
  22. check_args '3' "$#" 'user domain soa'
  23. validate_format 'user' 'domain' 'soa'
  24. is_system_enabled "$DNS_SYSTEM"
  25. is_object_valid 'user' 'USER' "$user"
  26. is_object_unsuspended 'user' 'USER' "$user"
  27. is_object_valid 'dns' 'DOMAIN' "$domain"
  28. is_object_unsuspended 'dns' 'DOMAIN' "$domain"
  29. #----------------------------------------------------------#
  30. # Action #
  31. #----------------------------------------------------------#
  32. # Changing soa
  33. update_object_value 'dns' 'DOMAIN' "$domain" '$SOA' "$soa"
  34. # Updating zone
  35. update_domain_zone
  36. #----------------------------------------------------------#
  37. # Vesta #
  38. #----------------------------------------------------------#
  39. # Restart named
  40. $BIN/v_restart_dns "$EVENT"
  41. # Logging
  42. log_history "$EVENT"
  43. log_event "$OK" "$EVENT"
  44. exit