Blame extensions/libxt_socket.man

Packit 7b22a4
This matches if an open TCP/UDP socket can be found by doing a socket lookup on the
Packit 7b22a4
packet. It matches if there is an established or non\-zero bound listening
Packit 7b22a4
socket (possibly with a non\-local address). The lookup is performed using
Packit 7b22a4
the \fBpacket\fP tuple of TCP/UDP packets, or the original TCP/UDP header
Packit 7b22a4
\fBembedded\fP in an ICMP/ICPMv6 error packet.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-transparent\fP
Packit 7b22a4
Ignore non-transparent sockets.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-nowildcard\fP
Packit 7b22a4
Do not ignore sockets bound to 'any' address.
Packit 7b22a4
The socket match won't accept zero\-bound listeners by default, since
Packit 7b22a4
then local services could intercept traffic that would otherwise be forwarded.
Packit 7b22a4
This option therefore has security implications when used to match traffic being
Packit 7b22a4
forwarded to redirect such packets to local machine with policy routing.
Packit 7b22a4
When using the socket match to implement fully transparent
Packit 7b22a4
proxies bound to non\-local addresses it is recommended to use the \-\-transparent
Packit 7b22a4
option instead.
Packit 7b22a4
.PP
Packit 7b22a4
Example (assuming packets with mark 1 are delivered locally):
Packit 7b22a4
.IP
Packit 7b22a4
\-t mangle \-A PREROUTING \-m socket \-\-transparent \-j MARK \-\-set\-mark 1
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-restore\-skmark\fP
Packit 7b22a4
Set the packet mark to the matching socket's mark. Can be combined with the
Packit 7b22a4
\fB\-\-transparent\fP and \fB\-\-nowildcard\fP options to restrict the sockets
Packit 7b22a4
to be matched when restoring the packet mark.
Packit 7b22a4
.PP
Packit 7b22a4
Example: An application opens 2 transparent (\fBIP_TRANSPARENT\fP) sockets and
Packit 7b22a4
sets a mark on them with \fBSO_MARK\fP socket option. We can filter matching packets:
Packit 7b22a4
.IP
Packit 7b22a4
\-t mangle \-I PREROUTING \-m socket \-\-transparent \-\-restore-skmark \-j action
Packit 7b22a4
.IP
Packit 7b22a4
\-t mangle \-A action \-m mark \-\-mark 10 \-j action2
Packit 7b22a4
.IP
Packit 7b22a4
\-t mangle \-A action \-m mark \-\-mark 11 \-j action3