{"id":17,"date":"2022-10-08T09:25:09","date_gmt":"2022-10-08T09:25:09","guid":{"rendered":"https:\/\/www.dnssec.au\/?p=17"},"modified":"2025-01-15T23:49:13","modified_gmt":"2025-01-15T12:49:13","slug":"bind-configuration","status":"publish","type":"post","link":"https:\/\/dnssec.au\/?p=17","title":{"rendered":"Bind configuration"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">You got your domain, what now?<\/h2>\n\n\n\n<p>This guide presumes that you got your domain set up in bind and that the configuration is working without DNSSEC configured. My configuration example is for the dnssec.au domain and the zone files are stored in \/var\/named\/primary\/ and the DNSSEC keys will be stored in \/var\/named\/keys<\/p>\n\n\n\n<p>Here is my dnssec.au zone file: (ignore the low TTL values)<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-background-color has-background\" style=\"font-size:13px\"><code>$ORIGIN .                                                                                                                    \n$TTL 120        ; 2 minutes                                                                                                  \ndnssec.au               IN SOA  moss.ih36.net. jalla\\.au.contactprivacy.org. (                                               \n                                2022100602 ; serial                                                                          \n                                1800       ; refresh (30 minutes)                                                            \n                                7200       ; retry (2 hours)                                                                 \n                                345600     ; expire (4 weeks)                                                                \n                                60         ; minimum (1 minute)                                                              \n                                )                                                                                            \n                        NS      moss.ih36.net.                                                                               \n                        NS      brizzy.ih36.net.                                                                             \n                        NS      hamar.ih36.net.                                                                              \n                                                                                                                             \n                        MX      10 helm.hosteng.net.                                                                         \n                        TXT     \"v=spf1 include:hosteng.net -all\"                                                            \n                        CAA     128 issue \"letsencrypt.org\"                                                                  \n$ORIGIN dnssec.au.                                                                                                           \n_dmarc                  TXT     \"v=DMARC1; p=reject; sp=reject; pct=100; aspf=r; fo=0; rua=mailto:postmaster@dnssec.au\"      \nmail._domainkey         CNAME   mail._domainkey.hosteng.net.                                                                 \nwww                     CNAME   moss.ih36.net. <\/code><\/pre>\n\n\n\n<p>Here is the relevant part of the named.conf file:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-background-color has-background\" style=\"font-size:13px\"><code>zone \"dnssec.au\" {                                                                                                           \n        type master;                                                                                                         \n        file \"\/var\/named\/master\/dnssec.au.DB\";                                                                       \n        allow-query { any; };                                                                                                \n        allow-transfer { mysecondaries; };                                                                                   \n        allow-update { key dhcpd; };                                                                                         \n};                                                                                                                           \n<\/code><\/pre>\n\n\n\n<p>Enabling DNSSEC with bind9 is surprisingly easy. You can set up an automated key rotation scheme and bind will do all the hard work for you. All you have to do is to specify the rotation policy and define the key types (Public key type and the hash type and how often you want the keys rotated). Here is my policy:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-background-color has-background\" style=\"font-size:13px\"><code>dnssec-policy my_dnssec_policy {                                                                                                                                                                                           \n        dnskey-ttl 600;                                                                                                                                                                                        \n        keys {                                                                                                                                                                                                 \n                ksk lifetime unlimited algorithm ecdsap256sha256;                                                                                                                                              \n                zsk lifetime 30d algorithm ecdsap256sha256;                                                                                                                                                    \n        };                                                                                                                                                                                                     \n        max-zone-ttl 600;                                                                                                                                                                                      \n        parent-ds-ttl 600;                                                                                                                                                                                     \n        parent-propagation-delay 2h;                                                                                                                                                                           \n        publish-safety 2h;                                                                                                                                                                                     \n        retire-safety 2h;                                                                                                                                                                                      \n        purge-keys 1h;                                                                                                                                                                                         \n        signatures-refresh 5d;                                                                                                                                                                                 \n        signatures-validity 15d;                                                                                                                                                                               \n        signatures-validity-dnskey 15d;                                                                                                                                                                        \n        zone-propagation-delay 2h;                                                                                                                                                                             \n};<\/code><\/pre>\n\n\n\n<p>This defines a non-expiring key signing key and a zone signing key that is rotated every 30 days. The reason my KSK is set not to expire is that for it to be changed, I have to log into my registrar and update the key hashes in the .au domain. This is easy to do, but it cannot be automated, so I have chosen not to rotate this key automatically. Read the bind documentation for the meaning of the rest of the parameters in the policy or just copy my parameters. <\/p>\n\n\n\n<p>Then all I have to do is to modify the zone definition like this:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-background-color has-background\" style=\"font-size:13px\"><code>zone \"dnssec.au\" {                                                                                                                                                                                             \n        type master;                                                                                                                                                                                           \n        file \"\/var\/named\/master\/dnssec.au.DB\";                                                                                                                                                         \n        allow-query { any; };                                                                                                                                                                                  \n        allow-transfer { mysecondaries; };                                                                                                                                                                     \n        allow-update { key dhcpd; };                                                                                                                                                                           \n        # look for dnssec keys here:                                                                                                                                                                           \n        key-directory \"\/var\/named\/keys\/dnssec.au\";                                                                                                                                                             \n        # publish and activate dnssec keys:                                                                                                                                                                    \n        dnssec-policy my_dnssec_policy;                                                                                                                                                                                    \n        # use inline signing:                                                                                                                                                                                  \n        inline-signing yes;                                                                                                                                                                                    \n};                                                                                                                                                                                                             \n<\/code><\/pre>\n\n\n\n<p>That is it. run rndc reconfig to reload the bind configuration and bob&#8217;s your uncle. Now you will find the newly generated keys in the directory specified above (\/var\/named\/keys\/dnssec.au)<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-background-color has-background\" style=\"font-size:13px\"><code>root@moss:\/var\/named\/keys\/dnssec.au# ls -l                                                                                                                                                                     \ntotal 24                                                                                                                                                                                                       \n-rw-r--r-- 1 bind bind 398 Oct  8 18:54 Kdnssec.au.+013+25892.key                                                                                                                                              \n-rw------- 1 bind bind 215 Oct  8 18:54 Kdnssec.au.+013+25892.private                                                                                                                                          \n-rw-r--r-- 1 bind bind 569 Oct  8 18:54 Kdnssec.au.+013+25892.state                                                                                                                                            \n-rw-r--r-- 1 bind bind 448 Oct  8 18:54 Kdnssec.au.+013+58993.key                                                                                                                                              \n-rw------- 1 bind bind 235 Oct  8 18:54 Kdnssec.au.+013+58993.private                                                                                                                                          \n-rw-r--r-- 1 bind bind 553 Oct  8 18:54 Kdnssec.au.+013+58993.state     <\/code><\/pre>\n\n\n\n<p>Now to verify that my zone is signed I use https:\/\/dnsviz.net\/d\/dnssec.au to visualize my DNSSEC information. Here is what it shows at this stage in the DNSSEC setup:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"499\" height=\"1024\" src=\"https:\/\/www.dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_01_08-UTC-499x1024.png\" alt=\"\" class=\"wp-image-19\" srcset=\"https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_01_08-UTC-499x1024.png 499w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_01_08-UTC-146x300.png 146w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_01_08-UTC.png 635w\" sizes=\"auto, (max-width: 499px) 100vw, 499px\" \/><figcaption>dnsviz view of dnssec.au after initial setup<\/figcaption><\/figure>\n\n\n\n<p>This image shows the trust chain for my domain. As you can see my zone is now signed with the KSK id 25892. It has signed the ZSK key id 58993 that has signed the remaining records in the zone. However, there is no trust link from the zone above (.au). So I have to log in to my registrar&#8217;s webpage and add two hashes of my KSK key with the ID 25892 to the .au zone.  But before that, I have to generate the hashes from my KSK key like this:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-background-color has-background\" style=\"font-size:13px\"><code>root@moss:\/var\/named\/keys\/dnssec.au# dnssec-dsfromkey -a sha256 \/var\/named\/keys\/dnssec.au\/Kdnssec.au.+013+25892                                                                                                \ndnssec.au. IN DS 25892 13 2 F27DF44A5CDB057C5F084597244D9C53EAA81989E0463824495B205215B546C6                                                                                                                   \nroot@moss:\/var\/named\/keys\/dnssec.au# dnssec-dsfromkey -a sha384 \/var\/named\/keys\/dnssec.au\/Kdnssec.au.+013+25892                                                                                                \ndnssec.au. IN DS 25892 13 4 43EF3592F0AD4544733BA892E714F57B4D14F9AF6A96BFA17326AAA359DE80FA41A1D167E40D5A28A609FFDC6E62B94A                                                                                   \n<\/code><\/pre>\n\n\n\n<p>Then you have to use the tools your registrar provides for adding DNSSEC records for your zone to its parent zone (.au in my case)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"934\" src=\"https:\/\/www.dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.13.21@2x-1024x934.png\" alt=\"\" class=\"wp-image-20\" srcset=\"https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.13.21@2x-1024x934.png 1024w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.13.21@2x-300x274.png 300w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.13.21@2x-768x700.png 768w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.13.21@2x.png 1110w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>My registrars webinterface for entering my KSK hash information<\/figcaption><\/figure>\n\n\n\n<p>Once I have completed both, it looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.15.47@2x-1024x382.png\" alt=\"\" class=\"wp-image-21\" width=\"609\" height=\"227\" srcset=\"https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.15.47@2x-1024x382.png 1024w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.15.47@2x-300x112.png 300w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.15.47@2x-768x286.png 768w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.15.47@2x-1536x573.png 1536w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.15.47@2x-1568x585.png 1568w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/CleanShot-2022-10-08-at-20.15.47@2x.png 1910w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/><figcaption>The completed update of my KSK hash with my registrar<\/figcaption><\/figure>\n\n\n\n<p>Now I can use https:\/\/dnsviz.net\/d\/dnssec.au to recheck my DNSSEC setup. Remember to use the analyze option to force dnsviz to rebuild its cache for your domain.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"509\" height=\"1024\" src=\"https:\/\/www.dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_18_34-UTC-509x1024.png\" alt=\"\" class=\"wp-image-22\" srcset=\"https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_18_34-UTC-509x1024.png 509w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_18_34-UTC-149x300.png 149w, https:\/\/dnssec.au\/wp-content\/uploads\/2022\/10\/dnssec.au-2022-10-08-09_18_34-UTC.png 635w\" sizes=\"auto, (max-width: 509px) 100vw, 509px\" \/><figcaption>dnsviz view after updating my registrar with the KSK key hash used to sign my zone<\/figcaption><\/figure>\n\n\n\n<p>As you can see now, there is a trust chain going from the root domain to .au and then to dnssec.au. This means that the DNSSEC configuration is completed. From this point on, you can forget all about DNSSEC and update the zone file as normal. When you reload it bind will sign all the information in it, and the signed zone file will be pushed to your secondary nameservers automatically. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclution<\/h2>\n\n\n\n<p>This shows all the steps needed to enable DNSSEC for your domain. Doing so will protect you from any unauthorized changes to your zone data in flight to the resolvers that reference your domain. <\/p>\n\n\n\n<p>I hope this information helps you in setting up DNSSEC. I wish I had found this when I started securing my domains. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>You got your domain, what now? This guide presumes that you got your domain set up in bind and that the configuration is working without DNSSEC configured. My configuration example is for the dnssec.au domain and the zone files are stored in \/var\/named\/primary\/ and the DNSSEC keys will be stored in \/var\/named\/keys Here is my&hellip; <a class=\"more-link\" href=\"https:\/\/dnssec.au\/?p=17\">Continue reading <span class=\"screen-reader-text\">Bind configuration<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[5],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-dnssec","tag-howto","entry"],"_links":{"self":[{"href":"https:\/\/dnssec.au\/index.php?rest_route=\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dnssec.au\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dnssec.au\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dnssec.au\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dnssec.au\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":5,"href":"https:\/\/dnssec.au\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":26,"href":"https:\/\/dnssec.au\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions\/26"}],"wp:attachment":[{"href":"https:\/\/dnssec.au\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dnssec.au\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dnssec.au\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}