📄 firewall-howto.txt
字号:
如在FWTK源目录中添加ssl-gw,则在Makefile的目录单中也要加上ssl-gw。 DIRS= smap smapd netacl plug-gw ftp-gw tn-gw rlogin-gw http-gw x-gw ssl-gw 完成上述修改後,运行make。 7.3 安装TIS FWTK 运行make install。 默认的安装目录是/usr/local/etc。可以改到更加安全可靠 的目录进行安装,但也可以不改,也可将其特权改为chmod 700。 现在开始设定 防火墙。 7.4 设置TIS FWTK 好!下面就比较有趣了!设定的系统要能调用这些新功能,并建立管制表管理这 些功能。 以下的说明并不是为了要重写TIS FWTK的使用手册,其目的只是为了显 示可行的设定、可能遇到的问题和解决的办法。 有三个文档组成这些controls。 * /etc/services + 告诉系统所定功能在何埠号 * /etc/inetd.conf + 当服务埠有动作时告诉inetd启动那个程式 * /usr/local/etc/netperm-table + 告诉FWTK同意和拒绝来往的用户 要FWTK发挥作用,应彻底编辑这些档案。编辑这些功能档而不正确设定 inetd.conf或netperm-table,可能使系统完全无法作用。 netperm-table档 这个档控制何人可以使用TIS FWTK的功能。首先应该想到防火墙两边的需求。网 路外面的用户在进入网路之前应首先表明身份,但网路内部的用户则可直接通过 。 在表明身份时,防火墙使用一个称为authsrv的程式,其中存有用户的ID和密 码。netperm-table中的authentication部分控制这一数据库存放何处和谁可取用 。 要不让人取用这一功能并不容易,在premit-hosts这一行中使用“*”,以致 每人都能取用这一功能。这一行的正确设定应该是“authsrv: premit-hosts localhost”,但似乎不起作用。 # # Proxy configuration table: 代理伺服器设置表 # # Authentication server and client rules authsrv: database /usr/local/etc/fw-authdb authsrv: permit-hosts * authsrv: badsleep 1200 authsrv: nobogus true # Client Applications using the Authentication server *: authserver 127.0.0.1 114 要启动数据库,以root在/var/local/etc内运行./authsrv,设立管理者的使用记 录。实际操作如下∶ 阅读FWTK文档了解如何添加用户和用户组。 # # authsrv authsrv# list authsrv# adduser admin "Auth DB admin" ok - user added initially disabled authsrv# ena admin enabled authsrv# proto admin pass changed authsrv# pass admin "plugh" Password changed. authsrv# superwiz admin set wizard authsrv# list Report for users in database user group longname ok? proto last ------ ------ ------------------ ----- ------ ----- admin Auth DB admin ena passw never authsrv# display admin Report for user admin (Auth DB admin) Authentication protocol: password Flags: WIZARD authsrv# ^D EOT # Telnet的网关(tn-gw)控制直接了当,应首先设定。 例如,允许在保护网路内 的用户不表明身份直接通过(permit-hosts 196.1.2.* -passok)。但其他用户必 需提供用户ID和密码才可使用代理伺服器(permit-hosts * -auth)。 此外,有一 个系统(196.1.2.202)也可直接使用防火墙。这只要设定inetacl-in.telnetd的内 容即可。 Telnet的timeout时间应该短暂。 # telnet gateway rules: tn-gw: denial-msg /usr/local/etc/tn-deny.txt tn-gw: welcome-msg /usr/local/etc/tn-welcome.txt tn-gw: help-msg /usr/local/etc/tn-help.txt tn-gw: timeout 90 tn-gw: permit-hosts 196.1.2.* -passok -xok tn-gw: permit-hosts * -auth # Only the Administrator can telnet directly to the Firewall via Port 24 netacl-in.telnetd: permit-hosts 196.1.2.202 -exec /usr/sbin/in.telnetd r-command如同telnet的同一方式设定。 # rlogin gateway rules: rlogin-gw: denial-msg /usr/local/etc/rlogin-deny.txt rlogin-gw: welcome-msg /usr/local/etc/rlogin-welcome.txt rlogin-gw: help-msg /usr/local/etc/rlogin-help.txt rlogin-gw: timeout 90 rlogin-gw: permit-hosts 196.1.2.* -passok -xok rlogin-gw: permit-hosts * -auth -xok # Only the Administrator can telnet directly to the Firewall via Port netacl-rlogind: permit-hosts 196.1.2.202 -exec /usr/libexec/rlogind -a 任何人均不得直接进入防火墙,其中包括FTP,因此,不要把FTP伺服器放在防火 墙上。 再者,permit-hosts行允许保护网路内的任何人自由进入网际网路,其他 人则必需表明身份。下文附上送到和收到的每份文档的记录(-log { retr stor })。 FTP的timeout开关控制在多少时间後停止试接,以及在多少时间没有动作 後,放弃试接。 # ftp gateway rules: ftp-gw: denial-msg /usr/local/etc/ftp-deny.txt ftp-gw: welcome-msg /usr/local/etc/ftp-welcome.txt ftp-gw: help-msg /usr/local/etc/ftp-help.txt ftp-gw: timeout 300 ftp-gw: permit-hosts 196.1.2.* -log { retr stor } ftp-gw: permit-hosts * -authall -log { retr stor } 通过WWW、gopher和浏览器进行的ftp由http-gw控制。最上面的两行建立一个目录 ,用于储存经由防火墙的ftp和WWW文件。在本例中,这些文件属root所有,因此 放在只有root能够进入的目录内。 WWW的连接应该短暂。它控制使用者在连接不 通时的等待时间。 # www and gopher gateway rules: http-gw: userid root http-gw: directory /jail http-gw: timeout 90 http-gw: default-httpd www.afs.net http-gw: hosts 196.1.2.* -log { read write ftp } http-gw: deny-hosts * ssl-gw实际上是一个任何人都可通过的网关。应当当心设定。在本例中,任何保 护网路中的用户,除127.0.0.* 和192.1.1.* 外,均可连接网路外的任何伺服器 ,并只能使用443至563 埠号。443至563埠号一般称为SSL埠号。 # ssl gateway rules: ssl-gw: timeout 300 ssl-gw: hosts 196.1.2.* -dest { !127.0.0.* !192.1.1.* *:443:563 } ssl-gw: deny-hosts * 下面的例子说明如何利用plug-gw连接到新闻伺服器。在本例中,保护网路内的用 户只允许连接到一个系统,即连接到它的新闻埠。 第二行使新闻伺服器将其资料 送到保护网路。 对新闻伺服器的timeout时间设定应该比较长,因为多数用户大 都联机阅读新闻。 # NetNews Pluged gateway plug-gw: timeout 3600 plug-gw: port nntp 196.1.2.* -plug-to 199.5.175.22 -port nntp plug-gw: port nntp 199.5.175.22 -plug-to 196.1.2.* -port nntp Finger网关的设定至为简单。保护网路内的用户只要首先登录,就可使用防火墙 上的finger程式。任何其他人就只收到一段message。 # Enable finger service --------设定finger功能 netacl-fingerd: permit-hosts 196.1.2.* -exec /usr/libexec/fingerd netacl-fingerd: permit-hosts * -exec /bin/cat /usr/local/etc/finger.txt 在这份HOWTO中,没有设定Mail和X-windows功能。如任何人有这方面的实例,请 发email给我。 inetd.conf的设置档 下面附上/etc/inetd.conf的全部文档。所有不需要的功能都用#符号注销。在这 份全部文档中显示取消了何种功能,以及显示如何设定新的防火墙功能。 #echo stream tcp nowait root internal #echo dgram udp wait root internal #discard stream tcp nowait root internal #discard dgram udp wait root internal #daytime stream tcp nowait root internal #daytime dgram udp wait root internal #chargen stream tcp nowait root internal #chargen dgram udp wait root internal # FTP firewall gateway --------FTP防火墙网关 ftp-gw stream tcp nowait.400 root /usr/local/etc/ftp-gw ftp-gw # Telnet firewall gateway------Telnet防火墙网关 telnet stream tcp nowait root /usr/local/etc/tn-gw /usr/local/etc/tn-gw # local telnet services------用户的telnet功能 telnet-a stream tcp nowait root /usr/local/etc/netacl in.telnetd # Gopher firewall gateway------Gopher防火墙网关 gopher stream tcp nowait.400 root /usr/local/etc/http-gw /usr/local/etc/http-gw # WWW firewall gateway------WWW防火墙网关 http stream tcp nowait.400 root /usr/local/etc/http-gw /usr/local/etc/http-gw # SSL firewall gateway------SSL防火墙网关 ssl-gw stream tcp nowait root /usr/local/etc/ssl-gw ssl-gw # NetNews firewall proxy (using plug-gw)------NetNews防火墙代理伺服器(使用plug-gw) nntp stream tcp nowait root /usr/local/etc/plug-gw plug-gw nntp #nntp stream tcp nowait root /usr/sbin/tcpd in.nntpd # SMTP (email) firewall gateway------SMTP(email)防火墙网关 #smtp stream tcp nowait root /usr/local/etc/smap smap # # Shell, login, exec and talk are BSD protocols------ Shell, login, exec andtalk均属BSD协议 # #shell stream tcp nowait root /usr/sbin/tcpd in.rshd #login stream tcp nowait root /usr/sbin/tcpd in.rlogind #exec stream tcp nowait root /usr/sbin/tcpd in.rexecd #talk dgram udp wait root /usr/sbin/tcpd in.talkd #ntalk dgram udp wait root /usr/sbin/tcpd in.ntalkd #dtalk stream tcp waut nobody /usr/sbin/tcpd in.dtalkd # # Pop and imap mail services et al------Pop和imap mail功能 # #pop-2 stream tcp nowait root /usr/sbin/tcpd ipop2d #pop-3 stream tcp nowait root /usr/sbin/tcpd ipop3d #imap stream tcp nowait root /usr/sbin/tcpd imapd # # The Internet UUCP service------网际网路UUCP功能 # #uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico -l # # Tftp service is provided primarily for booting. Most sites # run this only on machines acting as "boot servers." Do not uncomment # this unless you *need* it. ----- Tftp功能主要用于启动。一般只有作为"boot伺服器"时才需要tftp。因此,不要取消注销(#)符号。 # #tftp dgram udp wait root /usr/sbin/tcpd in.tftpd #bootps dgram udp wait root /usr/sbin/tcpd bootpd # # Finger, systat and netstat give out user information which may be # valuable to potential "system crackers." Many sites choose to disable # some or all of these services to improve security.------ Finger, systat and netstat会向骇客提供可贵的资料。许多网站取消一些或全部功能,以增安全。 # # cfinger is for GNU finger, which is currently not in use in RHS Linux # cfinger是GNU finger,目前在RHS Linux中并不使用。 # finger stream tcp nowait root /usr/sbin/tcpd in.fingerd #cfinger stream tcp nowait root /usr/sbin/tcpd in.cfingerd #systat stream tcp nowait guest /usr/sbin/tcpd /bin/ps -auwwx #netstat stream tcp nowait guest /usr/sbin/tcpd /bin/netstat -f inet # # Time service is used for clock syncronization.-----时间功能用于设定时间的同步。 # #time stream tcp nowait root /usr/sbin/tcpd in.timed #time dgram udp wait root /usr/sbin/tcpd in.timed # # Authentication-----查验用户身份 # auth stream tcp wait root /usr/sbin/tcpd in.identd -w -t120 authsrv stream tcp nowait root /usr/local/etc/authsrv authsrv #
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -