You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
743 B

  1. #!/usr/bin/env sh
  2. ######## Public functions #####################
  3. #Usage: dns_nsupdate_l_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
  4. dns_nsupdate_l_add() {
  5. fulldomain=$1
  6. txtvalue=$2
  7. _info "adding ${fulldomain}. 60 in txt \"${txtvalue}\""
  8. nsupdate -l <<EOF
  9. update add ${fulldomain}. 60 in txt "${txtvalue}"
  10. send
  11. EOF
  12. if [ $? -ne 0 ]; then
  13. _err "error updating domain"
  14. return 1
  15. fi
  16. return 0
  17. }
  18. #Usage: dns_nsupdate_l_rm _acme-challenge.www.domain.com
  19. dns_nsupdate_l_rm() {
  20. fulldomain=$1
  21. _info "removing ${fulldomain}. txt"
  22. nsupdate -l <<EOF
  23. update delete ${fulldomain}. txt
  24. send
  25. EOF
  26. if [ $? -ne 0 ]; then
  27. _err "error updating domain"
  28. return 1
  29. fi
  30. return 0
  31. }