Tom*_*ski 6 security firewall ufw
来自源包的自述文件说:
When installing ufw from source, you will also need to integrate it into your
boot process for the firewall to start when you restart your system. Depending
on your needs, this can be as simple as adding the following to a startup
script (eg rc.local for systems that use it):
# /lib/ufw/ufw-init start
For systems that use SysV initscripts, an example script is provided in
doc/initscript.example. See doc/upstart.example for an Upstart example. Consult
your distribution's documentation for the proper way to modify your boot
process.
Run Code Online (Sandbox Code Playgroud)
在我的系统上,我有这个:
# /etc/ufw/ufw.conf
#
# Set to yes to start on boot. If setting this remotely, be sure to add a rule
# to allow your remote connection before starting ufw. Eg: 'ufw allow 22/tcp'
ENABLED=yes
Run Code Online (Sandbox Code Playgroud)
那么,为什么简单的 iptables 规则管理器需要在启动时启动呢?这有什么秘密吗,或者它只是检查所有规则是否到位?
系统启动时,没有防火墙规则。内核不会将它们保存到任何地方。
如果你不启动 UFW(或其他一些防火墙管理器),你的 iptables 是空的。此外,每个链(FORWARD、INPUT、OUTPUT)的默认规则是 ACCEPT,所以一切都是允许的。
所以 UFW 不仅仅是检查,它实际上是将这些规则放在适当的位置,并创建用于规则管理的额外链。
当您运行 iptables(Linux 中用于操作 netfilter 防火墙规则的低级工具)时,该规则仅加载到内核中,因此位于 RAM 中。当您关闭或重新启动时,内核会重新初始化,因为 RAM 不是持久内存,并且对于所有表(或没有防火墙)默认为 ACCEPT。
因此,要在启动后使用防火墙,您必须将 iptables 规则加载到内核中。您可以通过将 iptables 规则添加到启动时运行的脚本(例如 /etc/rc.local)来手动执行此操作,或者使用工具为您执行此操作。ufw 就是这样一种工具,启用后,它会在引导时为您加载防火墙规则,如果它像自述文件所说的那样集成到引导过程中。如果 ufw 是为您的发行版打包的,就像在 Ubuntu 中一样,那么打包会为您处理。简单地说,在 Ubuntu 中通过 apt-get 安装 ufw 后,除了运行“sudo ufw enable”之外,您无需执行任何其他操作即可将其集成到系统中。
| 归档时间: |
|
| 查看次数: |
15656 次 |
| 最近记录: |