Browse Source

Verified working again?

master
Niten 1 year ago
parent
commit
c0e4d12fb7
  1. 9
      README.md
  2. 17
      backplane-dns.lisp

9
README.md

@ -1,9 +1,10 @@
# dns-backplane
### _Your Name <your.name@example.com>_
# backplane-dns
### _Niten <niten@fudo.org>_
This is a project to do ... something.
Common lisp server to listen on an XMPP backplane connection for notifications
of DNS changes, and update a postgresql database accordingly. The data can then
be served by PowerDNS with the gpgsql backend.
## License
Specify license here

17
backplane-dns.lisp

@ -73,7 +73,7 @@
(make-instance 'result/error :message msg))
(defparameter *hostname-rx*
"([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])")
"(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])")
(defun get-domain (name)
(car (select-dao 'dns-domain (:= 'name name))))
@ -86,14 +86,14 @@
(get-domain)
(id))))
(car (select-dao 'dns-record
(:= 'name hostname)
(:= 'name (format nil "~A.~A" hostname domain))
(:= 'domain-id domain-id)
(:= 'type "A")))
(error 'domain-name-missing :domain domain)))
(defun set-host-v4ip (host domain v4ip)
(let* ((full-hostname (format nil "~A.~A" host domain))
(a-record (host-a-record full-hostname domain)))
(a-record (host-a-record host domain)))
(if a-record
(progn (setf (record-content a-record) v4ip)
(update-dao a-record))
@ -175,7 +175,7 @@
(xmpp:auth backplane
xmpp-username
xmpp-password
"server"
(format nil "backplane-~A" (machine-instance))
:mechanism :sasl-plain)
(funcall f backplane)))
@ -188,10 +188,11 @@
db-username
db-password
db-tls)
(postmodern:with-connection (list db-name db-username db-password db-host)
(with-backplane xmpp-host xmpp-username xmpp-password
(lambda (backplane)
(xmpp:receive-stanza-loop backplane)))))
(let ((postmodern:*ignore-unknown-columns* t))
(postmodern:with-connection (list db-name db-username db-password db-host)
(with-backplane xmpp-host xmpp-username xmpp-password
(lambda (backplane)
(xmpp:receive-stanza-loop backplane))))))
(defun read-file-line (filename)
(let ((input (open filename :if-does-not-exist nil)))

Loading…
Cancel
Save