selfhelp-iptables
selfhelp-iptables copied to clipboard
退出没有清空 iptable 规则
看到你新版说到清理 chain 的问题,我看了下,问题似乎依然存在。
我使用 systemctl 的方式启动,停止服务后,iptable 规则不会清除。
[Unit]
Description=iptable_whitelist
After=network.target
[Service]
Type=simple
ExecStart=/path/to/script/start.sh
Restart=always
#PrivateTmp=true
StandardInput=tty
StandardOutput=tty
StandardError=null
TTYPath=/dev/tty12
[Install]
WantedBy=multi-user.target
start.sh
#!/bin/bash
/path/to/script/selfhelp-iptables start ...bla bla... --reverse > ./out.txt 2>&1
另外,之前这样可以输出内容到 out.txt,但现在似乎不输出任何东西。
你下一下最新版本的程序看一看?理论上是修复了的。然后systemd部分我在readme最后一节写了一个示例,你可以看看。日志记录到文件中。
将命令写在 ExecStart= 里面可以在服务 stop 后清空规则。但写在 .sh 文件里还是不行。 这样当需要修改参数时会稍显麻烦。
那我之后加上对配置文件的支持吧
很好!
https://github.com/haojie06/selfhelp-iptables/releases/tag/2.4.3, 关于配置文件的使用可以看看readme,之后只需要修改配置文件然后systemctl restart就好了。