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