Automated Network Threat Response

Update to OP points

  1. done, extremely successful, most haxors do come back after a couple of tries
  2. done, but not via /etc/nginx.conf, above location regex’s taxing for 1 core CPU
  3. done, ranges are still manual atm (differcult to create valid range mask for said IPv4)

Threat de-escalation amounts to manually assessing IPv4 blackholed via a bunch of shell scripts (from both a block dir containing IPv4 and ip r directly) that do customised validation of IPv4 addresses, with the resulting output of ip route add blackhole 127.0.0.127 piped to a seperate log file (along with script origin, pid, and timestamp.

After running the first 2 Nginx location blacklist generations (that post process specific development url removal), I now find I really need a tool that can incrementally add to whats already there (because the information is now spread around multiple log files), which is some 400 specific urls + 2 dozen customized regex’s, that are logged to nginx-haxors.log.

So I have enough for a good /etc/nginx/nginx-block.conf that will be uploaded to GH. But I also think some of the custom regex’s need tweaking (maybe). That alternate log allows extra IPv4 processing, which consists of shell scripts run by www specific cron jobs, where the resulting IPv4 need to be patched into the blackhole interface by a root cron job that runs directly after it.

All the shell script are kept inside the www tree with www ownsership, meant to allow a web interface management tool via thttpd proxy through nginx port 80 (which does not exist yet). The scripts current security model in this space is security by obscurity (SBO), where their construction, location and naming conventions are designed in such a way as only be useful if used with an install script that allows SBO technique to remain unique.

This installer script is the only thing missing before the complete set of scripts can be made publicly available via GH. The shell scripts are paired with a few convention named PHP scripts and output folders to allow data analysis and log files to be easily views, which also require the install script to maintain their SBO.

After much study of web server haxor attempts, this particular type of SBO model seems like the only real practical solution ATM. This collection, along with a multi-device favicon example, will be released as a standalone project for the Devember 2021 challenge.

As a by-product of this decision, the is NO upstream interaction. And there may never be, as I have since realised its too open to abuse (and stupidity), althought I will probably look at it again after doing the new filesystem driver mentioned elsewhere in this thread (but that wont be till after the standalone project is more complete). It does seem totally doable on a private LAN, say with a PiHole box, but I dont have reliable power locally, so thats just another reason to put it off.

It is hoped that the results of the Devember 2021 challenge will produce (at least) Apache and Lighttpd block list config files as well, hopefully tested via RPiOS (ie Debian +systemd based). It is also hoped that a practical way to handle specific 403 and 402 HTTP/PHP POST attacks will also result from testing on another OS configuration.

Cheers

Paul