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 
            
               
                [1] [2] 下一页 
              
            
            
            
            
                
              
            
            
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)。 
(出处:http://www.sheup.com)
            
               
                上一页 [1] [2] 
              
            
            
            
            
                
              
            
            
#允许防火墙主机使用认证服务器 
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)。 
(出处:http://www.sheup.com/)
            
               
                上一页 [1] [2] [3]