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