INNBIND(8)
π innbind(8) β the InterNetNews docs, but make it make sense
okay so this is innbind, from the InterNetNews manual set, and bestie it is a little freak of a program but we're gonna get through it together π«Ά
β¨ NAME β¨
innbind β the helper program that binds sockets to privileged ports. yeah. that's the whole job. it's giving tiny but powerful π
πΈ SYNOPSIS πΈ
innbind [-p] fd,family,address,port [...]
π¦ DESCRIPTION π¦
okay so first thing, innbind is a helper program that's not meant to be run directly. like, do not just type it into your shell for funsies. instead, innd and nnrpd use it internally to bind to ports that require root privileges to bind to. it's the backstage crew, not the main character π
This program must be installed setuid root in order for innd or nnrpd to bind to ports under 1024. The only functions that it's willing to perform are to bind an open file descriptor to a given address and port, or to create a new socket, bind it, and return the bound socket to its caller. It can only be run as the news user (as specified at configure time), and will only bind to ports 119, 433, 563, an additional port specified with the --with-innd-port argument to configure, or ports numbered 1024 or higher.
Each argument to innbind must be a comma-separated list of four elements. Let's break that down, because there are literally four and you need all of them:
- the file descriptor number that should be bound
- the numeric family of the socket (
AF_INETorAF_INET6) - the local address to bind to (in dotted-quad format for IPv4 and in colon-separated address format for IPv6)
- the port number
To bind to all addresses with IPv4, use "0.0.0.0" as the address. To bind to all addresses with IPv6, use "::" as the address. no cap, that's just how it is π
Multiple arguments can be specified to tell innbind to bind multiple sockets at the same time. Any errors (other than permission denied β see below) encountered will cause innbind to abort, and error messages will be sent both to syslog and to standard error. so if you see it bail, that's why π
By default, innbind attempts to just bind the already open file descriptor that it inherits from its caller. For each successfully bound file descriptor (in the order given on the command line), innbind prints "ok" and a newline to its standard output. slay.
On some systems (apparently just STREAMS-based systems), however, even a setuid root program cannot bind a socket to a privileged port that was created by a process that didn't have permissions. If innbind gets permission denied when trying to bind a socket, it will print "no" and a newline to its standard output. It will then create a new socket, bind it as specified, and then attempt to pass that socket back to its caller using the I_SENDFD STREAMS ioctl. The caller should receive that file descriptor with I_RECVFD and use it instead of the one that it created. okay so that's the whole "no takebacks, here's a better one" maneuver π
Note that file descriptor passing is only supported on STREAMS-based systems since it is done with ioctls over a pipe. However, it is believed that those systems are exactly the systems that can't simply bind the inherited file descriptor. If this assumption proves to be incorrect, traditional BSD file descriptor passing over a Unix domain socket will have to be added.
π OPTIONS π
-pβ If given as the first command-line argument, no attempt will be made to bind the inherited file descriptor andinnbindwill only try creation of a new file descriptor and passing it back via standard output. This option is primarily useful for testing. (yes bestie, it's the test mode β¨)
π₯ SECURITY π₯
As innbind is normally installed setuid root, security is even more of an issue for it than for other parts of INN. It is a fairly short program, and if you understand C, you are encouraged to audit it yourself to be certain that it does only what it is supposed to do π The only INN library functions it uses are the vector functions, the message functions for error reporting, and xstrdup.
The ports that will be bound are restricted to prevent potential attacks made possible by the ability to bind low-numbered ports, such as exploits of the rsh(1) family of commands on some systems. If innbind is installed setuid root, it can only be executed by the news user to prevent other users on the system from being able to bind to even those few privileged ports that it allows. protective king π
innbind uses no external configuration files; the only files it might open are through the system getpwnam(3) service to get the UID of the news user. The only user input that it accepts are its command-line arguments. minimal footprint, maximum vibe π
π DIAGNOSTICS π
innbind may log the following messages to syslog and print them to standard error. here's the full menu, nothing skipped, fr fr:
cannot create socket for %s: %sβ (Fatal)innbindfell back on attempting to create a new socket to bind for the given argument, and the socket creation failed.cannot bind socket for %s: %sβ (Fatal) Callingbindfor the socket corresponding to the given argument failed with a system error. If the error indicates permission denied, make sure thatinnbindis setuid root. This can also be caused by trying to use IPv6 on a system whose kernel does not support it.cannot bind to restricted port %hu in %sβ (Fatal) The port number portion of the given command-line argument is for a port below1024which is not119,433,563, or a port given to--with-innd-portat configure time. Other ports are not allowed for security reasons.cannot get socket options for file descriptor %d: %sβ (Fatal)innbindwas unable to get the socket options for that file descriptor. The most likely cause of this error is passing the wrong file descriptor number toinnbind(a file descriptor that isn't open, or that corresponds to a regular file rather than a network socket).cannot get UID for %sβ (Fatal)innbindwas unable to get the UID for the news user specified during configure (and defaulting to"news"). This normally means that user isn't in the system passwd file.cannot mark socket reusable for %s: %sβ (Fatal)innbindcreated a new socket for the given argument but was unable to mark its bind address reusable (theSO_REUSEADDRsocket option).cannot pass file descriptor: %sβ (Fatal)innbindcreated and bound a new file descriptor but was unable to pass it back to its caller via its standard output, using theI_SENDFDSTREAMS ioctl.invalid file descriptor %d: not SOCK_STREAMβ (Fatal) The given file descriptor is not aSOCK_STREAMsocket.innbindcan only bindSOCK_STREAMsockets.invalid IPv4 address %s in %sβ (Fatal) The IPv4 address specified in the given command-line option could not be parsed byinet_aton(3). IPv4 addresses should be specified in the standard dotted-quad format (10.2.3.4).invalid IPv6 address %s in %sβ (Fatal) The IPv6 address specified in the given command-line option could not be parsed byinet_pton(3). IPv6 addresses should be specified in RFC 4291 format (1080:0:0:0:8:800:200C:417Aor1080::8:800:200C:417A).invalid command-line argument %sβ (Fatal) The specified command-line argument could not be parsed or was not in the correct format.invalid file descriptor %s in %sβ (Fatal) The file descriptor portion of the given command-line argument is not a non-negative integer.invalid port number %s in %sβ (Fatal) The port number portion of the given command-line argument is not a non-negative integer.invalid protocol family %s in %sβ (Fatal) The protocol family portion of the given command-line argument is not a non-negative integer. It should be equal to eitherAF_INETorAF_INET6on the system whereinnbindis run.must be run by user %s (%lu), not %luβ (Fatal) When setuid root,innbindmay only be run by the news user as specified at configure time ("news"by default), for security reasons.no addresses specifiedβ (Fatal) No arguments were given on the command line (except maybe-p).port may not be zero in %sβ (Fatal) The port number portion of the given command-line argument was zero.unknown protocol family %s in %sβ (Fatal) The protocol number portion of the given command-line argument is neitherAF_INETnorAF_INET6.
π EXAMPLES π
As mentioned above, innbind is never run directly, only by innd and other programs that need to bind to and listen to network ports. Sample invocations by innd would be:
innbind 3,10,::,119
to bind the IPv6 socket on file descriptor 3 to port 119, all addresses, or:
innbind 6,2,10.0.0.3,433
to bind the IPv4 socket on file descriptor 6 to port 433 in the address 10.0.0.3. see how the four elements line up? fd, family, address, port. iconique π
π§ HISTORY π§
Written by Russ Allbery <eagle@eyrie.org> for InterNetNews.
π SEE ALSO π
inet_aton(3), inet_pton(3), innd(8), nnrpd(8).
and that's the whole page bestie π this was INN 2.7.4, dated 2022-07-10 β go audit that setuid binary and stay safe out there, mwah π
π¦ where this page comes from
- arch rolling: inn 2.7.4-4 Β· ISC
- epel 10: inn 2.7.4-5.el10_3 Β· ISC AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND GPL-3.0-or-later WITH Bison-exception-2.2 AND LicenseRef-Fedora-Public-Domain AND MIT AND NTP
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms