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