by JoshTriplett · 10y ago · 0 comments
I checked for a sysctl controlling the ability to bind to privileged ports before writing my comment. The relevant code in the kernel compares against a hardcoded #define PROT_SOCK 1024, and doesn't have any means to disable that check. See inet_bind in net/ipv4/af_inet.c .
$ sudo sysctl net.inet.ip.portrange.reservedlow=10
net.inet.ip.portrange.reservedlow: 0 -> 10
$ nc -vvl 1
^C
$ sudo sysctl net.inet.ip.portrange.reservedlow=0
net.inet.ip.portrange.reservedlow: 10 -> 0
$ nc -vvl 1
nc: Permission denied