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