From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Pykhalov Subject: isc-bind service draft Date: Thu, 09 Nov 2017 23:11:13 +0300 Message-ID: <87vaijkyam.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCtAY-0005xP-7Y for guix-devel@gnu.org; Thu, 09 Nov 2017 15:11:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCtAT-00077r-TI for guix-devel@gnu.org; Thu, 09 Nov 2017 15:11:22 -0500 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:57311) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eCtAT-00077E-Gp for guix-devel@gnu.org; Thu, 09 Nov 2017 15:11:17 -0500 Received: by mail-lf0-x232.google.com with SMTP id 90so8602287lfs.13 for ; Thu, 09 Nov 2017 12:11:17 -0800 (PST) Received: from magnolia (ppp78-37-130-163.pppoe.avangarddsl.ru. [78.37.130.163]) by smtp.gmail.com with ESMTPSA id y13sm1430679ljd.62.2017.11.09.12.11.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2017 12:11:14 -0800 (PST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --=-=-= Content-Type: text/plain Hello Guix, I work on isc-bind service. Currently generation of named.conf is done. Ideas and suggestions are welcome! :-) (define-record-type* bind-options-configuration make-bind-options-configuration bind-options-configuration? (user bind-options-configuration-user ; string (default "bind")) (group bind-options-configuration-group ; string (default "bind")) (run-directory bind-options-configuration-run-directory ; string (default "/var/run/bind")) (pid-file bind-options-configuration-pid-file ; string (default "/var/run/bind/named.pid")) (listen-v4 bind-options-configuration-listen-v4 ; string (default "0.0.0.0")) (listen-v6 bind-options-configuration-listen-v6 ; string (default "::")) (listen-port bind-options-configuration-listen-port ; integer (default 53)) (allow-recursion? bind-configuration-allow-recursion? ; list (default (list "127.0.0.1"))) (allow-transfer? bind-configuration-allow-transfer? ; list (default (list "none"))) (allow-update? bind-configuration-allow-update? ; list (default (list "none"))) (version bind-configuration-version ; string (default "none")) (hostname bind-configuration-hostname ; string (default "none")) (server-id bind-configuration-server-id ; string (default "none"))) (define (bind-configuration-statement-string statements) (string-join (list "{" (string-join statements ";\n") "}"))) (define-record-type* bind-zone-configuration make-bind-zone-configuration bind-zone-configuration? (network bind-zone-configuration-network ; string (default '())) (class bind-zone-configuration-class ; string (default '())) (type bind-zone-configuration-type ; string (default '())) (file bind-zone-configuration-filename ; string (default '()))) (define-record-type* bind-configuration-file make-bind-configuration-file bind-configuration-file? ;; (config-options bind-configuration-file-config-options (default (bind-options-configuration))) ;; list of (config-zones bind-configuration-file-config-zones (default (list (bind-zone-configuration (network "localhost") (class "IN") (type "master") (file "localhost.zone")) (bind-zone-configuration (network "0.0.127.in-addr.arpa") (class "IN") (type "master") (file "127.0.0.zone")) (bind-zone-configuration (network (string-append "1.0.0.0.0.0.0.0.0.0." "0.0.0.0.0.0.0.0.0.0." "0.0.0.0.0.0.0.0.0.0." "0.0.ip6.arpa")) (class "IN") (type "master") (file "localhost.ip6.zone")) (bind-zone-configuration (network "255.in-addr.arpa") (class "IN") (type "master") (file "empty.zone")) (bind-zone-configuration (network "0.in-addr.arpa") (class "IN") (type "master") (file "empty.zone")) (bind-zone-configuration (network ".") (class "IN") (type "master") (file "root.hint")))))) (define-record-type* bind-configuration make-bind-configuration bind-configuration? (config-file bind-configuration-config-file (default (bind-configuration-file))) (package bind-configuration-package ; (default bind))) (define-syntax option (syntax-rules () ((_ key value) (if value (list " " (string-join (list key value)) ";" "\n") '())))) (define-syntax key/value (syntax-rules () ((_ (key value) rest ...) (append (option key value) (key/value rest ...))) ((_) '()))) (define (emit-bind-zones-config zone) (match zone (($ network class type file) (list (string-join `(,(string-join (list "zone" (string-append "\"" network "\"") class "{\n")) ,@(key/value ("type" type) ("file" file)) "};\n") ""))))) (define (emit-bind-options-config options) (match options (($ user _ run-directory pid-file listen-v4 listen-v6 listen-port allow-recursion? allow-transfer? allow-update? version hostname server-id) `("options {\n" ,@(key/value ("directory" run-directory) ("pid-file" pid-file) ("allow-recursion" (bind-configuration-statement-string allow-recursion?)) ("allow-transfer" (bind-configuration-statement-string allow-transfer?)) ("allow-update" (bind-configuration-statement-string allow-update?)) ("version" version) ("hostname" hostname) ("server-id" server-id)) "};\n")))) (define-gexp-compiler (bind-configuration-compiler (file ) system target) (match file (($ config-file) (match config-file (($ config-options config-zones) (apply text-file* "named.conf" (append (fold append '() (map emit-bind-zones-config config-zones)) (emit-bind-options-config config-options)))))))) Oleg. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEc+OyAXw1EaDPCmAPckbhHGm3lWkFAloEtmEACgkQckbhHGm3 lWkmxQ/8DvvxAZa6u0wfDypSu1by8zuOSs/lN4S/HGxRfhAJw/rPLS7r2bkz1UT3 FYGVXkCSXw5XPQjU2SEau9XhBEAcaED6a6YArVBwH9vYiIaV9Wwd3hmKYCOM/xwf Pmbj8Vv9cHg2Vyiy5uoKQNe/N+cRGGn1Z5ZK1Fq4aRifjf2+T2JYm9SEMJ5AXmZ2 wzzsRnZ2RiuoxPpgkOLxhpdojH37BUFTjlyyyNgV8kTqulF6GWqVPRWI9WcV5WNA CQhYw9hxUzVaG9cWlfOK8iY0ITX950lph/WGOLpwjVdrfFfZ1LHgGIrHLxEqX3e2 B+0dmScd35aBXwTQ2xE3vI2Yh4vgOIIaxnvMu1P2DrxIwJqw1G3PIxN+n8SKYnWy Wb9A22KD12wwGLdxjgWj7W66fUzsmnTkx9h+zhJfSTd9WEZwOu8MkT6JHa+yF74d ra8gaovG7/KqeZuvxT91KAFsgOpJ32s/7HDkn0dTT1FqHjAT6d24xsw/yYWZsA8p UpCg4YDGDw3WWaONRXwOIjqkz+ZnG7d2esSz+K5NE9X0CKCtpVm3pwGbxvTAPGKd yZ9Y1MV2k/oFG/otuh7Dp2HyYrVGKJrtyfGbsYUmUI1KmlF0lsLtCsDfqk0Ontaw bj9ZRhA3aQ48OX08CxbARagIefD8lQ/samRv9VaYrMB2TKBOHJA= =P+2O -----END PGP SIGNATURE----- --=-=-=--