|
NAMEinnbind - Helper program to bind sockets to privileged portsSYNOPSISinnbind [-p] fd,family,address,port [...]DESCRIPTIONinnbind is a helper program that's not meant to be run directly. Instead, innd and nnrpd use it internally to bind to ports that require root privileges to bind to.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. The first is the file descriptor number that should be bound, the second is the numeric family of the socket (AF_INET or AF_INET6), the third is the local address to bind to (in dotted-quad format for IPv4 and in colon-separated address format for IPv6), and the fourth is 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. 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. 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. 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. 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
SECURITYAs 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. 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. DIAGNOSTICSinnbind may log the following messages to syslog and print them to standard error.
EXAMPLESAs 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. HISTORYWritten by Russ Allbery <eagle@eyrie.org> for InterNetNews.SEE ALSOinet_aton(3), inet_pton(3), innd(8), nnrpd(8).
Visit the GSP FreeBSD Man Page Interface. |