145088Smarkm#
256585Sobrien# hosts.allow access control file for "tcp wrapped" applications.
350472Speter# $FreeBSD$
445088Smarkm#
558750Scwt# NOTE: The hosts.deny file is deprecated.
658750Scwt#       Place both 'allow' and 'deny' rules in the hosts.allow file.
7276163Ssmh#       See hosts_options(5) for the format of this file.
8276163Ssmh#       hosts_access(5) no longer fully applies.
9276163Ssmh#
10276163Ssmh#   _____                                      _          _
11276163Ssmh#  | ____| __  __   __ _   _ __ ___    _ __   | |   ___  | |
12276163Ssmh#  |  _|   \ \/ /  / _` | | '_ ` _ \  | '_ \  | |  / _ \ | |
13276163Ssmh#  | |___   >  <  | (_| | | | | | | | | |_) | | | |  __/ |_|
14276163Ssmh#  |_____| /_/\_\  \__,_| |_| |_| |_| | .__/  |_|  \___| (_)
15276163Ssmh#                                     |_|
1653685Sobrien# !!! This is an example! You will need to modify it for your specific
1753685Sobrien# !!! requirements!
1845088Smarkm
1953685Sobrien
2045088Smarkm# Start by allowing everything (this prevents the rest of the file
2145088Smarkm# from working, so remove it when you need protection).
2245488Smarkm# The rules here work on a "First match wins" basis.
2345088SmarkmALL : ALL : allow
2445088Smarkm
2545088Smarkm# Wrapping sshd(8) is not normally a good idea, but if you
2645088Smarkm# need to do it, here's how
27130151Sschweikh#sshd : .evil.cracker.example.com : deny
2845088Smarkm
2981890Sdwmalone# Protect against simple DNS spoofing attacks by checking that the
3081890Sdwmalone# forward and reverse records for the remote host match. If a mismatch
3181890Sdwmalone# occurs, access is denied, and any positive ident response within
3281890Sdwmalone# 20 seconds is logged. No protection is afforded against DNS poisoning,
3381890Sdwmalone# IP spoofing or more complicated attacks. Hosts with no reverse DNS
3481890Sdwmalone# pass this rule.
3545088SmarkmALL : PARANOID : RFC931 20 : deny
3645088Smarkm
3760031Ssheldonh# Allow anything from localhost.  Note that an IP address (not a host
3874537Salfred# name) *MUST* be specified for rpcbind(8).
39155756SumeALL : localhost 127.0.0.1 : allow
40156813Sru# Comment out next line if you build libwrap without IPv6 support.
41155756SumeALL : [::1] : allow
42161710Sru#ALL : my.machine.example.com 192.0.2.35 : allow
4345088Smarkm
4463515Sume# To use IPv6 addresses you must enclose them in []'s
45161710Sru#ALL : [fe80::%fxp0]/10 : allow
46161710Sru#ALL : [fe80::]/10 : deny
47161710Sru#ALL : [2001:db8:2:1:2:3:4:3fe1] : deny
48161710Sru#ALL : [2001:db8:2:1::]/64 : allow
4963515Sume
5045088Smarkm# Sendmail can help protect you against spammers and relay-rapers
5145088Smarkmsendmail : localhost : allow
52161710Sru#sendmail : .nice.guy.example.com : allow
53161710Sru#sendmail : .evil.cracker.example.com : deny
5445088Smarkmsendmail : ALL : allow
5545088Smarkm
5649394Ssheldonh# Exim is an alternative to sendmail, available in the ports tree
5749394Ssheldonhexim : localhost : allow
58161710Sru#exim : .nice.guy.example.com : allow
59161710Sru#exim : .evil.cracker.example.com : deny
6049394Ssheldonhexim : ALL : allow
6149394Ssheldonh
6276030Salex# Rpcbind is used for all RPC services; protect your NFS!
63262860Smav# Rpcbind should be running with -W option to support this.
6453685Sobrien# (IP addresses rather than hostnames *MUST* be used here)
65161710Sru#rpcbind : 192.0.2.32/255.255.255.224 : allow
66161710Sru#rpcbind : 192.0.2.96/255.255.255.224 : allow
6774537Salfredrpcbind : ALL : deny
6845488Smarkm
6990319Smarkm# NIS master server. Only local nets should have access
70159140Scsjp# (Since this is an RPC service, rpcbind needs to be considered)
7190319Smarkmypserv : localhost : allow
72161710Sru#ypserv : .unsafe.my.net.example.com : deny
73161710Sru#ypserv : .my.net.example.com : allow
7490319Smarkmypserv : ALL : deny
7590319Smarkm
7645088Smarkm# Provide a small amount of protection for ftpd
7745488Smarkmftpd : localhost : allow
78161710Sru#ftpd : .nice.guy.example.com : allow
79161710Sru#ftpd : .evil.cracker.example.com : deny
8045088Smarkmftpd : ALL : allow
8145088Smarkm
8245088Smarkm# You need to be clever with finger; do _not_ backfinger!! You can easily
8345088Smarkm# start a "finger war".
8445088Smarkmfingerd : ALL \
8545088Smarkm	: spawn (echo Finger. | \
8645088Smarkm	 /usr/bin/mail -s "tcpd\: %u@%h[%a] fingered me!" root) & \
8745088Smarkm	: deny
8845088Smarkm
8957284Sjkh# The rest of the daemons are protected.
9045088SmarkmALL : ALL \
9157284Sjkh	: severity auth.info \
9245088Smarkm	: twist /bin/echo "You are not welcome to use %d from %h."
93