portsentry.conf(8)

πŸ“¦
version 2.0.7 Β· 3 versions
, in fedora 43, ubuntu stonking

πŸ’– portsentry.conf β€” the manual page, bestie edition πŸ’–

okay so you opened the portsentry.conf page from the System Manager's Manual, section 8 (that's the sysadmin-stuff section, iykyk). This is the glow-up version. Same facts, way more fun. Let's go ✨


🌸 NAME 🌸

portsentry.conf β€” the config file for Portsentry. She's the control room. The vibe-setter. The main character of your intrusion-detection setup πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

The portsentry.conf file is how you configure Portsentry, periodt.

  • The default location for this file is /etc/portsentry/portsentry.conf.
  • Portsentry reads this file at startup β€” so if you edit it, you gotta restart her to make it stick, bestie.
  • The config file is a simple text file with one option per line.
  • Lines starting with a # are considered comments and are ignored. (So go ahead and annotate your life, she won't judge πŸ’…)

There's an example configuration file included with portsentry, and it's available here with extra comments, examples and recommendations for how to set up Portsentry:

https://github.com/portsentry/portsentry/blob/master/exam‐ ples/portsen‐ try.conf

(it's on GitHub, go peek, it's giving helpful ✨)


✨ OPTIONS ✨

πŸŽ€ TCP_PORTS=β€œ<ports>”

A comma separated list of TCP ports you want to monitor. You can specify inclusive port ranges with a dash, e.g., 10-20 to include port 10 to 20. Inclusive means both ends, no gatekeeping 🫢

πŸ’œ Example

TCP_PORTS=β€œ10,20,30-40”

πŸŽ€ UDP_PORTS=β€œ<ports>”

A comma separated list of UDP ports you want to monitor. You can specify inclusive port ranges with a dash, e.g., 10-20 to include port 10 to 20. Same energy as TCP, different protocol 🌈

πŸ’œ Example

UDP_PORTS=β€œ10,20,30-40”

πŸŽ€ IGNORE_FILE=β€œ<path to ignore file>”

Path to a file with IP addresses to ignore when logging and taking actions. Any IP/CIDR address in this file will be ignored. This is useful for ignoring local traffic or other trusted hosts. Basically the VIP list β€” they get in, no questions asked 😌

πŸŽ€ HISTORY_FILE=β€œ<path to history file>”

This file contains all the IP addresses that have triggered the Portsentry detection engine in some way. If you wanna know how to actually read this thing, there's a HOWTO-Logfile:

https://github.com/portsentry/portsentry/blob/master/docs/HOWTO-Log‐ file.md

πŸŽ€ BLOCKED_FILE=β€œ/tmp/portsentry.blocked”

When Portsentry's action mechanism is used (BLOCK_TCP and/or BLOCK_UDP is set to 1 or 2, see below), this file will contain a list of all hosts that trigger an action. If a host is matched against this file, no further action will be taken β€” she's already handled, bestie, we're not doing it twice πŸ’€

Leaving this field as an empty string β€œβ€ or not setting it at all will cause the action mechanism to always trigger when a scan is detected. So yeah, empty string = no memory, all vibes, every scan gets the full treatment πŸ”₯

πŸŽ€ RESOLVE_HOST = β€œ<1|0>”

DNS Name resolution, babes:

  • Setting this to β€œ1” will turn on DNS lookups for attacking hosts.
  • Setting it to β€œ0” (or any other value) will not perform DNS lookups.
  • Default is β€œ0”.
NOTE: Using DNS resolution can slow down the response time of Portsentry. She's doing extra homework, give her a sec 😭

πŸŽ€ BLOCK_TCP=β€œ0|1|2” and BLOCK_UDP=β€œ0|1|2”

This option controls how Portsentry reacts to a detected connection attempt. Three flavors, pick your fighter πŸ‘‘

0 = Do not block UDP/TCP scans. The detected connection attempt is only logged. This could be useful for monitoring purposes or use of an external tool, such as fail2ban. This option is the default.

NOTE: It is highly recommended to only log connection attempts (by using: BLOCK_TCP=β€œ0” and BLOCK_UDP=β€œ0”) and use an external tool such as fail2ban to block the attacking host based on the log file generated by Portsentry. The reason for this is that other tools are more sophisticated. For example, fail2ban will persist the blocked host across reboots. (She remembers. Portsentry lowkey doesn't πŸ’€)

1 = Block UDP/TCP scans. This option will block the attacking host after the scan is detected using the technique specified in the KILL_ROUTE and/or KILL_HOSTS_DENY section below. If KILL_ROUTE is defined, it will run first, followed by KILL_HOSTS_DENY if it is set. If the KILL_RUN_CMD option is set, the command will also be executed.

NOTE: These options are preserved as a legacy option for those who cannot use an external tool to block the attacking host, or have some specific use-case where this method is preferred. Respect the elders 🫢

2 = Run external command only (KILL_RUN_CMD). This option will only run the external command specified in the KILL_RUN_CMD.

πŸŽ€ KILL_ROUTE=β€œβ€

The KILL_ROUTE option is used to drop or blacklist the attacking host. This can be done in a number of ways depending on your OS. The string TARGET is replaced with the attacking host. So TARGET is the placeholder, she gets swapped in like a plot twist ✨

πŸ’œ Example

KILL_ROUTE=β€œ/usr/local/bin/iptables -I INPUT -s TARGET -j DROP”

πŸŽ€ KILL_HOSTS_DENY=β€œβ€

This text will be dropped into the hosts.deny file for wrappers to use. Yes, the classic. Old but iconic πŸ’…

πŸ’œ Example

KILL_HOSTS_DENY=β€œALL: TARGET”

πŸŽ€ KILL_RUN_CMD=β€œ/some/path/here/script TARGET PORT”

This is a command that can be run when Portsentry is triggered. It can be whatever you want it to be. Your world, your script, your rules 🌈

πŸŽ€ KILL_RUN_CMD_FIRST = β€œ0|1”

The KILL_RUN_CMD_FIRST value should be set to β€œ1” to force the command to run before the KILL_ROUTE/KILL_HOSTS_DENY is executed, and should be set to β€œ0” to make the command run after the blocking has occurred. Order of operations, bestie β€” it matters 😌

πŸŽ€ SCAN_TRIGGER=β€œ0”

Enter the number of port connects from the same host you will allow before an alarm is given. The default is 0, which will react immediately. Zero patience, zero chill, we love that for her πŸ”₯

πŸŽ€ PORT_BANNER=β€œ*** UNAUTHORIZED ACCESS PROHIBITED *** YOUR CONNECTION ATTEMPT HAS BEEN LOGGED.”

When Portsentry is used in β€œconnect” mode [Legacy option] you can specify a banner to be displayed to the connecting host. Once the banner is displayed, the connection will be closed. It's giving "we saw you, and we wrote it down" πŸ“


🌟 EXAMPLES 🌟

Go view the example configuration file, it has the whole glow-up already written out:

https://github.com/portsentry/portsentry/blob/master/examples/portsen‐ try.conf

(it's the portsentry.conf example, go look, you'll be obsessed πŸ’–)


πŸ“ FILES πŸ“

  • /etc/portsentry/portsentry.conf

πŸ™ˆ BUGS πŸ™ˆ

All bugs should be reported via the Portsentry GitHub issue tracker:

https://github.com/portsentry/portsentry/issues

Not me telling on bugs, but like, do it, it helps 😭


πŸ‘‘ AUTHORS πŸ‘‘

Marcus Hufvudsson mh@protohuf.com β€” legend behavior, we thank him for his service 🫢


🌈 SEE ALSO 🌈


πŸ’œ LICENSE πŸ’œ

Portsentry is licensed under the BSD-2-Clause license. Slay, legally ✨


okay that's the whole page bestie, every last flag and file path accounted for, no cap πŸ’… this was the portsentry.conf(8) page out of the System Manager's Manual, and yeah the footer said the same thing as the header, because manual pages love a little symmetry πŸŽ€ mwah, go configure something iconic βœ¨πŸ¦‹

πŸ“¦ where this page comes from