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