Thread icmp-port-unreachable erzeugen (13 answers)
Opened by Nobody at 2021-08-19 14:20

Linuxer
 2021-08-19 15:04
#193546 #193546
User since
2006-01-27
3870 Artikel
HausmeisterIn

user image
Nach meinem Verständnis:

Fail2Ban definiert nach seinen Kriterien entsprechende Firewall-Regeln, die dann z.B. unter Linux mit iptables aktiviert werden.

Darin kann dann auch definiert werden, was mit abgelehnten Verbindungsanfragen passieren sollen (stumm wegwerfen, Reset schicken, icmp-port-unreachble etc.).

Man kann auch mit einem Perl-Skript Regeln für iptables definieren und diese dann eintragen lassen.
Siehe dazu die Doku vom iptables (ich gehe davon aus, dass das Perl Skript z.B. das iptables Binary aufruft, um Regeln zu definieren):

https://ipset.netfilter.org/iptables-extensions.man.html
...
REJECT (IPv6-specific)
This is used to send back an error packet in response to the matched packet: otherwise it is equivalent to DROP so it is a terminating TARGET, ending rule traversal. This target is only valid in the INPUT, FORWARD and OUTPUT chains, and user-defined chains which are only called from those chains. The following option controls the nature of the error packet returned:
--reject-with type
The type given can be icmp6-no-route, no-route, icmp6-adm-prohibited, adm-prohibited, icmp6-addr-unreachable, addr-unreach, or icmp6-port-unreachable, which return the appropriate ICMPv6 error message (icmp6-port-unreachable is the default). Finally, the option tcp-reset can be used on rules which only match the TCP protocol: this causes a TCP RST packet to be sent back. This is mainly useful for blocking ident (113/tcp) probes which frequently occur when sending mail to broken mail hosts (which won't accept your mail otherwise). tcp-reset can only be used with kernel versions 2.6.14 or later.

REJECT (IPv4-specific)
This is used to send back an error packet in response to the matched packet: otherwise it is equivalent to DROP so it is a terminating TARGET, ending rule traversal. This target is only valid in the INPUT, FORWARD and OUTPUT chains, and user-defined chains which are only called from those chains. The following option controls the nature of the error packet returned:
--reject-with type
The type given can be icmp-net-unreachable, icmp-host-unreachable, icmp-port-unreachable, icmp-proto-unreachable, icmp-net-prohibited, icmp-host-prohibited, or icmp-admin-prohibited (*), which return the appropriate ICMP error message (icmp-port-unreachable is the default). The option tcp-reset can be used on rules which only match the TCP protocol: this causes a TCP RST packet to be sent back. This is mainly useful for blocking ident (113/tcp) probes which frequently occur when sending mail to broken mail hosts (which won't accept your mail otherwise).
(*) Using icmp-admin-prohibited with kernels that do not support it will result in a plain DROP instead of REJECT
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread icmp-port-unreachable erzeugen