xref: /freebsd/share/man/man7/security.7 (revision 47afd1f81ed9a363d194d022037a3993528e0c3e)
13128fa34SMatthew Dillon.\" Copyright (c) 1998, Matthew Dillon.  Terms and conditions are those of
23128fa34SMatthew Dillon.\" the BSD Copyright as specified in the file "/usr/src/COPYRIGHT" in
33128fa34SMatthew Dillon.\" the source tree.
4f063d76aSMatthew Dillon.\"
57f3dea24SPeter Wemm.\" $FreeBSD$
6f063d76aSMatthew Dillon.\"
7d93b26d6SMatthew Dillon.Dd September 18, 1999
8f063d76aSMatthew Dillon.Dt SECURITY 7
93d45e180SRuslan Ermilov.Os
10f063d76aSMatthew Dillon.Sh NAME
11f063d76aSMatthew Dillon.Nm security
12f063d76aSMatthew Dillon.Nd introduction to security under FreeBSD
13f063d76aSMatthew Dillon.Sh DESCRIPTION
14f063d76aSMatthew DillonSecurity is a function that begins and ends with the system administrator.
15f063d76aSMatthew DillonWhile all
16f063d76aSMatthew Dillon.Bx
17d93b26d6SMatthew Dillonmulti-user systems have some inherent security, the job of building and
18992e4638SRobert Watsonmaintaining additional security mechanisms to keep users
19568e4cbbSGuy Helmer.Sq honest
20568e4cbbSGuy Helmeris probably
216ac7e896SDavid E. O'Brienone of the single largest undertakings of the sysadmin.  Machines are
22f063d76aSMatthew Dillononly as secure as you make them, and security concerns are ever competing
23568e4cbbSGuy Helmerwith the human necessity for convenience.
24568e4cbbSGuy Helmer.Ux
25568e4cbbSGuy Helmersystems,
266ac7e896SDavid E. O'Brienin general, are capable of running a huge number of simultaneous processes
2747afd1f8SDaniel Harrisand many of these processes operate as servers \(em meaning that external entities
28f063d76aSMatthew Dilloncan connect and talk to them.  As yesterday's mini-computers and mainframes
29f063d76aSMatthew Dillonbecome today's desktops, and as computers become networked and internetworked,
30f063d76aSMatthew Dillonsecurity becomes an ever bigger issue.
31f063d76aSMatthew Dillon.Pp
32d93b26d6SMatthew DillonSecurity is best implemented through a layered onion approach.  In a nutshell,
33d93b26d6SMatthew Dillonwhat you want to do is to create as many layers of security as are convenient
34d93b26d6SMatthew Dillonand then carefully monitor the system for intrusions.  You do not want to
357c86a74bSMike Pritchardoverbuild your security or you will interfere with the detection side, and
36d93b26d6SMatthew Dillondetection is one of the single most important aspects of any security
37d93b26d6SMatthew Dillonmechanism.  For example, it makes little sense to set the
38d93b26d6SMatthew Dillon.Pa schg
39d93b26d6SMatthew Dillonflags
40c4d9468eSRuslan Ermilov(see
41c4d9468eSRuslan Ermilov.Xr chflags 1 )
42d93b26d6SMatthew Dillonon every system binary because while this may temporarily protect the
4347afd1f8SDaniel Harrisbinaries, it prevents an attacker who has broken in from making an
44d93b26d6SMatthew Dilloneasily detectable change that may result in your security mechanisms not
4547afd1f8SDaniel Harrisdetecting the attacker at all.
46d93b26d6SMatthew Dillon.Pp
47d93b26d6SMatthew DillonSystem security also pertains to dealing with various forms of attack,
48d93b26d6SMatthew Dillonincluding attacks that attempt to crash or otherwise make a system unusable
49d93b26d6SMatthew Dillonbut do not attempt to break root.  Security concerns can be split up into
50d93b26d6SMatthew Dillonseveral categories:
51f063d76aSMatthew Dillon.Bl -enum -offset indent
52f063d76aSMatthew Dillon.It
53f063d76aSMatthew DillonDenial of service attacks
54f063d76aSMatthew Dillon.It
55f063d76aSMatthew DillonUser account compromises
56f063d76aSMatthew Dillon.It
576ac7e896SDavid E. O'BrienRoot compromise through accessible servers
58f063d76aSMatthew Dillon.It
596ac7e896SDavid E. O'BrienRoot compromise via user accounts
60d93b26d6SMatthew Dillon.It
61d93b26d6SMatthew DillonBackdoor creation
62f063d76aSMatthew Dillon.El
63f063d76aSMatthew Dillon.Pp
64f063d76aSMatthew DillonA denial of service attack is an action that deprives the machine of needed
65f063d76aSMatthew Dillonresources.  Typically, D.O.S. attacks are brute-force mechanisms that attempt
66f063d76aSMatthew Dillonto crash or otherwise make a machine unusable by overwhelming its servers or
67f063d76aSMatthew Dillonnetwork stack.  Some D.O.S. attacks try to take advantages of bugs in the
68f063d76aSMatthew Dillonnetworking stack to crash a machine with a single packet.  The latter can
69f063d76aSMatthew Dillononly be fixed by applying a bug fix to the kernel.  Attacks on servers can
70d93b26d6SMatthew Dillonoften be fixed by properly specifying options to limit the load the servers
71d93b26d6SMatthew Dillonincur on the system under adverse conditions.  Brute-force network
72f063d76aSMatthew Dillonattacks are harder to deal with.  A spoofed-packet attack, for example, is
737c86a74bSMike Pritchardnearly impossible to stop short of cutting your system off from the Internet.
747c86a74bSMike PritchardIt may not be able to take your machine down, but it can fill up Internet
75d93b26d6SMatthew Dillonpipe.
76f063d76aSMatthew Dillon.Pp
77074ad115SRuslan ErmilovA user account compromise is even more common than a D.O.S. attack.  Many
786ac7e896SDavid E. O'Briensysadmins still run standard telnetd, rlogind, rshd, and ftpd servers on their
79f063d76aSMatthew Dillonmachines.  These servers, by default, do not operate over encrypted
80f063d76aSMatthew Dillonconnections.  The result is that if you have any moderate-sized user base,
81f063d76aSMatthew Dillonone or more of your users logging into your system from a remote location
82c4d9468eSRuslan Ermilov(which is the most common and convenient way to login to a system)
83568e4cbbSGuy Helmerwill
84f063d76aSMatthew Dillonhave his or her password sniffed.  The attentive system admin will analyze
85d93b26d6SMatthew Dillonhis remote access logs looking for suspicious source addresses
86f063d76aSMatthew Dilloneven for successful logins.
87f063d76aSMatthew Dillon.Pp
88f063d76aSMatthew DillonOne must always assume that once an attacker has access to a user account,
89f063d76aSMatthew Dillonthe attacker can break root.  However, the reality is that in a well secured
90f063d76aSMatthew Dillonand maintained system, access to a user account does not necessarily give the
91f063d76aSMatthew Dillonattacker access to root.  The distinction is important because without access
92f063d76aSMatthew Dillonto root the attacker cannot generally hide his tracks and may, at best, be
93b94231daSDima Dorfmanable to do nothing more than mess with the user's files or crash the machine.
94d93b26d6SMatthew DillonUser account compromises are very common because users tend not to take the
957c86a74bSMike Pritchardprecautions that sysadmins take.
96f063d76aSMatthew Dillon.Pp
97d93b26d6SMatthew DillonSystem administrators must keep in mind that there are potentially many ways
98d93b26d6SMatthew Dillonto break root on a machine.  The attacker may know the root password,
99d93b26d6SMatthew Dillonthe attacker
100f063d76aSMatthew Dillonmay find a bug in a root-run server and be able to break root over a network
101f063d76aSMatthew Dillonconnection to that server, or the attacker may know of a bug in an suid-root
102f063d76aSMatthew Dillonprogram that allows the attacker to break root once he has broken into a
103d93b26d6SMatthew Dillonuser's account.  If an attacker has found a way to break root on a machine,
104f167d7fbSSheldon Hearnthe attacker may not have a need to install a backdoor.
105d93b26d6SMatthew DillonMany of the root holes found and closed to date involve a considerable amount
10647afd1f8SDaniel Harrisof work by the attacker to cleanup after himself, so most attackers do install
10747afd1f8SDaniel Harrisbackdoors.  This gives you a convenient way to detect the attacker.  Making
10847afd1f8SDaniel Harrisit impossible for an attacker to install a backdoor may actually be detrimental
10947afd1f8SDaniel Harristo your security because it will not close off the hole the attacker found to
110a910f192SDima Dorfmanbreak in the first place.
111f063d76aSMatthew Dillon.Pp
112d93b26d6SMatthew DillonSecurity remedies should always be implemented with a multi-layered
113568e4cbbSGuy Helmer.Sq onion peel
114f063d76aSMatthew Dillonapproach and can be categorized as follows:
115f063d76aSMatthew Dillon.Bl -enum -offset indent
116f063d76aSMatthew Dillon.It
117f063d76aSMatthew DillonSecuring root and staff accounts
118f063d76aSMatthew Dillon.It
11947afd1f8SDaniel HarrisSecuring root \(em root-run servers and suid/sgid binaries
120f063d76aSMatthew Dillon.It
121f063d76aSMatthew DillonSecuring user accounts
122f063d76aSMatthew Dillon.It
123f063d76aSMatthew DillonSecuring the password file
124f063d76aSMatthew Dillon.It
125f063d76aSMatthew DillonSecuring the kernel core, raw devices, and file systems
126f063d76aSMatthew Dillon.It
127d93b26d6SMatthew DillonQuick detection of inappropriate changes made to the system
128f063d76aSMatthew Dillon.It
129f063d76aSMatthew DillonParanoia
130f063d76aSMatthew Dillon.El
131f063d76aSMatthew Dillon.Sh SECURING THE ROOT ACCOUNT AND SECURING STAFF ACCOUNTS
132f063d76aSMatthew DillonDon't bother securing staff accounts if you haven't secured the root
133f063d76aSMatthew Dillonaccount.  Most systems have a password assigned to the root account.  The
134568e4cbbSGuy Helmerfirst thing you do is assume that the password is
135568e4cbbSGuy Helmer.Sq always
136d93b26d6SMatthew Dilloncompromised.  This does not mean that you should remove the password.  The
137d93b26d6SMatthew Dillonpassword is almost always necessary for console access to the machine.
138d93b26d6SMatthew DillonWhat it does mean is that you should not make it possible to use the password
139d93b26d6SMatthew Dillonoutside of the console or possibly even with a
140d93b26d6SMatthew Dillon.Xr su 1
141d93b26d6SMatthew Dilloncommand.
142d93b26d6SMatthew DillonFor example, make sure that your pty's are specified as being unsecure
143d93b26d6SMatthew Dillonin the
144568e4cbbSGuy Helmer.Sq Pa /etc/ttys
145d93b26d6SMatthew Dillonfile
146d93b26d6SMatthew Dillonso that direct root logins via telnet or rlogin are disallowed.  If using
147d93b26d6SMatthew Dillonother login services such as sshd, make sure that direct root logins are
14847afd1f8SDaniel Harrisdisabled there as well.  Consider every access method \(em services such as
149d93b26d6SMatthew Dillonftp often fall through the cracks.  Direct root logins should only be allowed
150d93b26d6SMatthew Dillonvia the system console.
151f063d76aSMatthew Dillon.Pp
1527626ae52SMatthew DillonOf course, as a sysadmin you have to be able to get to root, so we open up
153f063d76aSMatthew Dillona few holes.  But we make sure these holes require additional password
154f063d76aSMatthew Dillonverification to operate.  One way to make root accessible is to add appropriate
155568e4cbbSGuy Helmerstaff accounts to the wheel group
156c4d9468eSRuslan Ermilov(in
157c4d9468eSRuslan Ermilov.Pa /etc/group ) .
158568e4cbbSGuy HelmerThe staff members placed
159568e4cbbSGuy Helmerin the wheel group are allowed to
160568e4cbbSGuy Helmer.Sq su
161568e4cbbSGuy Helmerto root.  You should never give staff
162d93b26d6SMatthew Dillonmembers native wheel access by putting them in the wheel group in their
163d93b26d6SMatthew Dillonpassword entry.  Staff accounts should be placed in a
164568e4cbbSGuy Helmer.Sq staff
165d93b26d6SMatthew Dillongroup, and then added to the wheel group via the
166d93b26d6SMatthew Dillon.Sq Pa /etc/group
167d93b26d6SMatthew Dillonfile.  Only those staff members who actually need to have root access
168d93b26d6SMatthew Dillonshould be placed in the wheel group.  It is also possible, when using an
169d93b26d6SMatthew Dillonauthentication method such as kerberos, to use kerberos's
170d93b26d6SMatthew Dillon.Sq Pa .k5login
171d93b26d6SMatthew Dillonfile in the root account to allow a
172d93b26d6SMatthew Dillon.Xr ksu 1
173d93b26d6SMatthew Dillonto root without having to place anyone at all in the wheel group.  This
174d93b26d6SMatthew Dillonmay be the better solution since the wheel mechanism still allows an
175d93b26d6SMatthew Dillonintruder to break root if the intruder has gotten hold of your password
176d93b26d6SMatthew Dillonfile and can break into a staff account.  While having the wheel mechanism
177074ad115SRuslan Ermilovis better than having nothing at all, it isn't necessarily the safest
178d93b26d6SMatthew Dillonoption.
179f063d76aSMatthew Dillon.Pp
180f063d76aSMatthew DillonAn indirect way to secure the root account is to secure your staff accounts
181f063d76aSMatthew Dillonby using an alternative login access method and *'ing out the crypted password
1826ac7e896SDavid E. O'Brienfor the staff accounts.  This way an intruder may be able to steal the password
18347afd1f8SDaniel Harrisfile but will not be able to break into any staff accounts or root, even if
18447afd1f8SDaniel Harrisroot has a crypted password associated with it (assuming, of course, that
18547afd1f8SDaniel Harrisyou've limited root access to the console).  Staff members
186f063d76aSMatthew Dillonget into their staff accounts through a secure login mechanism such as
187568e4cbbSGuy Helmer.Xr kerberos 1
188568e4cbbSGuy Helmeror
189568e4cbbSGuy Helmer.Xr ssh 1
190568e4cbbSGuy Helmerusing a private/public
191f063d76aSMatthew Dillonkey pair.  When you use something like kerberos you generally must secure
192f063d76aSMatthew Dillonthe machines which run the kerberos servers and your desktop workstation.
193f063d76aSMatthew DillonWhen you use a public/private key pair with ssh, you must generally secure
194568e4cbbSGuy Helmerthe machine you are logging in FROM
195c4d9468eSRuslan Ermilov(typically your workstation),
196568e4cbbSGuy Helmerbut you can
197f063d76aSMatthew Dillonalso add an additional layer of protection to the key pair by password
198568e4cbbSGuy Helmerprotecting the keypair when you create it with
199568e4cbbSGuy Helmer.Xr ssh-keygen 1 .
200568e4cbbSGuy HelmerBeing able
2016ac7e896SDavid E. O'Briento *-out the passwords for staff accounts also guarantees that staff members
202f063d76aSMatthew Dilloncan only login through secure access methods that you have setup.  You can
203f063d76aSMatthew Dillonthus force all staff members to use secure, encrypted connections for
2046ac7e896SDavid E. O'Brienall their sessions which closes an important hole used by many intruders:  That
205f063d76aSMatthew Dillonof sniffing the network from an unrelated, less secure machine.
206f063d76aSMatthew Dillon.Pp
207f063d76aSMatthew DillonThe more indirect security mechanisms also assume that you are logging in
208f063d76aSMatthew Dillonfrom a more restrictive server to a less restrictive server.  For example,
209f063d76aSMatthew Dillonif your main box is running all sorts of servers, your workstation shouldn't
210f063d76aSMatthew Dillonbe running any.  In order for your workstation to be reasonably secure
211f063d76aSMatthew Dillonyou should run as few servers as possible, up to and including no servers
212f063d76aSMatthew Dillonat all, and you should run a password-protected screen blanker.
213f063d76aSMatthew DillonOf course, given physical access to
214f063d76aSMatthew Dillona workstation an attacker can break any sort of security you put on it.
215f063d76aSMatthew DillonThis is definitely a problem that you should consider but you should also
2166ac7e896SDavid E. O'Brienconsider the fact that the vast majority of break-ins occur remotely, over
2177626ae52SMatthew Dillona network, from people who do not have physical access to your workstation or
218f063d76aSMatthew Dillonservers.
219f063d76aSMatthew Dillon.Pp
220f063d76aSMatthew DillonUsing something like kerberos also gives you the ability to disable or
221f063d76aSMatthew Dillonchange the password for a staff account in one place and have it immediately
22247afd1f8SDaniel Harrisaffect all the machines the staff member may have an account on.  If a staff
223f063d76aSMatthew Dillonmember's account gets compromised, the ability to instantly change his
224f063d76aSMatthew Dillonpassword on all machines should not be underrated.  With discrete passwords,
225f063d76aSMatthew Dillonchanging a password on N machines can be a mess.  You can also impose
226f063d76aSMatthew Dillonre-passwording restrictions with kerberos:  not only can a kerberos ticket
227f063d76aSMatthew Dillonbe made to timeout after a while, but the kerberos system can require that
228568e4cbbSGuy Helmerthe user choose a new password after a certain period of time
229c4d9468eSRuslan Ermilov(say, once a month).
23047afd1f8SDaniel Harris.Sh SECURING ROOT \(em  ROOT-RUN SERVERS AND SUID/SGID BINARIES
2317626ae52SMatthew DillonThe prudent sysadmin only runs the servers he needs to, no more, no less.  Be
232f063d76aSMatthew Dillonaware that third party servers are often the most bug-prone.  For example,
233f063d76aSMatthew Dillonrunning an old version of imapd or popper is like giving a universal root
234f063d76aSMatthew Dillonticket out to the entire world.  Never run a server that you have not checked
235f063d76aSMatthew Dillonout carefully.  Many servers do not need to be run as root.  For example,
236568e4cbbSGuy Helmerthe ntalk, comsat, and finger daemons can be run in special user
237568e4cbbSGuy Helmer.Sq sandboxes .
2386ac7e896SDavid E. O'BrienA sandbox isn't perfect unless you go to a large amount of trouble, but the
239f063d76aSMatthew Dillononion approach to security still stands:  If someone is able to break in
240f063d76aSMatthew Dillonthrough a server running in a sandbox, they still have to break out of the
241f063d76aSMatthew Dillonsandbox.  The more layers the attacker must break through, the lower the
242f063d76aSMatthew Dillonlikelihood of his success.  Root holes have historically been found in
243f063d76aSMatthew Dillonvirtually every server ever run as root, including basic system servers.
244f063d76aSMatthew DillonIf you are running a machine through which people only login via sshd and
245f063d76aSMatthew Dillonnever login via telnetd or rshd or rlogind, then turn off those services!
246f063d76aSMatthew Dillon.Pp
247f6f8f44dSAlexey Zelkin.Fx
248568e4cbbSGuy Helmernow defaults to running ntalkd, comsat, and finger in a sandbox.
249f063d76aSMatthew DillonAnother program which may be a candidate for running in a sandbox is
250568e4cbbSGuy Helmer.Xr named 8 .
251568e4cbbSGuy HelmerThe default rc.conf includes the arguments necessary to run
252f063d76aSMatthew Dillonnamed in a sandbox in a commented-out form.  Depending on whether you
253f063d76aSMatthew Dillonare installing a new system or upgrading an existing system, the special
254f063d76aSMatthew Dillonuser accounts used by these sandboxes may not be installed.  The prudent
2557626ae52SMatthew Dillonsysadmin would research and implement sandboxes for servers whenever possible.
256f063d76aSMatthew Dillon.Pp
257f063d76aSMatthew DillonThere are a number of other servers that typically do not run in sandboxes:
258f063d76aSMatthew Dillonsendmail, popper, imapd, ftpd, and others.  There are alternatives to
259f063d76aSMatthew Dillonsome of these, but installing them may require more work then you are willing
260568e4cbbSGuy Helmerto put
261c4d9468eSRuslan Ermilov(the convenience factor strikes again).
262568e4cbbSGuy HelmerYou may have to run these
2636ac7e896SDavid E. O'Brienservers as root and rely on other mechanisms to detect break-ins that might
264f063d76aSMatthew Dillonoccur through them.
265f063d76aSMatthew Dillon.Pp
266f063d76aSMatthew DillonThe other big potential root hole in a system are the suid-root and sgid
267f063d76aSMatthew Dillonbinaries installed on the system.  Most of these binaries, such as rlogin,
268568e4cbbSGuy Helmerreside in
269568e4cbbSGuy Helmer.Pa /bin ,
270568e4cbbSGuy Helmer.Pa /sbin ,
271568e4cbbSGuy Helmer.Pa /usr/bin ,
272568e4cbbSGuy Helmeror
273568e4cbbSGuy Helmer.Pa /usr/sbin .
274568e4cbbSGuy HelmerWhile nothing is 100% safe,
275f063d76aSMatthew Dillonthe system-default suid and sgid binaries can be considered reasonably safe.
2766ac7e896SDavid E. O'BrienStill, root holes are occasionally found in these binaries.  A root hole
277568e4cbbSGuy Helmerwas found in Xlib in 1998 that made xterm
278c4d9468eSRuslan Ermilov(which is typically suid)
279568e4cbbSGuy Helmervulnerable.
280074ad115SRuslan ErmilovIt is better to be safe than sorry and the prudent sysadmin will restrict suid
281f063d76aSMatthew Dillonbinaries that only staff should run to a special group that only staff can
282568e4cbbSGuy Helmeraccess, and get rid of
283c4d9468eSRuslan Ermilov.Pq Li "chmod 000"
284568e4cbbSGuy Helmerany suid binaries that nobody uses.  A
285f063d76aSMatthew Dillonserver with no display generally does not need an xterm binary.  Sgid binaries
2866ac7e896SDavid E. O'Briencan be almost as dangerous.  If an intruder can break an sgid-kmem binary the
287568e4cbbSGuy Helmerintruder might be able to read
288568e4cbbSGuy Helmer.Pa /dev/kmem
289568e4cbbSGuy Helmerand thus read the crypted password
290d93b26d6SMatthew Dillonfile, potentially compromising any passworded account.  Alternatively an
291d93b26d6SMatthew Dillonintruder who breaks group kmem can monitor keystrokes sent through pty's,
292d93b26d6SMatthew Dillonincluding pty's used by users who login through secure methods.  An intruder
293d93b26d6SMatthew Dillonthat breaks the tty group can write to almost any user's tty.  If a user
294d93b26d6SMatthew Dillonis running a terminal
295d93b26d6SMatthew Dillonprogram or emulator with a keyboard-simulation feature, the intruder can
296d93b26d6SMatthew Dillonpotentially
297f063d76aSMatthew Dillongenerate a data stream that causes the user's terminal to echo a command, which
298f063d76aSMatthew Dillonis then run as that user.
299f063d76aSMatthew Dillon.Sh SECURING USER ACCOUNTS
300f063d76aSMatthew DillonUser accounts are usually the most difficult to secure.  While you can impose
3016ac7e896SDavid E. O'BrienDraconian access restrictions on your staff and *-out their passwords, you
302f063d76aSMatthew Dillonmay not be able to do so with any general user accounts you might have.  If
303f063d76aSMatthew Dillonyou do have sufficient control then you may win out and be able to secure the
304f063d76aSMatthew Dillonuser accounts properly.  If not, you simply have to be more vigilant in your
305f063d76aSMatthew Dillonmonitoring of those accounts.  Use of ssh and kerberos for user accounts is
306d93b26d6SMatthew Dillonmore problematic due to the extra administration and technical support
307d93b26d6SMatthew Dillonrequired, but still a very good solution compared to a crypted password
308d93b26d6SMatthew Dillonfile.
309f063d76aSMatthew Dillon.Sh SECURING THE PASSWORD FILE
310f063d76aSMatthew DillonThe only sure fire way is to *-out as many passwords as you can and
311f063d76aSMatthew Dillonuse ssh or kerberos for access to those accounts.  Even though the
312568e4cbbSGuy Helmercrypted password file
313568e4cbbSGuy Helmer.Pq Pa /etc/spwd.db
314568e4cbbSGuy Helmercan only be read by root, it may
315568e4cbbSGuy Helmerbe possible for an intruder to obtain read access to that file even if the
316f063d76aSMatthew Dillonattacker cannot obtain root-write access.
317f063d76aSMatthew Dillon.Pp
318f063d76aSMatthew DillonYour security scripts should always check for and report changes to
319568e4cbbSGuy Helmerthe password file
320c4d9468eSRuslan Ermilov(see
321568e4cbbSGuy Helmer.Sq Checking file integrity
322c4d9468eSRuslan Ermilovbelow).
323f063d76aSMatthew Dillon.Sh SECURING THE KERNEL CORE, RAW DEVICES, AND FILE SYSTEMS
324f063d76aSMatthew DillonIf an attacker breaks root he can do just about anything, but there
325f063d76aSMatthew Dillonare certain conveniences.  For example, most modern kernels have a
326568e4cbbSGuy Helmerpacket sniffing device driver built in.  Under
327f6f8f44dSAlexey Zelkin.Fx
328568e4cbbSGuy Helmerit is called
329568e4cbbSGuy Helmerthe
330568e4cbbSGuy Helmer.Sq bpf
331568e4cbbSGuy Helmerdevice.  An intruder will commonly attempt to run a packet sniffer
3326ac7e896SDavid E. O'Brienon a compromised machine.  You do not need to give the intruder the
333f063d76aSMatthew Dilloncapability and most systems should not have the bpf device compiled in.
334f063d76aSMatthew Dillon.Pp
335568e4cbbSGuy HelmerBut even if you turn off the bpf device,
336568e4cbbSGuy Helmeryou still have
337568e4cbbSGuy Helmer.Pa /dev/mem
338568e4cbbSGuy Helmerand
339568e4cbbSGuy Helmer.Pa /dev/kmem
340568e4cbbSGuy Helmerto worry about.  For that matter,
341d93b26d6SMatthew Dillonthe intruder can still write to raw disk devices.
342d93b26d6SMatthew DillonAlso, there is another kernel feature called the module loader,
343568e4cbbSGuy Helmer.Xr kldload 8 .
344568e4cbbSGuy HelmerAn enterprising intruder can use a KLD module to install
345568e4cbbSGuy Helmerhis own bpf device or other sniffing device on a running kernel.
346568e4cbbSGuy HelmerTo avoid these problems you have to run
347568e4cbbSGuy Helmerthe kernel at a higher secure level, at least securelevel 1.  The securelevel
348f063d76aSMatthew Dilloncan be set with a sysctl on the kern.securelevel variable.  Once you have
349f063d76aSMatthew Dillonset the securelevel to 1, write access to raw devices will be denied and
350568e4cbbSGuy Helmerspecial chflags flags, such as
351568e4cbbSGuy Helmer.Sq schg ,
352568e4cbbSGuy Helmerwill be enforced.  You must also ensure
353568e4cbbSGuy Helmerthat the
354568e4cbbSGuy Helmer.Sq schg
355568e4cbbSGuy Helmerflag is set on critical startup binaries, directories, and
35647afd1f8SDaniel Harrisscript files \(em everything that gets run up to the point where the securelevel
357f063d76aSMatthew Dillonis set.  This might be overdoing it, and upgrading the system is much more
358f063d76aSMatthew Dillondifficult when you operate at a higher secure level.  You may compromise and
359f063d76aSMatthew Dillonrun the system at a higher secure level but not set the schg flag for every
360d93b26d6SMatthew Dillonsystem file and directory under the sun.  Another possibility is to simply
361d93b26d6SMatthew Dillonmount / and /usr read-only.  It should be noted that being too draconian in
362d93b26d6SMatthew Dillonwhat you attempt to protect may prevent the all-important detection of an
363d93b26d6SMatthew Dillonintrusion.
364f063d76aSMatthew Dillon.Sh CHECKING FILE INTEGRITY: BINARIES, CONFIG FILES, ETC
365f063d76aSMatthew DillonWhen it comes right down to it, you can only protect your core system
366f063d76aSMatthew Dillonconfiguration and control files so much before the convenience factor
367d93b26d6SMatthew Dillonrears its ugly head.  For example, using chflags to set the schg bit
368d93b26d6SMatthew Dillonon most of the files in / and /usr is probably counterproductive because
369d93b26d6SMatthew Dillonwhile it may protect the files, it also closes a detection window.  The
37047afd1f8SDaniel Harrislast layer of your security onion is perhaps the most important \(em detection.
371d93b26d6SMatthew DillonThe rest of your security is pretty much useless (or, worse, presents you with
372d93b26d6SMatthew Dillona false sense of safety) if you cannot detect potential incursions.  Half
373074ad115SRuslan Ermilovthe job of the onion is to slow down the attacker rather than stop him
374d93b26d6SMatthew Dillonin order to give the detection side of the equation a chance to catch him in
375d93b26d6SMatthew Dillonthe act.
376f063d76aSMatthew Dillon.Pp
377d93b26d6SMatthew DillonThe best way to detect an incursion is to look for modified, missing, or
378d93b26d6SMatthew Dillonunexpected files.  The best
379d93b26d6SMatthew Dillonway to look for modified files is from another (often centralized)
380d93b26d6SMatthew Dillonlimited-access system.
381d93b26d6SMatthew DillonWriting your security scripts on the extra-secure limited-access system
38247afd1f8SDaniel Harrismakes them mostly invisible to potential attackers, and this is important.
383d93b26d6SMatthew DillonIn order to take maximum advantage you generally have to give the
384d93b26d6SMatthew Dillonlimited-access box significant access to the other machines in the business,
385d93b26d6SMatthew Dillonusually either by doing a read-only NFS export of the other machines to the
386d93b26d6SMatthew Dillonlimited-access box, or by setting up ssh keypairs to allow the limit-access
387d93b26d6SMatthew Dillonbox to ssh to the other machines.  Except for its network traffic, NFS is
38847afd1f8SDaniel Harristhe least visible method \(em allowing you to monitor the file systems on each
389d93b26d6SMatthew Dillonclient box virtually undetected.  If your
390d93b26d6SMatthew Dillonlimited-access server is connected to the client boxes through a switch,
391d93b26d6SMatthew Dillonthe NFS method is often the better choice.  If your limited-access server
392d93b26d6SMatthew Dillonis connected to the client boxes through a hub or through several layers
393d93b26d6SMatthew Dillonof routing, the NFS method may be too insecure (network-wise) and using ssh
394d93b26d6SMatthew Dillonmay be the better choice even with the audit-trail tracks that ssh lays.
395d93b26d6SMatthew Dillon.Pp
396d93b26d6SMatthew DillonOnce you give a limit-access box at least read access to the client systems
397d93b26d6SMatthew Dillonit is supposed to monitor, you must write scripts to do the actual
398d93b26d6SMatthew Dillonmonitoring.  Given an NFS mount, you can write scripts out of simple system
399d93b26d6SMatthew Dillonutilities such as
400d93b26d6SMatthew Dillon.Xr find 1
401d93b26d6SMatthew Dillonand
402d93b26d6SMatthew Dillon.Xr md5 1
403d93b26d6SMatthew DillonIt is best to physically md5 the client-box files boxes at least once a
404ad27d066SMatthew Dillonday, and to test control files such as those found in
405ad27d066SMatthew Dillon.Pa /etc
406ad27d066SMatthew Dillonand
407ad27d066SMatthew Dillon.Pa /usr/local/etc
408d93b26d6SMatthew Dilloneven more often.  When mismatches are found relative to the base md5
409d93b26d6SMatthew Dilloninformation the limited-access machine knows is valid, it should scream at
410d93b26d6SMatthew Dillona sysadmin to go check it out.  A good security script will also check for
411d93b26d6SMatthew Dilloninappropriate suid binaries and for new or deleted files on system partitions
412d93b26d6SMatthew Dillonsuch as
413d93b26d6SMatthew Dillon.Pa /
414568e4cbbSGuy Helmerand
415568e4cbbSGuy Helmer.Pa /usr
416f063d76aSMatthew Dillon.Pp
417074ad115SRuslan ErmilovWhen using ssh rather than NFS, writing the security script is much more
418d93b26d6SMatthew Dillondifficult.   You essentially have to
419d93b26d6SMatthew Dillon.Pa scp
420d93b26d6SMatthew Dillonthe scripts to the client box in order to run them, making them visible, and
421d93b26d6SMatthew Dillonfor safety you also need to scp the binaries (such as find) that those scripts
422d93b26d6SMatthew Dillonuse.  The ssh daemon on the client box may already be compromised.  All in all,
423d93b26d6SMatthew Dillonusing ssh may be necessary when running over unsecure links, but it's also a
424d93b26d6SMatthew Dillonlot harder to deal with.
425f063d76aSMatthew Dillon.Pp
426f063d76aSMatthew DillonA good security script will also check for changes to user and staff members
427ad27d066SMatthew Dillonaccess configuration files:
428ad27d066SMatthew Dillon.Pa .rhosts ,
429ad27d066SMatthew Dillon.Pa .shosts ,
430ad27d066SMatthew Dillon.Pa .ssh/authorized_keys
431ad27d066SMatthew Dillonand so forth... files that might fall outside the purview of the MD5 check.
432f063d76aSMatthew Dillon.Pp
433d93b26d6SMatthew DillonIf you have a huge amount of user disk space it may take too long to run
434d93b26d6SMatthew Dillonthrough every file on those partitions.  In this case, setting mount
435d93b26d6SMatthew Dillonflags to disallow suid binaries and devices on those partitions is a good
436d93b26d6SMatthew Dillonidea.  The
437568e4cbbSGuy Helmer.Sq nodev
438d93b26d6SMatthew Dillonand
439d93b26d6SMatthew Dillon.Sq nosuid
440d93b26d6SMatthew Dillonoptions
441c4d9468eSRuslan Ermilov(see
442c4d9468eSRuslan Ermilov.Xr mount 8 )
443d93b26d6SMatthew Dillonare what you want to look into.  I would scan them anyway at least once a
444d93b26d6SMatthew Dillonweek, since the object of this layer is to detect a break-in whether or
445a30de06bSCeri Daviesnot the break-in is effective.
446f063d76aSMatthew Dillon.Pp
447568e4cbbSGuy HelmerProcess accounting
448c4d9468eSRuslan Ermilov(see
449c4d9468eSRuslan Ermilov.Xr accton 8 )
450568e4cbbSGuy Helmeris a relatively low-overhead feature of
4516ac7e896SDavid E. O'Brienthe operating system which I recommend using as a post-break-in evaluation
4526ac7e896SDavid E. O'Brienmechanism.  It is especially useful in tracking down how an intruder has
453d93b26d6SMatthew Dillonactually broken into a system, assuming the file is still intact after
4546ac7e896SDavid E. O'Brienthe break-in occurs.
455f063d76aSMatthew Dillon.Pp
456f063d76aSMatthew DillonFinally, security scripts should process the log files and the logs themselves
45747afd1f8SDaniel Harrisshould be generated in as secure a manner as possible \(em remote syslog can be
4586ac7e896SDavid E. O'Brienvery useful.  An intruder tries to cover his tracks, and log files are critical
459d93b26d6SMatthew Dillonto the sysadmin trying to track down the time and method of the initial
460d93b26d6SMatthew Dillonbreak-in.  One way to keep a permanent record of the log files is to run
461d93b26d6SMatthew Dillonthe system console to a serial port and collect the information on a
462d93b26d6SMatthew Dilloncontinuing basis through a secure machine monitoring the consoles.
463f063d76aSMatthew Dillon.Sh PARANOIA
4647626ae52SMatthew DillonA little paranoia never hurts.  As a rule, a sysadmin can add any number
46547afd1f8SDaniel Harrisof security features as long as they do not affect convenience, and
46647afd1f8SDaniel Harriscan add security features that do affect convenience with some added
467d93b26d6SMatthew Dillonthought.  Even more importantly, a security administrator should mix it up
46847afd1f8SDaniel Harrisa bit \(em if you use recommendations such as those given by this manual
469d93b26d6SMatthew Dillonpage verbatim, you give away your methodologies to the prospective
47047afd1f8SDaniel Harrisattacker who also has access to this manual page.
471f063d76aSMatthew Dillon.Sh SPECIAL SECTION ON D.O.S. ATTACKS
4726ac7e896SDavid E. O'BrienThis section covers Denial of Service attacks.  A DOS attack is typically
473f063d76aSMatthew Dillona packet attack.  While there isn't much you can do about modern spoofed
474f063d76aSMatthew Dillonpacket attacks that saturate your network, you can generally limit the damage
475f063d76aSMatthew Dillonby ensuring that the attacks cannot take down your servers.
476f063d76aSMatthew Dillon.Bl -enum -offset indent
477f063d76aSMatthew Dillon.It
478f063d76aSMatthew DillonLimiting server forks
479f063d76aSMatthew Dillon.It
480f063d76aSMatthew DillonLimiting springboard attacks (ICMP response attacks, ping broadcast, etc...)
481f063d76aSMatthew Dillon.It
482f063d76aSMatthew DillonKernel Route Cache
483f063d76aSMatthew Dillon.El
484f063d76aSMatthew Dillon.Pp
485f063d76aSMatthew DillonA common DOS attack is against a forking server that attempts to cause the
4866ac7e896SDavid E. O'Brienserver to eat processes, file descriptors, and memory until the machine
487568e4cbbSGuy Helmerdies.  Inetd
488c4d9468eSRuslan Ermilov(see
489c4d9468eSRuslan Ermilov.Xr inetd 8 )
490568e4cbbSGuy Helmerhas several options to limit this sort of attack.
491f063d76aSMatthew DillonIt should be noted that while it is possible to prevent a machine from going
492f063d76aSMatthew Dillondown it is not generally possible to prevent a service from being disrupted
493f063d76aSMatthew Dillonby the attack.  Read the inetd manual page carefully and pay specific attention
494568e4cbbSGuy Helmerto the
495568e4cbbSGuy Helmer.Fl c ,
496568e4cbbSGuy Helmer.Fl C ,
497568e4cbbSGuy Helmerand
498568e4cbbSGuy Helmer.Fl R
499568e4cbbSGuy Helmeroptions.  Note that spoofed-IP attacks will circumvent
500568e4cbbSGuy Helmerthe
501568e4cbbSGuy Helmer.Fl C
502568e4cbbSGuy Helmeroption to inetd, so typically a combination of options must be used.
503f063d76aSMatthew DillonSome standalone servers have self-fork-limitation parameters.
504f063d76aSMatthew Dillon.Pp
505568e4cbbSGuy HelmerSendmail has its
506568e4cbbSGuy Helmer.Fl OMaxDaemonChildren
507568e4cbbSGuy Helmeroption which tends to work much
508f6c24291SGuy Helmerbetter than trying to use sendmail's load limiting options due to the
509568e4cbbSGuy Helmerload lag.  You should specify a
510568e4cbbSGuy Helmer.Cm MaxDaemonChildren
511568e4cbbSGuy Helmerparameter when you start
512f063d76aSMatthew Dillonsendmail high enough to handle your expected load but no so high that the
513f063d76aSMatthew Dilloncomputer cannot handle that number of sendmails without falling on its face.
514568e4cbbSGuy HelmerIt is also prudent to run sendmail in queued mode
515568e4cbbSGuy Helmer.Pq Fl ODeliveryMode=queued
516568e4cbbSGuy Helmerand to run the daemon
517568e4cbbSGuy Helmer.Pq Cm sendmail -bd
518568e4cbbSGuy Helmerseparate from the queue-runs
519568e4cbbSGuy Helmer.Pq Cm sendmail -q15m .
520568e4cbbSGuy HelmerIf you still want realtime delivery you can run the queue
521568e4cbbSGuy Helmerat a much lower interval, such as
522568e4cbbSGuy Helmer.Fl q1m ,
523568e4cbbSGuy Helmerbut be sure to specify a reasonable
524568e4cbbSGuy Helmer.Cm MaxDaemonChildren
525568e4cbbSGuy Helmeroption for that sendmail to prevent cascade failures.
526f063d76aSMatthew Dillon.Pp
527f063d76aSMatthew DillonSyslogd can be attacked directly and it is strongly recommended that you use
528568e4cbbSGuy Helmerthe
529568e4cbbSGuy Helmer.Fl s
530568e4cbbSGuy Helmeroption whenever possible, and the
531568e4cbbSGuy Helmer.Fl a
532568e4cbbSGuy Helmeroption otherwise.
533f063d76aSMatthew Dillon.Pp
534f063d76aSMatthew DillonYou should also be fairly careful
535f063d76aSMatthew Dillonwith connect-back services such as tcpwrapper's reverse-identd, which can
536f063d76aSMatthew Dillonbe attacked directly.  You generally do not want to use the reverse-ident
537f063d76aSMatthew Dillonfeature of tcpwrappers for this reason.
538f063d76aSMatthew Dillon.Pp
539f063d76aSMatthew DillonIt is a very good idea to protect internal services from external access
540f063d76aSMatthew Dillonby firewalling them off at your border routers.  The idea here is to prevent
541f063d76aSMatthew Dillonsaturation attacks from outside your LAN, not so much to protect internal
54285752545SGuy Helmerservices from network-based root compromise.  Always configure an exclusive
54357e4378bSRuslan Ermilovfirewall, i.e.\&
544568e4cbbSGuy Helmer.So
54547afd1f8SDaniel Harrisfirewall everything
54647afd1f8SDaniel Harris.Em except
54747afd1f8SDaniel Harrisports A, B, C, D, and M-Z
548568e4cbbSGuy Helmer.Sc .
549568e4cbbSGuy HelmerThis
550f063d76aSMatthew Dillonway you can firewall off all of your low ports except for certain specific
551568e4cbbSGuy Helmerservices such as named
552c4d9468eSRuslan Ermilov(if you are primary for a zone),
553568e4cbbSGuy Helmerntalkd, sendmail,
554f063d76aSMatthew Dillonand other internet-accessible services.
555f063d76aSMatthew DillonIf you try to configure the firewall the other
55647afd1f8SDaniel Harrisway \(em as an inclusive or permissive firewall, there is a good chance that you
557568e4cbbSGuy Helmerwill forget to
558568e4cbbSGuy Helmer.Sq close
559568e4cbbSGuy Helmera couple of services or that you will add a new internal
560f063d76aSMatthew Dillonservice and forget to update the firewall.  You can still open up the
561f063d76aSMatthew Dillonhigh-numbered port range on the firewall to allow permissive-like operation
562568e4cbbSGuy Helmerwithout compromising your low ports.  Also take note that
563f6f8f44dSAlexey Zelkin.Fx
564568e4cbbSGuy Helmerallows you to
565f063d76aSMatthew Dilloncontrol the range of port numbers used for dynamic binding via the various
566568e4cbbSGuy Helmernet.inet.ip.portrange sysctl's
567c4d9468eSRuslan Ermilov.Pq Li "sysctl -a | fgrep portrange" ,
568568e4cbbSGuy Helmerwhich can also
569f063d76aSMatthew Dillonease the complexity of your firewall's configuration.  I usually use a normal
570f063d76aSMatthew Dillonfirst/last range of 4000 to 5000, and a hiport range of 49152 to 65535, then
571568e4cbbSGuy Helmerblock everything under 4000 off in my firewall
572c4d9468eSRuslan Ermilov(except for certain specific
573c4d9468eSRuslan Ermilovinternet-accessible ports, of course).
574f063d76aSMatthew Dillon.Pp
57547afd1f8SDaniel HarrisAnother common DOS attack is called a springboard attack \(em to attack a server
576f063d76aSMatthew Dillonin a manner that causes the server to generate responses which then overload
577f063d76aSMatthew Dillonthe server, the local network, or some other machine.  The most common attack
578568e4cbbSGuy Helmerof this nature is the ICMP PING BROADCAST attack.  The attacker spoofs ping
579f063d76aSMatthew Dillonpackets sent to your LAN's broadcast address with the source IP address set
580f063d76aSMatthew Dillonto the actual machine they wish to attack.  If your border routers are not
581f063d76aSMatthew Dillonconfigured to stomp on ping's to broadcast addresses, your LAN winds up
582f063d76aSMatthew Dillongenerating sufficient responses to the spoofed source address to saturate the
583f063d76aSMatthew Dillonvictim, especially when the attacker uses the same trick on several dozen
584f063d76aSMatthew Dillonbroadcast addresses over several dozen different networks at once.  Broadcast
585f063d76aSMatthew Dillonattacks of over a hundred and twenty megabits have been measured.  A second
586f063d76aSMatthew Dilloncommon springboard attack is against the ICMP error reporting system.  By
587f063d76aSMatthew Dillonconstructing packets that generate ICMP error responses, an attacker can
588f063d76aSMatthew Dillonsaturate a server's incoming network and cause the server to saturate its
589f063d76aSMatthew Dillonoutgoing network with ICMP responses.  This type of attack can also crash the
590f063d76aSMatthew Dillonserver by running it out of mbuf's, especially if the server cannot drain the
591568e4cbbSGuy HelmerICMP responses it generates fast enough.  The
592f6f8f44dSAlexey Zelkin.Fx
593568e4cbbSGuy Helmerkernel has a new kernel
594f063d76aSMatthew Dilloncompile option called ICMP_BANDLIM which limits the effectiveness of these
595f063d76aSMatthew Dillonsorts of attacks.  The last major class of springboard attacks is related to
596f063d76aSMatthew Dilloncertain internal inetd services such as the udp echo service.  An attacker
597f063d76aSMatthew Dillonsimply spoofs a UDP packet with the source address being server A's echo port,
598f063d76aSMatthew Dillonand the destination address being server B's echo port, where server A and B
599f063d76aSMatthew Dillonare both on your LAN.  The two servers then bounce this one packet back and
600f063d76aSMatthew Dillonforth between each other.  The attacker can overload both servers and their
601f063d76aSMatthew DillonLANs simply by injecting a few packets in this manner.  Similar problems
6027626ae52SMatthew Dillonexist with the internal chargen port.  A competent sysadmin will turn off all
603f063d76aSMatthew Dillonof these inetd-internal test services.
604f063d76aSMatthew Dillon.Pp
605f063d76aSMatthew DillonSpoofed packet attacks may also be used to overload the kernel route cache.
606f063d76aSMatthew DillonRefer to the net.inet.ip.rtexpire, rtminexpire, and rtmaxcache sysctl
607f063d76aSMatthew Dillonparameters.  A spoofed packet attack that uses a random source IP will cause
608f063d76aSMatthew Dillonthe kernel to generate a temporary cached route in the route table, viewable
609568e4cbbSGuy Helmerwith
610568e4cbbSGuy Helmer.Sq netstat -rna \&| fgrep W3 .
611568e4cbbSGuy HelmerThese routes typically timeout in 1600
612f063d76aSMatthew Dillonseconds or so.  If the kernel detects that the cached route table has gotten
613f063d76aSMatthew Dillontoo big it will dynamically reduce the rtexpire but will never decrease it to
614074ad115SRuslan Ermilovless than rtminexpire.  There are two problems:  (1) The kernel does not react
615f063d76aSMatthew Dillonquickly enough when a lightly loaded server is suddenly attacked, and (2) The
616f063d76aSMatthew Dillonrtminexpire is not low enough for the kernel to survive a sustained attack.
617f063d76aSMatthew DillonIf your servers are connected to the internet via a T3 or better it may be
61885752545SGuy Helmerprudent to manually override both rtexpire and rtminexpire via
61985752545SGuy Helmer.Xr sysctl 8 .
620568e4cbbSGuy HelmerNever set either parameter to zero
621c4d9468eSRuslan Ermilov(unless you want to crash the machine :-)).
622f063d76aSMatthew DillonSetting both parameters to 2 seconds should be sufficient to protect the route
623f063d76aSMatthew Dillontable from attack.
624d93b26d6SMatthew Dillon.Sh ACCESS ISSUES WITH KERBEROS AND SSH
625d93b26d6SMatthew DillonThere are a few issues with both kerberos and ssh that need to be addressed
626d93b26d6SMatthew Dillonif you intend to use them.  Kerberos V is an excellent authentication
627d93b26d6SMatthew Dillonprotocol but the kerberized telnet and rlogin suck rocks.  There are bugs that
628d93b26d6SMatthew Dillonmake them unsuitable for dealing with binary streams.  Also, by default
629d93b26d6SMatthew Dillonkerberos does not encrypt a session unless you use the
630d93b26d6SMatthew Dillon.Fl x
631d93b26d6SMatthew Dillonoption.  Ssh encrypts everything by default.
632d93b26d6SMatthew Dillon.Pp
6339baaab27SDima DorfmanSsh works quite well in every respect except when it is set up to
6349baaab27SDima Dorfmanforward encryption keys.
6359baaab27SDima DorfmanWhat this means is that if you have a secure workstation holding
636d93b26d6SMatthew Dillonkeys that give you access to the rest of the system, and you ssh to an
637e478095eSChristian Bruefferunsecure machine, your keys become exposed.  The actual keys themselves are
638d93b26d6SMatthew Dillonnot exposed, but ssh installs a forwarding port for the duration of your
63947afd1f8SDaniel Harrislogin and if an attacker has broken root on the unsecure machine he can utilize
640d93b26d6SMatthew Dillonthat port to use your keys to gain access to any other machine that your
641d93b26d6SMatthew Dillonkeys unlock.
642d93b26d6SMatthew Dillon.Pp
643d93b26d6SMatthew DillonWe recommend that you use ssh in combination with kerberos whenever possible
644d93b26d6SMatthew Dillonfor staff logins.  Ssh can be compiled with kerberos support.  This reduces
645d93b26d6SMatthew Dillonyour reliance on potentially exposable ssh keys while at the same time
646d93b26d6SMatthew Dillonprotecting passwords via kerberos.  Ssh keys
647d93b26d6SMatthew Dillonshould only be used for automated tasks from secure machines (something
648d93b26d6SMatthew Dillonthat kerberos is unsuited to).  We also recommend that you either turn off
649d93b26d6SMatthew Dillonkey-forwarding in the ssh configuration, or that you make use of the
650d93b26d6SMatthew Dillon.Pa "from=IP/DOMAIN"
651d93b26d6SMatthew Dillonoption that ssh allows in its
652d93b26d6SMatthew Dillon.Pa authorized_keys
6537c86a74bSMike Pritchardfile to make the key only usable to entities logging in from specific
654d93b26d6SMatthew Dillonmachines.
655f063d76aSMatthew Dillon.Sh SEE ALSO
656f063d76aSMatthew Dillon.Xr chflags 1 ,
657f063d76aSMatthew Dillon.Xr find 1 ,
658f063d76aSMatthew Dillon.Xr md5 1 ,
659f6f8f44dSAlexey Zelkin.Xr netstat 1 ,
6608596de53SNik Clayton.Xr openssl 1 ,
6615521ff5aSRuslan Ermilov.Xr ssh 1 ,
6626ac7e896SDavid E. O'Brien.Xr xdm 1 ,
663d93b26d6SMatthew Dillon.Xr group 5 ,
664ad27d066SMatthew Dillon.Xr ttys 5 ,
6658596de53SNik Clayton.Xr accton 8 ,
666d93b26d6SMatthew Dillon.Xr init 8 ,
6678596de53SNik Clayton.Xr sshd 8 ,
668ad27d066SMatthew Dillon.Xr sysctl 8 ,
6698596de53SNik Clayton.Xr syslogd 8 ,
670ad27d066SMatthew Dillon.Xr vipw 8
671f063d76aSMatthew Dillon.Sh HISTORY
672f063d76aSMatthew DillonThe
673f063d76aSMatthew Dillon.Nm
674568e4cbbSGuy Helmermanual page was originally written by
675568e4cbbSGuy Helmer.An Matthew Dillon
676568e4cbbSGuy Helmerand first appeared
677568e4cbbSGuy Helmerin
67885752545SGuy Helmer.Fx 3.1 ,
679568e4cbbSGuy HelmerDecember 1998.
680