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.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
Visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from 
this list

ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.


bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Reply via email to