1.\" 2.\" blackhole - drop refused TCP or UDP connects 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.Dd May 25, 2024 14.Dt BLACKHOLE 4 15.Os 16.Sh NAME 17.Nm blackhole 18.Nd a 19.Xr sysctl 8 20MIB for manipulating behaviour in respect of refused SCTP, TCP, or UDP connection 21attempts 22.Sh SYNOPSIS 23.Cd sysctl net.inet.sctp.blackhole Ns Op = Ns Brq "0 | 1 | 2" 24.Cd sysctl net.inet.tcp.blackhole Ns Op = Ns Brq "0 | 1 | 2 | 3" 25.Cd sysctl net.inet.tcp.blackhole_local Ns Op = Ns Brq "0 | 1" 26.Cd sysctl net.inet.udp.blackhole Ns Op = Ns Brq "0 | 1" 27.Cd sysctl net.inet.udp.blackhole_local Ns Op = Ns Brq "0 | 1" 28.Sh DESCRIPTION 29The 30.Nm 31.Xr sysctl 8 32MIB is used to control system behaviour when connection requests 33are received on SCTP, TCP, or UDP ports where there is no socket listening 34or unexpected packets are received on listening sockets. 35.Pp 36The blackhole behaviour is useful to slow down an attacker who is port-scanning 37a system in an attempt to detect vulnerable services. 38It might also slow down an attempted denial of service attack. 39.Pp 40The blackhole behaviour is disabled by default. 41If enabled, the locally originated packets would still be responded to, 42unless also 43.Va net.inet.tcp.blackhole_local 44(for TCP) and/or 45.Va net.inet.udp.blackhole_local 46(for UDP) are enforced. 47.Ss SCTP 48Setting the SCTP blackhole MIB to a numeric value of one 49will prevent sending an ABORT packet in response to an incoming INIT. 50A MIB value of two will do the same, but will also prevent sending an ABORT packet 51when unexpected packets are received. 52.Ss TCP 53Normal behaviour, when a TCP SYN segment is received on a port where 54there is no socket accepting connections, is for the system to return 55a RST segment, and drop the incoming SYN segment. 56The connecting system will 57see this as a 58.Dq Connection refused . 59By setting the TCP blackhole 60MIB to a numeric value of one, the incoming SYN segment 61is merely dropped, and no RST is sent, making the system appear 62as a blackhole. 63By setting the MIB value to two, any segment arriving 64on a closed port is dropped without returning a RST. 65Setting the MIB value to three, any segment arriving on a closed port 66or an unexpected segment on a listening port is dropped without sending a 67RST in reply. 68This provides some degree of protection against stealth port scans. 69.Ss UDP 70Enabling blackhole behaviour turns off the sending 71of an ICMP port unreachable message in response to a UDP datagram which 72arrives on a port where there is no socket listening. 73It must be noted that this behaviour will prevent remote systems from running 74.Xr traceroute 8 75to a system. 76.Sh WARNING 77The SCTP, TCP, and UDP blackhole features should not be regarded as a replacement 78for firewall solutions. 79Better security would consist of the 80.Nm 81.Xr sysctl 8 82MIB used in conjunction with one of the available firewall packages. 83.Pp 84This mechanism is not a substitute for securing a system. 85It should be used together with other security mechanisms. 86.Sh SEE ALSO 87.Xr ip 4 , 88.Xr sctp 4 , 89.Xr tcp 4 , 90.Xr udp 4 , 91.Xr ipf 8 , 92.Xr ipfw 8 , 93.Xr pfctl 8 , 94.Xr sysctl 8 95.Sh HISTORY 96The TCP and UDP 97.Nm 98MIBs 99first appeared in 100.Fx 4.0 . 101.Pp 102The SCTP 103.Nm 104MIB first appeared in 105.Fx 9.1 . 106.Sh AUTHORS 107.An Geoffrey M. Rehmet 108