Fix some manlint nits and add .Dx where appropriate.
[dragonfly.git] / share / man / man7 / security.7
1 .\" Copyright (c) 1998 Matthew Dillon.  Terms and conditions are those of
2 .\" the BSD Copyright as specified in the file "/usr/src/COPYRIGHT" in
3 .\" the source tree.
4 .\"
5 .\" $FreeBSD: src/share/man/man7/security.7,v 1.13.2.11 2002/04/13 02:04:44 keramida Exp $
6 .\" $DragonFly: src/share/man/man7/security.7,v 1.6 2005/12/10 00:22:29 swildner Exp $
7 .\"
8 .Dd September 18, 1999
9 .Dt SECURITY 7
10 .Os
11 .Sh NAME
12 .Nm security
13 .Nd introduction to security under
14 .Dx
15 .Sh DESCRIPTION
16 Security is a function that begins and ends with the system administrator.
17 While all
18 .Bx
19 multi-user systems have some inherent security, the job of building and
20 maintaining additional security mechanisms to keep users
21 .Sq honest
22 is probably
23 one of the single largest undertakings of the sysadmin.  Machines are
24 only as secure as you make them, and security concerns are ever competing
25 with the human necessity for convenience.
26 .Ux
27 systems,
28 in general, are capable of running a huge number of simultaneous processes
29 and many of these processes operate as servers - meaning that external entities
30 can connect and talk to them.  As yesterday's mini-computers and mainframes
31 become today's desktops, and as computers become networked and internetworked,
32 security becomes an ever bigger issue.
33 .Pp
34 Security is best implemented through a layered onion approach.  In a nutshell,
35 what you want to do is to create as many layers of security as are convenient
36 and then carefully monitor the system for intrusions.  You do not want to
37 overbuild your security or you will interfere with the detection side, and
38 detection is one of the single most important aspects of any security
39 mechanism.  For example, it makes little sense to set the
40 .Pa schg
41 flags
42 (see
43 .Xr chflags 1 )
44 on every system binary because while this may temporarily protect the
45 binaries, it prevents a hacker who has broken in from making an
46 easily detectable change that may result in your security mechanisms not
47 detecting the hacker at all.
48 .Pp
49 System security also pertains to dealing with various forms of attack,
50 including attacks that attempt to crash or otherwise make a system unusable
51 but do not attempt to break root.  Security concerns can be split up into
52 several categories:
53 .Bl -enum -offset indent
54 .It
55 Denial of service attacks
56 .It
57 User account compromises
58 .It
59 Root compromise through accessible servers
60 .It
61 Root compromise via user accounts
62 .It
63 Backdoor creation
64 .El
65 .Pp
66 A denial of service attack is an action that deprives the machine of needed
67 resources.  Typically, D.O.S. attacks are brute-force mechanisms that attempt
68 to crash or otherwise make a machine unusable by overwhelming its servers or
69 network stack.  Some D.O.S. attacks try to take advantages of bugs in the
70 networking stack to crash a machine with a single packet.  The latter can
71 only be fixed by applying a bug fix to the kernel.  Attacks on servers can
72 often be fixed by properly specifying options to limit the load the servers
73 incur on the system under adverse conditions.  Brute-force network
74 attacks are harder to deal with.  A spoofed-packet attack, for example, is
75 nearly impossible to stop short of cutting your system off from the Internet.
76 It may not be able to take your machine down, but it can fill up Internet
77 pipe.
78 .Pp
79 A user account compromise is even more common then a D.O.S. attack.  Many
80 sysadmins still run standard telnetd, rlogind, rshd, and ftpd servers on their
81 machines.  These servers, by default, do not operate over encrypted
82 connections.  The result is that if you have any moderate-sized user base,
83 one or more of your users logging into your system from a remote location
84 (which is the most common and convenient way to login to a system)
85 will
86 have his or her password sniffed.  The attentive system admin will analyze
87 his remote access logs looking for suspicious source addresses
88 even for successful logins.
89 .Pp
90 One must always assume that once an attacker has access to a user account,
91 the attacker can break root.  However, the reality is that in a well secured
92 and maintained system, access to a user account does not necessarily give the
93 attacker access to root.  The distinction is important because without access
94 to root the attacker cannot generally hide his tracks and may, at best, be
95 able to do nothing more than mess with the user's files or crash the machine.
96 User account compromises are very common because users tend not to take the
97 precautions that sysadmins take.
98 .Pp
99 System administrators must keep in mind that there are potentially many ways
100 to break root on a machine.  The attacker may know the root password,
101 the attacker
102 may find a bug in a root-run server and be able to break root over a network
103 connection to that server, or the attacker may know of a bug in an suid-root
104 program that allows the attacker to break root once he has broken into a
105 user's account.  If an attacker has found a way to break root on a machine,
106 the attacker may not have a need to install a backdoor.
107 Many of the root holes found and closed to date involve a considerable amount
108 of work by the hacker to cleanup after himself, so most hackers do install
109 backdoors.  This gives you a convenient way to detect the hacker.  Making
110 it impossible for a hacker to install a backdoor may actually be detrimental
111 to your security because it will not close off the hole the hacker found to
112 break in the first place.
113 .Pp
114 Security remedies should always be implemented with a multi-layered
115 .Sq onion peel
116 approach and can be categorized as follows:
117 .Bl -enum -offset indent
118 .It
119 Securing root and staff accounts
120 .It
121 Securing root - root-run servers and suid/sgid binaries
122 .It
123 Securing user accounts
124 .It
125 Securing the password file
126 .It
127 Securing the kernel core, raw devices, and filesystems
128 .It
129 Quick detection of inappropriate changes made to the system
130 .It
131 Paranoia
132 .El
133 .Sh SECURING THE ROOT ACCOUNT AND SECURING STAFF ACCOUNTS
134 Don't bother securing staff accounts if you haven't secured the root
135 account.  Most systems have a password assigned to the root account.  The
136 first thing you do is assume that the password is
137 .Sq always
138 compromised.  This does not mean that you should remove the password.  The
139 password is almost always necessary for console access to the machine.
140 What it does mean is that you should not make it possible to use the password
141 outside of the console or possibly even with a
142 .Xr su 1
143 command.
144 For example, make sure that your pty's are specified as being unsecure
145 in the
146 .Sq Pa /etc/ttys
147 file
148 so that direct root logins via telnet or rlogin are disallowed.  If using
149 other login services such as sshd, make sure that direct root logins are
150 disabled there as well.  Consider every access method - services such as
151 ftp often fall through the cracks.  Direct root logins should only be allowed
152 via the system console.
153 .Pp
154 Of course, as a sysadmin you have to be able to get to root, so we open up
155 a few holes.  But we make sure these holes require additional password
156 verification to operate.  One way to make root accessible is to add appropriate
157 staff accounts to the wheel group
158 (in
159 .Pa /etc/group ) .
160 The staff members placed
161 in the wheel group are allowed to
162 .Sq su
163 to root.  You should never give staff
164 members native wheel access by putting them in the wheel group in their
165 password entry.  Staff accounts should be placed in a
166 .Sq staff
167 group, and then added to the wheel group via the
168 .Sq Pa /etc/group
169 file.  Only those staff members who actually need to have root access
170 should be placed in the wheel group.  It is also possible, when using an
171 authentication method such as kerberos, to use kerberos's
172 .Sq Pa .k5login
173 file in the root account to allow a
174 .Xr ksu 1
175 to root without having to place anyone at all in the wheel group.  This
176 may be the better solution since the wheel mechanism still allows an
177 intruder to break root if the intruder has gotten hold of your password
178 file and can break into a staff account.  While having the wheel mechanism
179 is better then having nothing at all, it isn't necessarily the safest
180 option.
181 .Pp
182 An indirect way to secure the root account is to secure your staff accounts
183 by using an alternative login access method and *'ing out the crypted password
184 for the staff accounts.  This way an intruder may be able to steal the password
185 file but will not be able to break into any staff accounts (or, indirectly,
186 root, even if root has a crypted password associated with it).  Staff members
187 get into their staff accounts through a secure login mechanism such as
188 .Xr kerberos 1
189 or
190 .Xr ssh 1
191 using a private/public
192 key pair.  When you use something like kerberos you generally must secure
193 the machines which run the kerberos servers and your desktop workstation.
194 When you use a public/private key pair with ssh, you must generally secure
195 the machine you are logging in FROM
196 (typically your workstation),
197 but you can
198 also add an additional layer of protection to the key pair by password
199 protecting the keypair when you create it with
200 .Xr ssh-keygen 1 .
201 Being able
202 to *-out the passwords for staff accounts also guarantees that staff members
203 can only login through secure access methods that you have setup.  You can
204 thus force all staff members to use secure, encrypted connections for
205 all their sessions which closes an important hole used by many intruders:  That
206 of sniffing the network from an unrelated, less secure machine.
207 .Pp
208 The more indirect security mechanisms also assume that you are logging in
209 from a more restrictive server to a less restrictive server.  For example,
210 if your main box is running all sorts of servers, your workstation shouldn't
211 be running any.  In order for your workstation to be reasonably secure
212 you should run as few servers as possible, up to and including no servers
213 at all, and you should run a password-protected screen blanker.
214 Of course, given physical access to
215 a workstation an attacker can break any sort of security you put on it.
216 This is definitely a problem that you should consider but you should also
217 consider the fact that the vast majority of break-ins occur remotely, over
218 a network, from people who do not have physical access to your workstation or
219 servers.
220 .Pp
221 Using something like kerberos also gives you the ability to disable or
222 change the password for a staff account in one place and have it immediately
223 effect all the machine the staff member may have an account on.  If a staff
224 member's account gets compromised, the ability to instantly change his
225 password on all machines should not be underrated.  With discrete passwords,
226 changing a password on N machines can be a mess.  You can also impose
227 re-passwording restrictions with kerberos:  not only can a kerberos ticket
228 be made to timeout after a while, but the kerberos system can require that
229 the user choose a new password after a certain period of time
230 (say, once a month).
231 .Sh SECURING ROOT - ROOT-RUN SERVERS AND SUID/SGID BINARIES
232 The prudent sysadmin only runs the servers he needs to, no more, no less.  Be
233 aware that third party servers are often the most bug-prone.  For example,
234 running an old version of imapd or popper is like giving a universal root
235 ticket out to the entire world.  Never run a server that you have not checked
236 out carefully.  Many servers do not need to be run as root.  For example,
237 the ntalk, comsat, and finger daemons can be run in special user
238 .Sq sandboxes .
239 A sandbox isn't perfect unless you go to a large amount of trouble, but the
240 onion approach to security still stands:  If someone is able to break in
241 through a server running in a sandbox, they still have to break out of the
242 sandbox.  The more layers the attacker must break through, the lower the
243 likelihood of his success.  Root holes have historically been found in
244 virtually every server ever run as root, including basic system servers.
245 If you are running a machine through which people only login via sshd and
246 never login via telnetd or rshd or rlogind, then turn off those services!
247 .Pp
248 .Dx
249 now defaults to running ntalkd, comsat, and finger in a sandbox.
250 Another program which may be a candidate for running in a sandbox is
251 .Xr named 8 .
252 The default rc.conf includes the arguments necessary to run
253 named in a sandbox in a commented-out form.  Depending on whether you
254 are installing a new system or upgrading an existing system, the special
255 user accounts used by these sandboxes may not be installed.  The prudent
256 sysadmin would research and implement sandboxes for servers whenever possible.
257 .Pp
258 There are a number of other servers that typically do not run in sandboxes:
259 sendmail, popper, imapd, ftpd, and others.  There are alternatives to
260 some of these, but installing them may require more work than you are willing
261 to put
262 (the convenience factor strikes again).
263 You may have to run these
264 servers as root and rely on other mechanisms to detect break-ins that might
265 occur through them.
266 .Pp
267 The other big potential root hole in a system are the suid-root and sgid
268 binaries installed on the system.  Most of these binaries, such as rlogin,
269 reside in
270 .Pa /bin ,
271 .Pa /sbin ,
272 .Pa /usr/bin ,
273 or
274 .Pa /usr/sbin .
275 While nothing is 100% safe,
276 the system-default suid and sgid binaries can be considered reasonably safe.
277 Still, root holes are occasionally found in these binaries.  A root hole
278 was found in Xlib in 1998 that made xterm
279 (which is typically suid)
280 vulnerable.
281 It is better to be safe then sorry and the prudent sysadmin will restrict suid
282 binaries that only staff should run to a special group that only staff can
283 access, and get rid of
284 .Pq Li "chmod 000"
285 any suid binaries that nobody uses.  A
286 server with no display generally does not need an xterm binary.  Sgid binaries
287 can be almost as dangerous.  If an intruder can break an sgid-kmem binary the
288 intruder might be able to read
289 .Pa /dev/kmem
290 and thus read the crypted password
291 file, potentially compromising any passworded account.  Alternatively an
292 intruder who breaks group kmem can monitor keystrokes sent through pty's,
293 including pty's used by users who login through secure methods.  An intruder
294 that breaks the tty group can write to almost any user's tty.  If a user
295 is running a terminal
296 program or emulator with a keyboard-simulation feature, the intruder can
297 potentially
298 generate a data stream that causes the user's terminal to echo a command, which
299 is then run as that user.
300 .Sh SECURING USER ACCOUNTS
301 User accounts are usually the most difficult to secure.  While you can impose
302 Draconian access restrictions on your staff and *-out their passwords, you
303 may not be able to do so with any general user accounts you might have.  If
304 you do have sufficient control then you may win out and be able to secure the
305 user accounts properly.  If not, you simply have to be more vigilant in your
306 monitoring of those accounts.  Use of ssh and kerberos for user accounts is
307 more problematic due to the extra administration and technical support
308 required, but still a very good solution compared to a crypted password
309 file.
310 .Sh SECURING THE PASSWORD FILE
311 The only sure-fire way is to *-out as many passwords as you can and
312 use ssh or kerberos for access to those accounts.  Even though the
313 crypted password file
314 .Pq Pa /etc/spwd.db
315 can only be read by root, it may
316 be possible for an intruder to obtain read access to that file even if the
317 attacker cannot obtain root-write access.
318 .Pp
319 Your security scripts should always check for and report changes to
320 the password file
321 (see
322 .Sq Checking file integrity
323 below).
324 .Sh SECURING THE KERNEL CORE, RAW DEVICES, AND FILESYSTEMS
325 If an attacker breaks root he can do just about anything, but there
326 are certain conveniences.  For example, most modern kernels have a
327 packet sniffing device driver built in.  Under
328 .Dx
329 it is called
330 the
331 .Sq bpf
332 device.  An intruder will commonly attempt to run a packet sniffer
333 on a compromised machine.  You do not need to give the intruder the
334 capability and most systems should not have the bpf device compiled in.
335 .Pp
336 But even if you turn off the bpf device,
337 you still have
338 .Pa /dev/mem
339 and
340 .Pa /dev/kmem
341 to worry about.  For that matter,
342 the intruder can still write to raw disk devices.
343 Also, there is another kernel feature called the module loader,
344 .Xr kldload 8 .
345 An enterprising intruder can use a KLD module to install
346 his own bpf device or other sniffing device on a running kernel.
347 To avoid these problems you have to run
348 the kernel at a higher secure level, at least securelevel 1.  The securelevel
349 can be set with a sysctl on the kern.securelevel variable.  Once you have
350 set the securelevel to 1, write access to raw devices will be denied and
351 special chflags flags, such as
352 .Sq schg ,
353 will be enforced.  You must also ensure
354 that the
355 .Sq schg
356 flag is set on critical startup binaries, directories, and
357 script files - everything that gets run up to the point where the securelevel
358 is set.  This might be overdoing it, and upgrading the system is much more
359 difficult when you operate at a higher secure level.  You may compromise and
360 run the system at a higher secure level but not set the schg flag for every
361 system file and directory under the sun.  Another possibility is to simply
362 mount / and /usr read-only.  It should be noted that being too draconian in
363 what you attempt to protect may prevent the all-important detection of an
364 intrusion.
365 .Sh CHECKING FILE INTEGRITY: BINARIES, CONFIG FILES, ETC
366 When it comes right down to it, you can only protect your core system
367 configuration and control files so much before the convenience factor
368 rears its ugly head.  For example, using chflags to set the schg bit
369 on most of the files in / and /usr is probably counterproductive because
370 while it may protect the files, it also closes a detection window.  The
371 last layer of your security onion is perhaps the most important - detection.
372 The rest of your security is pretty much useless (or, worse, presents you with
373 a false sense of safety) if you cannot detect potential incursions.  Half
374 the job of the onion is to slow down the attacker rather then stop him
375 in order to give the detection side of the equation a chance to catch him in
376 the act.
377 .Pp
378 The best way to detect an incursion is to look for modified, missing, or
379 unexpected files.  The best
380 way to look for modified files is from another (often centralized)
381 limited-access system.
382 Writing your security scripts on the extra-secure limited-access system
383 makes them mostly invisible to potential hackers, and this is important.
384 In order to take maximum advantage you generally have to give the
385 limited-access box significant access to the other machines in the business,
386 usually either by doing a read-only NFS export of the other machines to the
387 limited-access box, or by setting up ssh keypairs to allow the limit-access
388 box to ssh to the other machines.  Except for its network traffic, NFS is
389 the least visible method - allowing you to monitor the filesystems on each
390 client box virtually undetected.  If your
391 limited-access server is connected to the client boxes through a switch,
392 the NFS method is often the better choice.  If your limited-access server
393 is connected to the client boxes through a hub or through several layers
394 of routing, the NFS method may be too insecure (network-wise) and using ssh
395 may be the better choice even with the audit-trail tracks that ssh lays.
396 .Pp
397 Once you give a limit-access box at least read access to the client systems
398 it is supposed to monitor, you must write scripts to do the actual
399 monitoring.  Given an NFS mount, you can write scripts out of simple system
400 utilities such as
401 .Xr find 1
402 and
403 .Xr md5 1
404 It is best to physically md5 the client-box files boxes at least once a
405 day, and to test control files such as those found in
406 .Pa /etc
407 and
408 .Pa /usr/local/etc
409 even more often.  When mismatches are found relative to the base md5
410 information the limited-access machine knows is valid, it should scream at
411 a sysadmin to go check it out.  A good security script will also check for
412 inappropriate suid binaries and for new or deleted files on system partitions
413 such as
414 .Pa /
415 and
416 .Pa /usr
417 .Pp
418 When using ssh rather then NFS, writing the security script is much more
419 difficult.   You essentially have to
420 .Pa scp
421 the scripts to the client box in order to run them, making them visible, and
422 for safety you also need to scp the binaries (such as find) that those scripts
423 use.  The ssh daemon on the client box may already be compromised.  All in all,
424 using ssh may be necessary when running over unsecure links, but it's also a
425 lot harder to deal with.
426 .Pp
427 A good security script will also check for changes to user and staff members
428 access configuration files:
429 .Pa .rhosts ,
430 .Pa .shosts ,
431 .Pa .ssh/authorized_keys
432 and so forth... files that might fall outside the purview of the MD5 check.
433 .Pp
434 If you have a huge amount of user disk space it may take too long to run
435 through every file on those partitions.  In this case, setting mount
436 flags to disallow suid binaries and devices on those partitions is a good
437 idea.  The
438 .Sq nodev
439 and
440 .Sq nosuid
441 options
442 (see
443 .Xr mount 8 )
444 are what you want to look into.  I would scan them anyway at least once a
445 week, since the object of this layer is to detect a break-in whether or
446 not the breakin is effective.
447 .Pp
448 Process accounting
449 (see
450 .Xr accton 8 )
451 is a relatively low-overhead feature of
452 the operating system which I recommend using as a post-break-in evaluation
453 mechanism.  It is especially useful in tracking down how an intruder has
454 actually broken into a system, assuming the file is still intact after
455 the break-in occurs.
456 .Pp
457 Finally, security scripts should process the log files and the logs themselves
458 should be generated in as secure a manner as possible - remote syslog can be
459 very useful.  An intruder tries to cover his tracks, and log files are critical
460 to the sysadmin trying to track down the time and method of the initial
461 break-in.  One way to keep a permanent record of the log files is to run
462 the system console to a serial port and collect the information on a
463 continuing basis through a secure machine monitoring the consoles.
464 .Sh PARANOIA
465 A little paranoia never hurts.  As a rule, a sysadmin can add any number
466 of security features as long as they do not affect convenience, and
467 can add security features that do affect convenience with some added
468 thought.  Even more importantly, a security administrator should mix it up
469 a bit - if you use recommendations such as those given by this manual
470 page verbatim, you give away your methodologies to the prospective
471 hacker who also has access to this manual page.
472 .Sh SPECIAL SECTION ON D.O.S. ATTACKS
473 This section covers Denial of Service attacks.  A DOS attack is typically
474 a packet attack.  While there isn't much you can do about modern spoofed
475 packet attacks that saturate your network, you can generally limit the damage
476 by ensuring that the attacks cannot take down your servers.
477 .Bl -enum -offset indent
478 .It
479 Limiting server forks
480 .It
481 Limiting springboard attacks (ICMP response attacks, ping broadcast, etc...)
482 .It
483 Kernel Route Cache
484 .El
485 .Pp
486 A common D.O.S. attack is against a forking server that attempts to cause the
487 server to eat processes, file descriptors, and memory until the machine
488 dies.  Inetd
489 (see
490 .Xr inetd 8 )
491 has several options to limit this sort of attack.
492 It should be noted that while it is possible to prevent a machine from going
493 down it is not generally possible to prevent a service from being disrupted
494 by the attack.  Read the inetd manual page carefully and pay specific attention
495 to the
496 .Fl c ,
497 .Fl C ,
498 and
499 .Fl R
500 options.  Note that spoofed-IP attacks will circumvent
501 the
502 .Fl C
503 option to inetd, so typically a combination of options must be used.
504 Some standalone servers have self-fork-limitation parameters.
505 .Pp
506 Sendmail has its
507 .Fl OMaxDaemonChildren
508 option which tends to work much
509 better than trying to use sendmail's load limiting options due to the
510 load lag.  You should specify a
511 .Cm MaxDaemonChildren
512 parameter when you start
513 sendmail high enough to handle your expected load but no so high that the
514 computer cannot handle that number of sendmails without falling on its face.
515 It is also prudent to run sendmail in queued mode
516 .Pq Fl ODeliveryMode=queued
517 and to run the daemon
518 .Pq Cm sendmail -bd
519 separate from the queue-runs
520 .Pq Cm sendmail -q15m .
521 If you still want realtime delivery you can run the queue
522 at a much lower interval, such as
523 .Fl q1m ,
524 but be sure to specify a reasonable
525 .Cm MaxDaemonChildren
526 option for that sendmail to prevent cascade failures.
527 .Pp
528 Syslogd can be attacked directly and it is strongly recommended that you use
529 the
530 .Fl s
531 option whenever possible, and the
532 .Fl a
533 option otherwise.
534 .Pp
535 You should also be fairly careful
536 with connect-back services such as tcpwrapper's reverse-identd, which can
537 be attacked directly.  You generally do not want to use the reverse-ident
538 feature of tcpwrappers for this reason.
539 .Pp
540 It is a very good idea to protect internal services from external access
541 by firewalling them off at your border routers.  The idea here is to prevent
542 saturation attacks from outside your LAN, not so much to protect internal
543 services from network-based root compromise.  Always configure an exclusive
544 firewall, i.e.\&
545 .So
546 firewall everything *except* ports A, B, C, D, and M-Z
547 .Sc .
548 This
549 way you can firewall off all of your low ports except for certain specific
550 services such as named
551 (if you are primary for a zone),
552 ntalkd, sendmail,
553 and other internet-accessible services.
554 If you try to configure the firewall the other
555 way - as an inclusive or permissive firewall, there is a good chance that you
556 will forget to
557 .Sq close
558 a couple of services or that you will add a new internal
559 service and forget to update the firewall.  You can still open up the
560 high-numbered port range on the firewall to allow permissive-like operation
561 without compromising your low ports.  Also take note that
562 .Dx
563 allows you to
564 control the range of port numbers used for dynamic binding via the various
565 net.inet.ip.portrange sysctl's
566 .Pq Li "sysctl -a | fgrep portrange" ,
567 which can also
568 ease the complexity of your firewall's configuration.  I usually use a normal
569 first/last range of 4000 to 5000, and a hiport range of 49152 to 65535, then
570 block everything under 4000 off in my firewall
571 (except for certain specific
572 internet-accessible ports, of course).
573 .Pp
574 Another common D.O.S. attack is called a springboard attack - to attack a server
575 in a manner that causes the server to generate responses which then overload
576 the server, the local network, or some other machine.  The most common attack
577 of this nature is the ICMP PING BROADCAST attack.  The attacker spoofs ping
578 packets sent to your LAN's broadcast address with the source IP address set
579 to the actual machine they wish to attack.  If your border routers are not
580 configured to stomp on ping's to broadcast addresses, your LAN winds up
581 generating sufficient responses to the spoofed source address to saturate the
582 victim, especially when the attacker uses the same trick on several dozen
583 broadcast addresses over several dozen different networks at once.  Broadcast
584 attacks of over a hundred and twenty megabits have been measured.  A second
585 common springboard attack is against the ICMP error reporting system.  By
586 constructing packets that generate ICMP error responses, an attacker can
587 saturate a server's incoming network and cause the server to saturate its
588 outgoing network with ICMP responses.  This type of attack can also crash the
589 server by running it out of mbuf's, especially if the server cannot drain the
590 ICMP responses it generates fast enough.  The
591 .Dx
592 kernel has a new kernel
593 compile option called ICMP_BANDLIM which limits the effectiveness of these
594 sorts of attacks.  The last major class of springboard attacks is related to
595 certain internal inetd services such as the udp echo service.  An attacker
596 simply spoofs a UDP packet with the source address being server A's echo port,
597 and the destination address being server B's echo port, where server A and B
598 are both on your LAN.  The two servers then bounce this one packet back and
599 forth between each other.  The attacker can overload both servers and their
600 LANs simply by injecting a few packets in this manner.  Similar problems
601 exist with the internal chargen port.  A competent sysadmin will turn off all
602 of these inetd-internal test services.
603 .Pp
604 Spoofed packet attacks may also be used to overload the kernel route cache.
605 Refer to the net.inet.ip.rtexpire, rtminexpire, and rtmaxcache sysctl
606 parameters.  A spoofed packet attack that uses a random source IP will cause
607 the kernel to generate a temporary cached route in the route table, viewable
608 with
609 .Sq netstat -rna \&| fgrep W3 .
610 These routes typically timeout in 1600
611 seconds or so.  If the kernel detects that the cached route table has gotten
612 too big it will dynamically reduce the rtexpire but will never decrease it to
613 less then rtminexpire.  There are two problems:  (1) The kernel does not react
614 quickly enough when a lightly loaded server is suddenly attacked, and (2) The
615 rtminexpire is not low enough for the kernel to survive a sustained attack.
616 If your servers are connected to the internet via a T3 or better it may be
617 prudent to manually override both rtexpire and rtminexpire via
618 .Xr sysctl 8 .
619 Never set either parameter to zero
620 (unless you want to crash the machine :-)).
621 Setting both parameters to 2 seconds should be sufficient to protect the route
622 table from attack.
623 .Sh ACCESS ISSUES WITH KERBEROS AND SSH
624 There are a few issues with both kerberos and ssh that need to be addressed
625 if you intend to use them.  Kerberos V is an excellent authentication
626 protocol but the kerberized telnet and rlogin suck rocks.  There are bugs that
627 make them unsuitable for dealing with binary streams.  Also, by default
628 kerberos does not encrypt a session unless you use the
629 .Fl x
630 option.  Ssh encrypts everything by default.
631 .Pp
632 Ssh works quite well in every respect except when it is set up to
633 forward encryption keys.
634 What this means is that if you have a secure workstation holding
635 keys that give you access to the rest of the system, and you ssh to an
636 unsecure machine, your keys becomes exposed.  The actual keys themselves are
637 not exposed, but ssh installs a forwarding port for the duration of your
638 login and if a hacker has broken root on the unsecure machine he can utilize
639 that port to use your keys to gain access to any other machine that your
640 keys unlock.
641 .Pp
642 We recommend that you use ssh in combination with kerberos whenever possible
643 for staff logins.  Ssh can be compiled with kerberos support.  This reduces
644 your reliance on potentially exposable ssh keys while at the same time
645 protecting passwords via kerberos.  Ssh keys
646 should only be used for automated tasks from secure machines (something
647 that kerberos is unsuited to).  We also recommend that you either turn off
648 key-forwarding in the ssh configuration, or that you make use of the
649 .Pa "from=IP/DOMAIN"
650 option that ssh allows in its
651 .Pa authorized_keys
652 file to make the key only usable to entities logging in from specific
653 machines.
654 .Sh SEE ALSO
655 .Xr chflags 1 ,
656 .Xr find 1 ,
657 .Xr kerberos 1 ,
658 .Xr md5 1 ,
659 .Xr netstat 1 ,
660 .Xr openssl 1 ,
661 .Xr ssh 1 ,
662 .Xr xdm 1 ,
663 .Xr group 5 ,
664 .Xr ttys 5 ,
665 .Xr accton 8 ,
666 .Xr init 8 ,
667 .Xr sshd 8 ,
668 .Xr sysctl 8 ,
669 .Xr syslogd 8 ,
670 .Xr vipw 8
671 .Sh HISTORY
672 The
673 .Nm
674 manual page was originally written by
675 .An Matthew Dillon
676 and first appeared
677 in
678 .Fx 3.1 ,
679 December 1998.