Debian - 在网络接口运行之前启动 UFW(简单防火墙)

Debian - 在网络接口运行之前启动 UFW(简单防火墙)

我想安装联邦水务局在 Debian Lenny 上。一切看起来都很简单,只是我不知道在哪里插入 UFW 启动脚本,以便它在 hax0rs 入侵之前配置 iptables。

我已经检查了运行级别目录和/etc/rc0.d/etc/rc6.d/etc/rcS.d还有如下物品:

S35networking -> ../init.d/networking
S36ifupdown -> ../init.d/ifupdown

运行级别 0 和 6 用于关机和重启,因此我猜想那里不需要进行任何更改,但是运行级别 S 对我来说(在 README 中)宣传自己:

The scripts in this directory whose names begin with an 'S' are executed
once when booting the system, even when booting directly into single user
mode.


The following sequence points are defined at this time:

* After the S40 scripts have executed, all local file systems are mounted
  and networking is available. All device drivers have been initialized.

(让我感到困扰的是 rc0/6.d 和 rcS.d 都指向相同的networking脚本ifupdown,但查看源代码后,我相信这些脚本足够智能,可以知道从哪里开始以及在哪里停止网络。)

现在,我认为我应该将我的插入/lib/ufw/ufw-init/etc/rcS.d,其优先级高于ifupdown和的优先级networking,即我的<= 38 /etc/rcS.d

我的这个“分析”正确吗?

答案1

运行rc0.d和时rc6.dinit调用stop脚本的操作。这样脚本就知道它是否应该启动或停止。

至少在我的 Debian 中有一个/etc/rcS.d/S14ufw,它与接口 ( ) 同时启动S14networking。如果这是问题(接口启动而防火墙关闭的时间可能非常短),您可以将其移动到S13ufw,例如rcS.d

您可能也想看看man update-rc.d

相关内容