Skip to content

shokunin/ansible-freebsd-dns

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

freebsd_dns

Build Status

Ansible role. FreeBSD. Configure DNS.

Requirements

No requiremenst.

Recommended: YAZVS (Yet Another Zone Validation Script)

Variables

TBD. Review the defaults and examples in vars.

By default named and dnssec are disabled.

bsd_named_enable: False
bsd_named_conf_dnssec_enable: 'no'
bsd_named_conf_dnssec_validation: 'no'
  • Keys are needed to enable DNSSEC (see workflow).
  • dnssec-keygen binary is needed to generate the keys.

Workflow

  1. Change shell to /bin/sh.
# ansible host -e 'ansible_shell_type=csh ansible_shell_executable=/bin/csh' -a 'sudo pw usermod admin -s /bin/sh'
  1. Install role.
# ansible-galaxy install vbotka.freebsd_dns
  1. Fit variables.
# editor vbotka.freebsd_dns/vars/main.yml
  1. Create and run the playbook.
# cat freebsd-dns.yml
- hosts: ns1.example.com
  roles:
    - vbotka.freebsd_dns
    
# ansible-playbook freebsd-dns.yml
  1. If DNSSEC is enabled create keys as described in Authoritative DNS Server Configuration.

Example:

> cd /usr/local/etc/namedb/keys
> dnssec-keygen -f KSK -a RSASHA256 -b 2048 -n ZONE example.com
> ln -s Kexample.com.+008+20191.key Kexample.com.KSK.key
> ln -s Kexample.com.+008+20191.private Kexample.com.KSK.private
> dnssec-keygen -a RSASHA256 -b 2048 -n ZONE example.com
> ln -s Kexample.com.+008+35529.key Kexample.com.ZSK.key
> ln -s Kexample.com.+008+35529.private Kexample.com.ZSK.private
> chown bind K*
  1. Configure the zones.

Example of master zone

sd_named_conf_zone:
 - zone: "example.com"
   type: "master"
   reverse: "yes"
   zone_ip: "10.1.0.10"
   zone_in: "0.1.10"
   primary: "ns1.example.net"
   primary_ip: "192.168.1.11"
   secondary: "ns2.example.net"
   secondary_ip: "192.168.1.12"
   admin: "admin.example.com"
   serial: "2016102401"
   refresh: "10800"
   retry: "3600"
   expire: "1209600"
   negative: "300"
   server:
     - "ns1.example.net"
     - "ns2.example.net"
   mx:
     - { server: "srv.example.com", priority: "10" }
   host:
     - { host: "srv", ip: "10.1.0.10" }
   alias:
     - "www"
     - "mail"

Example of slave zone

sd_named_conf_zone:
 - zone: "example.com"
   type: "slave"
   masters: "192.168.1.11;"
   reverse: "yes"
   zone_in: "0.1.10"
  1. Run the playbook
# ansible-playbook freebsd-dns.yml
  1. Sign the zones, reload the server and test the server as described in Authoritative DNS Server Configuration. The zones can be signed when the DNSSEC keys are included in the zone files.

Sign the zone. Change to the keys directory. Otherwise full path to the keys is needed.

> cd /usr/local/etc/namedb/keys
> dnssec-signzone -o example.com -k Kexample.com.KSK /usr/local/etc/namedb/master/example.com  Kexample.com.ZSK.key
> /usr/local/etc/rc.d/named reload

Test the server.

> dig @resolver +dnssec se ds 
  1. Update registrar DS records.
dig type48 example.com
  1. Consider to test the server with

NOTES

  • In-line Signing works with the slave as expected, but not with the master.

  • Keys from master are copied to the slave manually.

TODO

  • automate creation of the keys
  • automate signing of the zones
  • automate testing of the server

References

License

license

Author Information

Vladimir Botka

About

Ansible role. Install and configure DNS at FreeBSD.

Resources

License

Stars

Watchers

Forks

Packages

No packages published