Knowledge Base ISC Main Website Ask a Question/Contact ISC
How to bind to port 53 when using 'named -u bind' with FreeBSD
Author: Mark Andrews Reference Number: AA-00621 Views: 5405 Created: 2012-02-22 03:54 Last Updated: 2012-02-24 10:23 0 Rating/ Voters

Normally binding to a reserved port on FreeBSD requires the process to be be running as root.   For most uses this is not a problem as named binds to port 53 before changing user id however if you are running in a environment where interface address are changing this can be a issue.  FreeBSD has a kernel module, mac-portacl, that will allow a non privileged user to bind to specified ports.

Assuming that the user bind has user id 53, adding the following configuration elements and rebooting will allow named, running as bind, to bind to the reserved port 53.

/boot/loader.conf:
mac_portacl_load="YES"

/etc/sysctl.conf: 
net.inet.ip.portrange.reservedlow=0
net.inet.ip.portrange.reservedhigh=0
security.mac.portacl.port_high=1023
security.mac.portacl.suser_exempt=1

security.mac.portacl.rules=uid:53:tcp:53,uid:53:udp:53

Note - apply carefully:

Getting this wrong may lock you out of the system if you are accessing it across the network!

More information about mac-portacl can be found here: http://www.freebsd.org/doc/handbook/mac-portacl.html


© 2001-2017 Internet Systems Consortium

For assistance with problems and questions for which you have not been able to find an answer in our Knowledge Base, we recommend searching our community mailing list archives and/or posting your question there (you will need to register there first for your posts to be accepted). The bind-users and the dhcp-users lists particularly have a long-standing and active membership.

ISC relies on the financial support of the community to fund the development of its open source software products. If you would like to support future product evolution and maintenance as well having peace of mind knowing that our team of experts are poised to provide you with individual technical assistance whenever you call upon them, then please consider our Professional Subscription Support services - details can be found on our main website.

Feedback
  • There is no feedback for this article
Quick Jump Menu