hosts.allow revision 50472
1178476Sjb#
2178476Sjb# hosts.allow access control file for "tcp wrapped" apps.
3178476Sjb# $FreeBSD: head/etc/hosts.allow 50472 1999-08-27 23:37:10Z peter $
4178476Sjb#
5178476Sjb# NOTE: The hosts.deny file is not longer used.  Instead, put both 'allow'
6178476Sjb#       and 'deny' rules in the hosts.allow file.
7178476Sjb# see hosts_options(5) for the format of this file.
8178476Sjb# hosts_access(5) no longer fully applies.
9178476Sjb
10178476Sjb# This is an example! You will need to modify it for your specific
11178476Sjb# requirements!
12178476Sjb
13178476Sjb# Start by allowing everything (this prevents the rest of the file
14178476Sjb# from working, so remove it when you need protection).
15178476Sjb# The rules here work on a "First match wins" basis.
16178476SjbALL : ALL : allow
17178476Sjb
18178476Sjb# Wrapping sshd(8) is not normally a good idea, but if you
19178476Sjb# need to do it, here's how
20178476Sjb#sshd : .evil.cracker.example.com : deny 
21178476Sjb
22178476Sjb# Prevent those with no reverse DNS from connecting.
23178476SjbALL : PARANOID : RFC931 20 : deny
24178476Sjb
25178476Sjb# Allow anything from localhost
26178476SjbALL : localhost : allow
27178476SjbALL : my.machine.example.com : allow
28178476Sjb
29178476Sjb# Sendmail can help protect you against spammers and relay-rapers
30178476Sjbsendmail : localhost : allow
31178476Sjbsendmail : .nice.guy.example.com : allow
32178476Sjbsendmail : .evil.cracker.example.com : deny
33178476Sjbsendmail : ALL : allow
34178476Sjb
35178476Sjb# Exim is an alternative to sendmail, available in the ports tree
36178476Sjbexim : localhost : allow
37178476Sjbexim : .nice.guy.example.com : allow
38178476Sjbexim : .evil.cracker.example.com : deny
39178476Sjbexim : ALL : allow
40178476Sjb
41178476Sjb# Portmapper is used for all RPC services; protect your NFS!
42178476Sjbportmap : localhost : allow
43178476Sjbportmap : .nice.guy.example.com : allow
44178476Sjbportmap : .evil.cracker.example.com : deny
45178476Sjbportmap : ALL : allow
46178476Sjb
47178476Sjb# Provide a small amount of protection for ftpd
48178476Sjbftpd : localhost : allow
49178476Sjbftpd : .nice.guy.example.com : allow
50178476Sjbftpd : .evil.cracker.example.com : deny
51178476Sjbftpd : ALL : allow
52178476Sjb
53178476Sjb# You need to be clever with finger; do _not_ backfinger!! You can easily
54178476Sjb# start a "finger war".
55178476Sjbfingerd : ALL \
56178476Sjb	: spawn (echo Finger. | \
57178476Sjb	 /usr/bin/mail -s "tcpd\: %u@%h[%a] fingered me!" root) & \
58178476Sjb	: deny
59178476Sjb
60178476Sjb# The rest of the daemons are protected. Backfinger and log by email.
61178476SjbALL : ALL \
62178476Sjb	: severity auth.info : spawn (/usr/bin/finger -l @%h | \
63178476Sjb	 /usr/bin/mail -s "tcpd\: %u@%h[%a] tried to use %d  (denied)" root) & \
64178476Sjb	: twist /bin/echo "You are not welcome to use %d from %h."
65178476Sjb