pcollinson / nftfw

nftfw - nftables firewall builder for Debian
MIT License
37 stars 4 forks source link

Specify a range of ports in the file name for incoming.d/ #7

Closed T0unet closed 1 year ago

T0unet commented 2 years ago

Hello,

First, thanks for this great tool, works well 😄

Would it be possible to make a change to specify the port range in the file name? Better than : for port in {<range_start>..<range_end>} do touch ??-$port echo x.x.x.x/32 > 20-$port done

😅

pcollinson commented 1 year ago

The way to achieve this is to create your own rule in rule.d for the port range you want to deal with. Create a new file called say myports.sh, then name it 20-myports in incoming.d.

The best example to use is perhaps accept.sh, copy it to myports.sh add say:

PORTS='5000-5999'

somewhere above the if statement testing for PORTS.

You can make PORTS into a comma separated list if that is needed:

PORTS='5000-5999,7000-7999'

Test the script by running it through bash to make sure it's syntactically correct before using it.

T0unet commented 1 year ago

Thx for your answer, that's a very clear explanation. but I hope there will be an evolution about the port name ;)