用FWTK配置Linux防火牆(轉)
FWTK是一套用來建立和維護內部網路防火牆的工具集。它包含了許多獨立的元件,大部分元件是代理應用程式,如telnet、FTP、rlogin、 sendmail、HTTP、X windows等。與Squid、Socks等同類軟體相比,它的突出優點是不但可以從本地和目標地的主機名、IP地址來指定訪問規則,而且可以根據訪問操作來允許或拒絕某個執行命令,充分地體現了應用層閘道器的優勢。本文以telnet為例介紹如何利用FWTK配置Linux上的代理伺服器型防火牆。
系統環境和設計目標
系統配置環境:Red Hat Linux 6.1、FWTK v2.1、雙網路卡(一塊用於外部網路,一塊用於內部網路),設192.9.200.* 為外部網路,10.1.1.*為內部子網。
設計目標:
● 內部網路使用者可以telnet到任意外部主機上;
● 外部網路使用者必須在經過認證許可後才可以telnet到內部主機上;
● 只允許10.1.1.5 telnet到防火牆主機上(用於遠端管理);
● 所有使用者透過防火牆代理時,只允許使用普通使用者許可權;
● 限制超時設定為300秒鐘;
● 可以自行編輯防火牆上的提示資訊。
安裝FWTK
1.新建目錄/home/fwtk,將fwtk.tar.z複製到該目錄中,並解包:tar xzvf fwtk.tar.z。
2.準備編譯:
● 用Makefile.config.linux替換掉Makefile.config;
● 將Makefile.config中AUXLIB=-lcrypt一行前的#號去掉;
● 在auth/Makefile中的CFLAGS=-I…$(COPT)一行後新增-I /usr/inclue/db1。
3.編譯:make。
4.安裝:make install,所有的可執行檔案預設安裝在/usr/local/etc目錄中。
製作配置檔案
1.配置/etc/services。給telnet代理(簡稱tn-gw)增加埠號:
tn-gw 3333/tcp
2.配置/etc/inetd.conf。將通常的telnet埠移至3333,telnet代理在23號埠監聽(用高階口保護正常telent服務,netacl是FWTK提供的TCP包裝程式,功能和tcpd相似):
telnet stream tcp nowait root /usr/local/etc/tn-gw tn-gw
tn-gw stream tcp nowait root /usr/local/etc/netacl in.telnetd
執行命令killall -HUP inetd使改動生效。
3.配置/usr/local/etc/netperm-table(其中.txt檔案的內容由自己編寫,但一定要保證和directory的路徑一致):
● 控制登入防火牆主機(正常telnet)部分:
#允許本地登入
netacl-in.telnetd: permit-hosts 127.0.0.1 -exec /usr/sbin/in.telnetd
#只允許10.1.1.5遠端登入到防火牆
netacl-in.telnetd: permit-hosts 10.1.1.5 -exec /usr/sbin/in.telnetd
#顯示不允許登入時的拒絕資訊
netacl-in.telnetd: permit-hosts * -exec /bin/cat /home/guest/notelnet.txt
netacl-in.telnetd: timeout 300 #超時設定
● 控制透過防火牆主機(telnet代理)部分(最好在/etc/passwd中將guest的/bin/bash改成/bin/false):
#認證伺服器IP和埠號
tn-gw: authserver 127.0.0.1 7777
tn-gw: directory /home/guest #工作目錄
tn-gw: groupid guest #工作組名
tn-gw: userid guest #工作使用者名稱
# 歡迎資訊
tn-gw: welcome-msg tn-welcome.txt
# 對拒絕訪問者的資訊
tn-gw: denial-msg tn-deny.txt
# 對受限目的拒絕訪問者的資訊
tn-gw: denydest-msg tn-denydest.txt
tn-gw: help-msg tn-help.txt # 幫助資訊
tn-gw: timeout 300 # 設定超時的時間
tn-gw: prompt tn-gw-> # 提示符
# 允許10.1.1.*機器登入
tn-gw: permit-hosts 10.1.1.* -dest * -passok
# 允許192.9.200.*機器登入,但要求進行身份認證
tn-gw: permit-hosts 192.9.200.* -dest 10.1.1.* -auth
4.配置認證伺服器
● 配置/etc/services,給authsrv增加埠號:
authsrv 7777/tcp
● 配置/etc/inetd.conf,以inted程式啟動authsrv:
authsrv stream tcp nowait root /usr/local/etc/authsrv authsrv
執行killall -HUP inetd使改動生效。
5.配置netperm-table:
#允許防火牆主機使用認證伺服器
authsrv: hosts 127.0.0.1
#資料庫所在路徑
authsrv: database /usr/local/etc/fw-authdb
authsrv: directory /home/guest #工作目錄
authsrv: groupid guest #工作組名
authsrv: userid guest #工作使用者名稱
authsrv: badsleep 1200 #禁止嘗試註冊的時間
authsrv: timeout 300 #超時設定
authsrv: nobogus true #允許註冊失敗響應
依據以上步驟,同樣可以高效地配置FTP代理(ftp-gw)、郵件代理(smap)、HTTP代理(http-gw)、pop3代理(plug-gw)。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752019/viewspace-955570/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux 防火牆配置Linux防火牆
- Linux 配置防火牆Linux防火牆
- Linux 防火牆配置使用Linux防火牆
- iptables 配置LINUX防火牆Linux防火牆
- Linux防火牆配置初級入門(轉)Linux防火牆
- 用Linux防火牆構建軟路由(轉)Linux防火牆路由
- RedHat Linux下防火牆配置入門必學(轉)RedhatLinux防火牆
- linux防火牆使用以及配置Linux防火牆
- 在Linux中,如何配置防火牆?Linux防火牆
- 在linux上用arptables配置arp防火牆Linux防火牆
- 選用單防火牆DMZ還是雙防火牆DMZ(轉)防火牆
- 配置防火牆示例防火牆
- linux apf 防火牆安裝與配置Linux防火牆
- linux下配置vncserver 防火牆 本地映象LinuxVNCServer防火牆
- Linux 自帶防火牆 Iptables 基本配置Linux防火牆
- Linux防火牆程式設計(轉)Linux防火牆程式設計
- 配置基於ADSL的防火牆(轉)防火牆
- 使用netfilter/iptables配置防火牆(轉)Filter防火牆
- linux 防火牆Linux防火牆
- 用IPFW實現BSD防火牆(轉)防火牆
- CiscoPIX防火牆配置指南防火牆
- iptables配置-Linux系統安全防火牆Linux防火牆
- Linux中iptables防火牆的簡單配置Linux防火牆
- windows/Linux 防火牆安裝配置規則WindowsLinux防火牆
- 軟盤裡的Linux防火牆(轉)Linux防火牆
- 使用IP鏈建立Linux防火牆(轉)Linux防火牆
- 使用iptables建置Linux 防火牆(2)(轉)Linux防火牆
- 使用iptables建置Linux 防火牆(3)(轉)Linux防火牆
- Linux防火牆iptables實用設定Linux防火牆
- iptables實用知識 ,一文學會配置linux防火牆Linux防火牆
- 全面分析防火牆及防火牆的滲透(轉)防火牆
- LINUX 防火牆 firewalldLinux防火牆
- linux防火牆iptablesLinux防火牆
- Linux防火牆命令Linux防火牆
- Linux 防火牆配置(iptables和firewalld)詳細教程。Linux防火牆
- Linux防火牆的關閉、開啟和配置Linux防火牆
- Linux防火牆之IPtables概念與用法(轉)Linux防火牆
- Iptables防火牆應用防火牆