;;; Tyreunom's system administration and configuration tools. ;;; ;;; Copyright © 2019 Julien Lepiller ;;; ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . ;; ;; DNS services ;; (define-module (config dns) #:use-module (data dns) #:use-module (gnu services) #:use-module (gnu services dns) #:use-module (srfi srfi-1) #:export (ipv4-reverse-master-zone ipv6-reverse-master-zone lepiller-master-zone)) (define-zone-entries lepiller.eu.zone ;; Name TTL Class Type Data ("ene" "" "IN" "A" ene-ip4) ("hermes" "" "IN" "A" hermes-ip4) ("hermes" "" "IN" "AAAA" hermes-ip6) ("xana" "" "IN" "A" xana-ip4) ("@" "" "IN" "CNAME" "hermes") ("www" "" "IN" "CNAME" "lepiller.eu.") ("avatar" "" "IN" "CNAME" "ene") ("rennes" "" "IN" "CNAME" "ene") ("@" "" "IN" "NS" "ns") ("@" "" "IN" "NS" "ns2") ("ns" "" "IN" "A" hermes-ip4) ("ns" "" "IN" "AAAA" hermes-ip6) ("ns2" "" "IN" "A" ene-ip4) ("@" "" "IN" "NS" "10 courriel") ("@" "" "IN" "NS" "50 b.courriel") ("b.courriel" "" "IN" "A" hermes-ip4) ("b.courriel" "" "IN" "AAAA" hermes-ip6) ("courriel" "" "IN" "A" ene-ip4) ("imap" "" "IN" "CNAME" "courriel") ("smtp" "" "IN" "CNAME" "b.courriel") ("@" "" "IN" "TXT" "v=spf1 mx a ~all") ("@" "" "IN" "SPF" "v=spf1 mx a ~all")) (define-zone-entries ipv4-reverse.zone ("@" "" "IN" "PTR" "lepiller.eu.")) (define-zone-entries ipv6-reverse.zone ("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0" "" "IN" "PTR" "lepiller.eu.")) (define lepiller-master-zone (knot-zone-configuration (domain "lepiller.eu") (dnssec-policy "default") (zone (zone-file (origin "lepiller.eu") (entries lepiller.eu.zone) (serial 2019032201))))) (define ipv6-reverse-master-zone (let* ((ip6 (string->list (substring (string-delete hermes-ip6 #\:) 0 12))) (rev-ip6-lst (fold (lambda (elem acc) (cons* #\. elem acc)) '() ip6)) (rev-ip6 (list->string (cdr rev-ip6-lst))) (domain (string-append rev-ip6 ".ip6.arpa"))) (knot-zone-configuration (domain domain) (zone (zone-file (origin domain) (entries ipv6-reverse.zone) (ns "ns.lepiller.eu.") (mail "hostmaster.lepiller.eu.") (serial 1)))))) (define ipv4-reverse-master-zone (let ((domain (string-append (string-join (reverse (string-split hermes-ip4 #\.)) ".") ".in-addr.arpa"))) (knot-zone-configuration (domain domain) (zone (zone-file (origin domain) (entries ipv4-reverse.zone) (ns "ns.lepiller.eu.") (mail "hostmaster.lepiller.eu.") (serial 1))))))