Blame extensions/libxt_socket.man

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