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