LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   iptables duplicate rules. (https://www.linuxquestions.org/questions/linux-security-4/iptables-duplicate-rules-4175567796/)

hack3rcon 01-24-2016 01:36 PM

iptables duplicate rules.
 
Hello.
How can I remove any duplicate iptables rule? any command exist?

Tnx.

unSpawn 01-24-2016 03:44 PM

Quote:

Originally Posted by hack3rcon (Post 5486765)
How can I remove any duplicate iptables rule? any command exist?

Prune it manually. Next time make an effort documenting what you tried yourself when asking any questions.

hack3rcon 01-27-2016 08:11 AM

I found below link :
http://www.krazyworks.com/remove-dup...ptables-rules/

unSpawn 01-28-2016 01:14 AM

Thanks for sharing. Does seem harmless but do test before using because I found it removed the last "COMMIT" line so if you expect the rule set to be loaded on boot it may fail to complete for not seeing that line...

salasi 01-28-2016 04:18 AM

I'm out if my comfort zone here, but I don't think the code in that link works (actually, it is more that the idea does not work). I think if you run it against a set of rules that has duplicates in different chains, which you would have done deliberately, it will remove those dupes.

Safer done manually, for any reasonable number of rules.


All times are GMT -5. The time now is 03:13 PM.