1*b8fdf588SBrad Davis# 2*b8fdf588SBrad Davis# hosts.allow access control file for "tcp wrapped" applications. 3*b8fdf588SBrad Davis# 4*b8fdf588SBrad Davis# NOTE: The hosts.deny file is deprecated. 5*b8fdf588SBrad Davis# Place both 'allow' and 'deny' rules in the hosts.allow file. 6*b8fdf588SBrad Davis# See hosts_options(5) for the format of this file. 7*b8fdf588SBrad Davis# hosts_access(5) no longer fully applies. 8*b8fdf588SBrad Davis# 9*b8fdf588SBrad Davis# _____ _ _ 10*b8fdf588SBrad Davis# | ____| __ __ __ _ _ __ ___ _ __ | | ___ | | 11*b8fdf588SBrad Davis# | _| \ \/ / / _` | | '_ ` _ \ | '_ \ | | / _ \ | | 12*b8fdf588SBrad Davis# | |___ > < | (_| | | | | | | | | |_) | | | | __/ |_| 13*b8fdf588SBrad Davis# |_____| /_/\_\ \__,_| |_| |_| |_| | .__/ |_| \___| (_) 14*b8fdf588SBrad Davis# |_| 15*b8fdf588SBrad Davis# !!! This is an example! You will need to modify it for your specific 16*b8fdf588SBrad Davis# !!! requirements! 17*b8fdf588SBrad Davis 18*b8fdf588SBrad Davis 19*b8fdf588SBrad Davis# Start by allowing everything (this prevents the rest of the file 20*b8fdf588SBrad Davis# from working, so remove it when you need protection). 21*b8fdf588SBrad Davis# The rules here work on a "First match wins" basis. 22*b8fdf588SBrad DavisALL : ALL : allow 23*b8fdf588SBrad Davis 24*b8fdf588SBrad Davis# Wrapping sshd(8) is not normally a good idea, but if you 25*b8fdf588SBrad Davis# need to do it, here's how 26*b8fdf588SBrad Davis#sshd : .evil.cracker.example.com : deny 27*b8fdf588SBrad Davis 28*b8fdf588SBrad Davis# Protect against simple DNS spoofing attacks by checking that the 29*b8fdf588SBrad Davis# forward and reverse records for the remote host match. If a mismatch 30*b8fdf588SBrad Davis# occurs, access is denied, and any positive ident response within 31*b8fdf588SBrad Davis# 20 seconds is logged. No protection is afforded against DNS poisoning, 32*b8fdf588SBrad Davis# IP spoofing or more complicated attacks. Hosts with no reverse DNS 33*b8fdf588SBrad Davis# pass this rule. 34*b8fdf588SBrad DavisALL : PARANOID : RFC931 20 : deny 35*b8fdf588SBrad Davis 36*b8fdf588SBrad Davis# Allow anything from localhost. Note that an IP address (not a host 37*b8fdf588SBrad Davis# name) *MUST* be specified for rpcbind(8). 38*b8fdf588SBrad DavisALL : localhost 127.0.0.1 : allow 39*b8fdf588SBrad Davis# Comment out next line if you build libwrap without IPv6 support. 40*b8fdf588SBrad DavisALL : [::1] : allow 41*b8fdf588SBrad Davis#ALL : my.machine.example.com 192.0.2.35 : allow 42*b8fdf588SBrad Davis 43*b8fdf588SBrad Davis# To use IPv6 addresses you must enclose them in []'s 44*b8fdf588SBrad Davis#ALL : [fe80::%fxp0]/10 : allow 45*b8fdf588SBrad Davis#ALL : [fe80::]/10 : deny 46*b8fdf588SBrad Davis#ALL : [2001:db8:2:1:2:3:4:3fe1] : deny 47*b8fdf588SBrad Davis#ALL : [2001:db8:2:1::]/64 : allow 48*b8fdf588SBrad Davis 49*b8fdf588SBrad Davis# Sendmail can help protect you against spammers and relay-rapers 50*b8fdf588SBrad Davissendmail : localhost : allow 51*b8fdf588SBrad Davis#sendmail : .nice.guy.example.com : allow 52*b8fdf588SBrad Davis#sendmail : .evil.cracker.example.com : deny 53*b8fdf588SBrad Davissendmail : ALL : allow 54*b8fdf588SBrad Davis 55*b8fdf588SBrad Davis# Exim is an alternative to sendmail, available in the ports tree 56*b8fdf588SBrad Davisexim : localhost : allow 57*b8fdf588SBrad Davis#exim : .nice.guy.example.com : allow 58*b8fdf588SBrad Davis#exim : .evil.cracker.example.com : deny 59*b8fdf588SBrad Davisexim : ALL : allow 60*b8fdf588SBrad Davis 61*b8fdf588SBrad Davis# Rpcbind is used for all RPC services; protect your NFS! 62*b8fdf588SBrad Davis# Rpcbind should be running with -W option to support this. 63*b8fdf588SBrad Davis# (IP addresses rather than hostnames *MUST* be used here) 64*b8fdf588SBrad Davis#rpcbind : 192.0.2.32/255.255.255.224 : allow 65*b8fdf588SBrad Davis#rpcbind : 192.0.2.96/255.255.255.224 : allow 66*b8fdf588SBrad Davisrpcbind : ALL : deny 67*b8fdf588SBrad Davis 68*b8fdf588SBrad Davis# NIS master server. Only local nets should have access 69*b8fdf588SBrad Davis# (Since this is an RPC service, rpcbind needs to be considered) 70*b8fdf588SBrad Davisypserv : localhost : allow 71*b8fdf588SBrad Davis#ypserv : .unsafe.my.net.example.com : deny 72*b8fdf588SBrad Davis#ypserv : .my.net.example.com : allow 73*b8fdf588SBrad Davisypserv : ALL : deny 74*b8fdf588SBrad Davis 75*b8fdf588SBrad Davis# Provide a small amount of protection for ftpd 76*b8fdf588SBrad Davisftpd : localhost : allow 77*b8fdf588SBrad Davis#ftpd : .nice.guy.example.com : allow 78*b8fdf588SBrad Davis#ftpd : .evil.cracker.example.com : deny 79*b8fdf588SBrad Davisftpd : ALL : allow 80*b8fdf588SBrad Davis 81*b8fdf588SBrad Davis# You need to be clever with finger; do _not_ backfinger!! You can easily 82*b8fdf588SBrad Davis# start a "finger war". 83*b8fdf588SBrad Davisfingerd : ALL \ 84*b8fdf588SBrad Davis : spawn (echo Finger. | \ 85*b8fdf588SBrad Davis /usr/bin/mail -s "tcpd\: %u@%h[%a] fingered me!" root) & \ 86*b8fdf588SBrad Davis : deny 87*b8fdf588SBrad Davis 88*b8fdf588SBrad Davis# The rest of the daemons are protected. 89*b8fdf588SBrad DavisALL : ALL \ 90*b8fdf588SBrad Davis : severity auth.info \ 91*b8fdf588SBrad Davis : twist /bin/echo "You are not welcome to use %d from %h." 92