hosts.allow revision 81890
155825Speter#
2218822Sdim# hosts.allow access control file for "tcp wrapped" applications.
3114370Speter# $FreeBSD: head/etc/hosts.allow 81890 2001-08-18 14:22:52Z dwmalone $
439818Speter#
5114370Speter# NOTE: The hosts.deny file is deprecated.
639818Speter#       Place both 'allow' and 'deny' rules in the hosts.allow file.
739818Speter#	See hosts_options(5) for the format of this file.
839818Speter#	hosts_access(5) no longer fully applies.
9220090Salc
10220090Salc#	 _____                                      _          _ 
11114370Speter#	| ____| __  __   __ _   _ __ ___    _ __   | |   ___  | |
12114370Speter#	|  _|   \ \/ /  / _` | | '_ ` _ \  | '_ \  | |  / _ \ | |
13218822Sdim#	| |___   >  <  | (_| | | | | | | | | |_) | | | |  __/ |_|
14114370Speter#	|_____| /_/\_\  \__,_| |_| |_| |_| | .__/  |_|  \___| (_)
15114370Speter#					   |_|                   
16114370Speter# !!! This is an example! You will need to modify it for your specific
17114370Speter# !!! requirements!
18114370Speter
19114370Speter
20114370Speter# Start by allowing everything (this prevents the rest of the file
21114370Speter# from working, so remove it when you need protection).
22114370Speter# The rules here work on a "First match wins" basis.
23114370SpeterALL : ALL : allow
24114370Speter
25114370Speter# Wrapping sshd(8) is not normally a good idea, but if you
26114370Speter# need to do it, here's how
27218822Sdim#sshd : .evil.cracker.example.com : deny 
28218822Sdim
29114370Speter# Protect against simple DNS spoofing attacks by checking that the
30114370Speter# forward and reverse records for the remote host match. If a mismatch
31114370Speter# occurs, access is denied, and any positive ident response within
32114370Speter# 20 seconds is logged. No protection is afforded against DNS poisoning,
33114370Speter# IP spoofing or more complicated attacks. Hosts with no reverse DNS
34114370Speter# pass this rule.
35114370SpeterALL : PARANOID : RFC931 20 : deny
36114370Speter
37114370Speter# Allow anything from localhost.  Note that an IP address (not a host
38114370Speter# name) *MUST* be specified for rpcbind(8).
39114370SpeterALL : localhost 127.0.0.1 : allow
40114370SpeterALL : my.machine.example.com 192.0.2.35 : allow
41114370Speter
42114370Speter# To use IPv6 addresses you must enclose them in []'s
43218822SdimALL : [fe80::%fxp0]/10 : allow
44218822SdimALL : [fe80::]/10 : deny
45218822SdimALL : [3ffe:fffe:2:1:2:3:4:3fe1] : deny
46218822SdimALL : [3ffe:fffe:2:1::]/64 : allow
47218822Sdim
48218822Sdim# Sendmail can help protect you against spammers and relay-rapers
49114370Spetersendmail : localhost : allow
50114370Spetersendmail : .nice.guy.example.com : allow
51114370Spetersendmail : .evil.cracker.example.com : deny
5239818Spetersendmail : ALL : allow
53114370Speter
54114370Speter# Exim is an alternative to sendmail, available in the ports tree
55114370Speterexim : localhost : allow
56114370Speterexim : .nice.guy.example.com : allow
57114370Speterexim : .evil.cracker.example.com : deny
58114370Speterexim : ALL : allow
59218822Sdim
6039818Speter# Rpcbind is used for all RPC services; protect your NFS!
6139818Speter# (IP addresses rather than hostnames *MUST* be used here)
62114370Speterrpcbind : 192.0.2.32/255.255.255.224 : allow
63114370Speterrpcbind : 192.0.2.96/255.255.255.224 : allow
64114370Speterrpcbind : ALL : deny
65114370Speter
66114370Speter# Provide a small amount of protection for ftpd
67114370Speterftpd : localhost : allow
68114370Speterftpd : .nice.guy.example.com : allow
6939818Speterftpd : .evil.cracker.example.com : deny
70114370Speterftpd : ALL : allow
71114370Speter
72114370Speter# You need to be clever with finger; do _not_ backfinger!! You can easily
73218822Sdim# start a "finger war".
74218822Sdimfingerd : ALL \
7539818Speter	: spawn (echo Finger. | \
7639818Speter	 /usr/bin/mail -s "tcpd\: %u@%h[%a] fingered me!" root) & \
77218822Sdim	: deny
78218822Sdim
79218822Sdim# The rest of the daemons are protected.
80218822SdimALL : ALL \
81218822Sdim	: severity auth.info \
82218822Sdim	: twist /bin/echo "You are not welcome to use %d from %h."
83218822Sdim