FS#4 - iptables init script rewrite
Attached to Project:
Packages
Opened by Phillip Smith (fukawi2) - Monday, 02 November 2009, 05:56 GMT
Last edited by Phillip Smith (fukawi2) - Thursday, 11 February 2010, 05:43 GMT
Opened by Phillip Smith (fukawi2) - Monday, 02 November 2009, 05:56 GMT
Last edited by Phillip Smith (fukawi2) - Thursday, 11 February 2010, 05:43 GMT
|
DetailsRewrite of the iptables init script to allow firewall rules to be maintained and updated by the package, but without affecting local rules implemented by the user.
Example configuration: The iptables package should install: /etc/iptables/rules.d/10-base.rules /etc/iptables/rules.d/15-scrubbing.rules /etc/iptables/rules.d/20-stealth.rules /etc/iptables/rules.d/99-outbound.rules The init script will load any *.rules file it finds in /etc/iptables/rules.d/ in order to create a complete firewall. The user is free to add any additional .rules files (eg, 40-local.rules) they require which will be loaded automatically. Outstanding Issues: - How to allow the user to disable a .rules file without breaking the rest of the ruleset? - How do we determine the default policies to be pushed with a package? |
This task depends upon
-I INPUT -m state --state INVALID -j DROP
-I FORWARD -m state --state INVALID -j DROP
-I OUTPUT -m state --state INVALID -j DROP
-I FORWARD -p udp -m udp --sport 4000 -m string --string "witty message" --algo bm --to 65535 -j DROP
-I INPUT -p tcp -m string --string ".ida?" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I INPUT -p tcp -m string --string "/root.exe" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I INPUT -p tcp -m string --string "cmd.exe" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I INPUT -p tcp -m string --string "root.exe" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I INPUT -p tcp -m string --string "Admin.dll" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "nimda" -j DROP
-I FORWARD -p tcp -m string --string ".ida?" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I FORWARD -p tcp -m string --string "/root.exe" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I FORWARD -p tcp -m string --string "cmd.exe" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I FORWARD -p tcp -m string --string "root.exe" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "code-red" -j DROP
-I FORWARD -p tcp -m string --string "Admin.dll" --algo bm --to 65535 -m tcp --tcp-flags ACK ACK -m comment --comment "nimda" -j DROP
A simple solution to this could be to hard-link the rule files between the packages in the git tree (lamp.git/apache/httpd.rules, lamp.git/lightpd/httpd.rules and lamp.git/nginx/httpd.rules), but that would only work if one packager was maintaining all 3 packages.
After playing with Fedora 12 over the last few weeks, I've realised I've actually basically converted their iptables init script to Arch/BSD style as far as saving rules on stop/restart and saving counters etc lol
It makes my firewall easier to control -> I open only what I really need -> it's safer !
If I want a distribution which handle configuration of every packages for me, there's already one : debian. I really wish Arch Server won't behave like this, but I'm open-minded, if it's the best way to make the system safe then go !
> packages in the git tree (lamp.git/apache/httpd.rules,
> lamp.git/lightpd/httpd.rules and lamp.git/nginx/httpd.rules), but that would
> only work if one packager was maintaining all 3 packages.
...make a fake dependency called httpd. It would act as provides, similarly how
msmtp and postfix provide smtp-forwarder.
This httpd package holds the iptables rules that all these packages share.
That's the whole point of dependencies.