HTTP API for bind

Brian J. Murrell brian at interlinx.bc.ca
Fri May 26 12:22:04 UTC 2023


On Fri, 2023-05-26 at 16:51 +0530, Shailendra Gautam wrote:
> Does bind provide any way to manage(add,update,delete) resource
> records
> with HTTP API, like powerdns?

Not TTBOMK.  It does have an API for managing RRs but that is using RFC
2136 and not HTTP.

> I currently use zonefiles to store DNS data
> and have been planning to switch to an API to add/remove records. Is
> there
> any way to do that with bind?

Sounds like you want a tool which has an HTTP API and can translate
those calls into the RFC 2136 update protocol.

Or you could just use the RFC 2136 update protocol directly.

Or you could use CLI tools supplied with BIND even, such as "nsupdate"
that can do updates.

If you really want an HTTP API, I guess you could start doing searches
for "RFC2136 HTTP" and see if anyone has implemented such a thing.

Maybe https://github.com/frillip/noip-rfc2136 does what you want.

Perhaps there are others.  I will leave that search as an exercise for
the reader.

Or you could even write your own.  I have a faint recollection of
writing such a thing as a CGI script in the past.  It should not be
terribly difficult.  Yeah.  I found it:

#!/bin/bash

key_name="put your key name here"

args_string=${REQUEST_URI##*\?}
eval "${args_string//\&/ }"

# undo url encoding
pass=${pass//\%2F/\/}
pass=${pass//\%3D/=}

cat <<EOF >/tmp/kfile.key
$key_name IN KEY 512 3 157 $pass

EOF
cat <<EOF >/tmp/kfile.private
Private-key-format: v1.2
Algorithm: 157 (HMAC_MD5)
Key: $pass
EOF

oldip=$(host $host | sed -e 's/.* has address //')

echo "server localhost
update delete $host 0 IN A $oldip
update add $host 60 IN A $REMOTE_ADDR
send" | nsupdate -d -k /tmp/kfile >&2

rm -f /tmp/kfile.*

echo "Content-type: text/html

good $REMOTE_ADDR"


But most likely you will want to use that GitHub project I pointed out
above rather than my Q&D hack above.  Above is just to illustrate how
basic and simple it could be.

Cheers,
b.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20230526/a4c16a55/attachment.sig>


More information about the bind-users mailing list