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