How can I programmatically manage iptables rules on the fly?

后端 未结 9 1280
盖世英雄少女心
盖世英雄少女心 2020-11-29 00:20

I need to query existing rules, as well as being able to easily add and delete rules. I haven\'t found any API\'s for doing this. Is there something that I\'m missing?

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 00:56

    I know its a short term solution, per the netfilter discussion, but in the short term you can use iptc wrapped in python with this:

    https://github.com/ldx/python-iptables

    I played with it some in a recent project of mine and found it quite effective.

提交回复
热议问题