Ubuntu下的防火牆Gufw-ufw
Gufw是ufw的桌面版本,網上有Gufw的安裝和配置方法,可是我認爲並非很好。網上的教程也有點愚弄大衆的嫌疑,由於按照他的說法,最後防火牆根本就沒法自動啓動,每次要手動啓動,還要每次輸入密碼,很麻煩,不推薦使用,仍是終端下運行的這個ufw好。
相關閱讀:Ubuntu 8.10下安裝設置Gufw-ufw圖形界面防火牆[多圖]
測試環境:Ubuntu 10.04
1.安裝
sudo apt-get install ufw
2.啓用
sudo ufw enable
sudo ufw default deny
運行以上兩條命令後,開啓了防火牆,並在系統啓動時自動開啓。
關閉全部外部對本機的訪問,但本機訪問外部正常。
3.開啓/禁用
sudo ufw allow|deny [service]
打開或關閉某個端口,例如:
sudo ufw allow smtp 容許全部的外部IP訪問本機的25/tcp (smtp)端口
sudo ufw allow 22/tcp 容許全部的外部IP訪問本機的22/tcp (ssh)端口
sudo ufw allow 53 容許外部訪問53端口(tcp/udp)
sudo ufw allow from 192.168.1.100 容許此IP訪問全部的本機端口
sudo ufw allow proto udp 192.168.0.1 port 53 to 192.168.0.2 port 53
sudo ufw deny smtp 禁止外部訪問smtp服務
sudo ufw delete allow smtp 刪除上面創建的某條規則
4.查看防火牆狀態
sudo ufw status
通常用戶,只需以下設置:
sudo apt-get install ufw
sudo ufw enable
sudo default deny
以上三條命令已經足夠安全了,若是你須要開放某些服務,再使用sudo ufw allow開啓。
************************************************
Ubuntu 安裝CSF防火牆
1. 安裝
Login as the root user to SSH and run the following commands.
rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
apt-get install libwww-perl
tar -xzf csf.tgz
cd csf
sh install.sh
2. 防範DDOS攻擊
Step 1 : Open the CSF configuration file /etc/csf/csf.conf
Step 2 : In that search for option called CT_LIMIT, by default it will be like CT_LIMIT=0 , change this to CT_LIMIT=90 ,here 90 is the max no.of connections from an IP to your server ( choose this value according to your server usage )
Step 3:Now search for option called CT_PORTS.This option is used to specify the port for which you want prevent DOS attack.Since our aim is to prevent the DOS attck to apache – port 80 , change CT_PORTS = 「」 to CT_PORTS = 「80″
3. 限制每一個IP鏈接數
CONNLIMIT = "80;7"
4. PT_LIMIT = "0" 禁止程序內存不足時,發郵件