Manually add IP address to blocklistd
- Reply: Dag-Erling_Smørgrav : "Re: Manually add IP address to blocklistd"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Apr 2026 21:10:20 UTC
I am looking for a way to manually add an address to blocklistd. I wrote a quick program to make calls to the blocklist lib. However, all the visible calls require a connected fd. I am able to fake that. However, to do that the program needs to bind the address to the fd. That only works if the port is unused. blocklistd obtains the port from the fd, I need to add IP addresses for ports that are in use. Bind returns an error as the port is already in use. If I use a random port (unused), the the program properly adds the IP address to blocklistd's database. I can block the IP address using a blackhole list in pf. However, then I have to remember to remove it later. Blocklistd handles the removal without any manual intervention. in most cases, I believe these addresses are not static and will eventually be provided to another user who I don't need to block. I suppose that I could write a database driven list of IP addresses that I have blocked and have it manage the removal using the blocklistd helper interface which is documented. I am not thrilled about having to duplicate functions. -- Doug