port: a listening socket reserved while the configuration is read

port tcp|udp [ip:]port [socket_options] opens, binds and listens at
the time the line is read, so a privileged port can be taken before
setuid and chroot drop the rights to open it: a service of the
configuration on the same address, of the same type, takes the socket
over when it starts, instead of binding one of its own, and a port no
service takes stays reserved until the configuration is left. A
reservation of the configuration before holds the port over a reload:
the new one shares its socket, each dropping its hold with its
configuration.

The socket is what the reservation made of it: the options which act
only before bind() cannot follow a service's wishes on a socket already
bound, so the service takes it as it is, its other options set on it.
The reservation is built from the same default address a service is, so
it matches in every byte a listener is compared by.
This commit is contained in:
Vladimir Dubrovin committed 2026-11-21 16:17:35 +03:00
1 parent 44b9e344e1
commit 5cd842e3be
6 files changed
+316 -23

No files matched your search

+21
View File
@@ -1526,6 +1526,27 @@ and
If file monitored changes in modification time or size, 3proxy reloads
configuration within one minute. Any number of files may be monitored.
.br
.BR port
\fItcp|udp\fR \fI[<ip>:]<port>\fR [\fIsocket_options\fR]
.br
Reserves a listening socket at the time the configuration is read: a
privileged port can be opened before \fBsetuid\fR and \fBchroot\fR take the
rights to open it away, the \fBport\fR line placed above them and the
service below. A service of the configuration on the same address, of
the same type, takes the socket over when it starts, instead of opening
one of its own; a port no service takes stays reserved until the
configuration is left. The address is an IPv4 one by default, an IPv6
one in brackets. The socket options are written as for \fB-o\fR, and are
what the socket has: those which act only before bind() cannot be
changed on a socket the service takes over.
.br
port tcp 443
.br
port tcp [::]:80 TCP_FASTOPEN
.br
port udp 53
.br
.BR setuid
\fI<uid>\fR