xref: /freebsd/share/man/man4/blackhole.4 (revision 02d15215cef2a28f1865e6ad5b19f18af1398b8b)
1849d3459SGeoff Rehmet.\"
2849d3459SGeoff Rehmet.\" blackhole - drop refused TCP or UDP connects
3849d3459SGeoff Rehmet.\"
4849d3459SGeoff Rehmet.\" Redistribution and use in source and binary forms, with or without
5849d3459SGeoff Rehmet.\" modification, are permitted provided that the following conditions
6849d3459SGeoff Rehmet.\" are met:
7849d3459SGeoff Rehmet.\" 1. Redistributions of source code must retain the above copyright
8849d3459SGeoff Rehmet.\"    notice, this list of conditions and the following disclaimer.
9849d3459SGeoff Rehmet.\" 2. Redistributions in binary form must reproduce the above copyright
10849d3459SGeoff Rehmet.\"    notice, this list of conditions and the following disclaimer in the
11849d3459SGeoff Rehmet.\"    documentation and/or other materials provided with the distribution.
12849d3459SGeoff Rehmet.\"
13*02d15215SMichael Tuexen.Dd May 25, 2024
14849d3459SGeoff Rehmet.Dt BLACKHOLE 4
153d45e180SRuslan Ermilov.Os
16849d3459SGeoff Rehmet.Sh NAME
178b8f358eSMike Pritchard.Nm blackhole
18849d3459SGeoff Rehmet.Nd a
19849d3459SGeoff Rehmet.Xr sysctl 8
207245b843SAllan JudeMIB for manipulating behaviour in respect of refused SCTP, TCP, or UDP connection
2159322008SRuslan Ermilovattempts
22849d3459SGeoff Rehmet.Sh SYNOPSIS
237245b843SAllan Jude.Cd sysctl net.inet.sctp.blackhole Ns Op = Ns Brq "0 | 1 | 2"
24*02d15215SMichael Tuexen.Cd sysctl net.inet.tcp.blackhole Ns Op = Ns Brq "0 | 1 | 2 | 3"
253ea9a7cfSGleb Smirnoff.Cd sysctl net.inet.tcp.blackhole_local Ns Op = Ns Brq "0 | 1"
267245b843SAllan Jude.Cd sysctl net.inet.udp.blackhole Ns Op = Ns Brq "0 | 1"
273ea9a7cfSGleb Smirnoff.Cd sysctl net.inet.udp.blackhole_local Ns Op = Ns Brq "0 | 1"
28849d3459SGeoff Rehmet.Sh DESCRIPTION
29849d3459SGeoff RehmetThe
30849d3459SGeoff Rehmet.Nm
31849d3459SGeoff Rehmet.Xr sysctl 8
32849d3459SGeoff RehmetMIB is used to control system behaviour when connection requests
33*02d15215SMichael Tuexenare received on SCTP, TCP, or UDP ports where there is no socket listening
34*02d15215SMichael Tuexenor unexpected packets are received on listening sockets.
35849d3459SGeoff Rehmet.Pp
367245b843SAllan JudeThe blackhole behaviour is useful to slow down an attacker who is port-scanning
377245b843SAllan Judea system in an attempt to detect vulnerable services.
387245b843SAllan JudeIt might also slow down an attempted denial of service attack.
393ea9a7cfSGleb Smirnoff.Pp
403ea9a7cfSGleb SmirnoffThe blackhole behaviour is disabled by default.
413ea9a7cfSGleb SmirnoffIf enabled, the locally originated packets would still be responded to,
423ea9a7cfSGleb Smirnoffunless also
433ea9a7cfSGleb Smirnoff.Va net.inet.tcp.blackhole_local
443ea9a7cfSGleb Smirnoff(for TCP) and/or
453ea9a7cfSGleb Smirnoff.Va net.inet.udp.blackhole_local
463ea9a7cfSGleb Smirnoff(for UDP) are enforced.
477245b843SAllan Jude.Ss SCTP
487245b843SAllan JudeSetting the SCTP blackhole MIB to a numeric value of one
497245b843SAllan Judewill prevent sending an ABORT packet in response to an incoming INIT.
507245b843SAllan JudeA MIB value of two will do the same, but will also prevent sending an ABORT packet
517245b843SAllan Judewhen unexpected packets are received.
527245b843SAllan Jude.Ss TCP
53849d3459SGeoff RehmetNormal behaviour, when a TCP SYN segment is received on a port where
54849d3459SGeoff Rehmetthere is no socket accepting connections, is for the system to return
55a45a9e61SMichael Tuexena RST segment, and drop the incoming SYN segment.
56b5e7e999SRuslan ErmilovThe connecting system will
57b5e7e999SRuslan Ermilovsee this as a
58b5e7e999SRuslan Ermilov.Dq Connection refused .
59b5e7e999SRuslan ErmilovBy setting the TCP blackhole
60235a25a6SDima DorfmanMIB to a numeric value of one, the incoming SYN segment
6145a033b1SGeoff Rehmetis merely dropped, and no RST is sent, making the system appear
62b5e7e999SRuslan Ermilovas a blackhole.
63b5e7e999SRuslan ErmilovBy setting the MIB value to two, any segment arriving
64b5e7e999SRuslan Ermilovon a closed port is dropped without returning a RST.
65*02d15215SMichael TuexenSetting the MIB value to three, any segment arriving on a closed port
66*02d15215SMichael Tuexenor an unexpected segment on a listening port is dropped without sending a
67*02d15215SMichael TuexenRST in reply.
68b5e7e999SRuslan ErmilovThis provides some degree of protection against stealth port scans.
697245b843SAllan Jude.Ss UDP
707245b843SAllan JudeEnabling blackhole behaviour turns off the sending
71849d3459SGeoff Rehmetof an ICMP port unreachable message in response to a UDP datagram which
72b5e7e999SRuslan Ermilovarrives on a port where there is no socket listening.
73b5e7e999SRuslan ErmilovIt must be noted that this behaviour will prevent remote systems from running
74849d3459SGeoff Rehmet.Xr traceroute 8
75235a25a6SDima Dorfmanto a system.
76849d3459SGeoff Rehmet.Sh WARNING
777245b843SAllan JudeThe SCTP, TCP, and UDP blackhole features should not be regarded as a replacement
7876de453cSDaniel Gerzofor firewall solutions.
7976de453cSDaniel GerzoBetter security would consist of the
8076de453cSDaniel Gerzo.Nm
8176de453cSDaniel Gerzo.Xr sysctl 8
82b06cfd40SJoel DahlMIB used in conjunction with one of the available firewall packages.
83849d3459SGeoff Rehmet.Pp
84235a25a6SDima DorfmanThis mechanism is not a substitute for securing a system.
85235a25a6SDima DorfmanIt should be used together with other security mechanisms.
868b8f358eSMike Pritchard.Sh SEE ALSO
878b8f358eSMike Pritchard.Xr ip 4 ,
887245b843SAllan Jude.Xr sctp 4 ,
898b8f358eSMike Pritchard.Xr tcp 4 ,
908b8f358eSMike Pritchard.Xr udp 4 ,
9176de453cSDaniel Gerzo.Xr ipf 8 ,
928b8f358eSMike Pritchard.Xr ipfw 8 ,
9376de453cSDaniel Gerzo.Xr pfctl 8 ,
94849d3459SGeoff Rehmet.Xr sysctl 8
95849d3459SGeoff Rehmet.Sh HISTORY
96849d3459SGeoff RehmetThe TCP and UDP
97849d3459SGeoff Rehmet.Nm
98849d3459SGeoff RehmetMIBs
99849d3459SGeoff Rehmetfirst appeared in
1008b8f358eSMike Pritchard.Fx 4.0 .
1017245b843SAllan Jude.Pp
1027245b843SAllan JudeThe SCTP
1037245b843SAllan Jude.Nm
1047245b843SAllan JudeMIB first appeared in
1057245b843SAllan Jude.Fx 9.1 .
1069cbda590SRuslan Ermilov.Sh AUTHORS
1079cbda590SRuslan Ermilov.An Geoffrey M. Rehmet
108