Score:0

How to make IpTable Rules immutable in linux

ch flag

I work on Linux and want to add rules to iptable. I want these rules to be immutable anyway (either changed or deleted). What should I do? Note that for me the rules that are running and kept in memory are important, not the rules that are stored in the iptable rules file.

I found a way to save the rules in a file and compare them with the rules backup file and detect the changes, but it's not a good way, I think it's too slow and there are ways to bypass this check.

Score:3
za flag

There is no way to do that. root can always change the ruleset, no matter what.

In addition to that, locking individual rules is pointless, since their order and other interference factors are important in consideration of how the whole ruleset works. For example, instead of disabling or changing some rule I can add another rule above it with the same (or wider) match that could do some other action, overriding the old rule and rendering it useless (as if it doesn't exist). You should lock the whole ruleset at once, i.e. the whole firewall configuration, and not individual rules.

The only way to make sure the firewall configuration is immutable is to tightly control who can get root privileges, which you should do anyway.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.