Enable ipfw without rebooting
記錄一下,在 FreeBSD 載入 ipfw 而不用重開機的方法:
- 先編輯
/etc/rc.conf,主要就是加入firewall_type這個參數:# Define the firewall type in /etc/rc.conf. Valid values are: # open - will allow anyone in # client - will try to protect just this machine # simple - will try to protect a whole network # closed - totally disables IP services except via lo0 interface # UNKNOWN - disables the loading of firewall rules. # filename - will load the rules in the given filename (full path required)
- 因為
kldload不會去執行/etc/rc.firewall,而預設規則是 block all,所以指令要「用同一行」這麼下:kldload ipfw; sh /etc/rc.firewall
如此一來,才有可能讓
ipfw載入/etc/rc.firewall所指到的,能夠讓我們再連進去的「入口」。 - 指令下完後,SSH 會立刻斷線,但可以馬上再連進去。如果有用
screen的話,可以恢復到原先的環境。 - 可以在
/etc/loader.conf加入下面這行,以便在重開機之後,自動載入ipfw模組:ipfw_load="YES"
也許該來研究一下 mod_security 怎麼用了。
Random Posts
- None Found
Similar Posts
- None Found
One Comment
建議用 && 像是
kldload ipfw && ipfw add 65534 allow all from any to any
這樣會比較妥當 :)
Post a Comment