13128fa34SMatthew Dillon.\" Copyright (c) 1998, Matthew Dillon. Terms and conditions are those of 23128fa34SMatthew Dillon.\" the BSD Copyright as specified in the file "/usr/src/COPYRIGHT" in 33128fa34SMatthew Dillon.\" the source tree. 4f063d76aSMatthew Dillon.\" 57f3dea24SPeter Wemm.\" $FreeBSD$ 6f063d76aSMatthew Dillon.\" 7d93b26d6SMatthew Dillon.Dd September 18, 1999 8f063d76aSMatthew Dillon.Dt SECURITY 7 9f063d76aSMatthew Dillon.Os 10f063d76aSMatthew Dillon.Sh NAME 11f063d76aSMatthew Dillon.Nm security 12f063d76aSMatthew Dillon.Nd introduction to security under FreeBSD 13f063d76aSMatthew Dillon.Sh DESCRIPTION 14f063d76aSMatthew Dillon.Pp 15f063d76aSMatthew DillonSecurity is a function that begins and ends with the system administrator. 16f063d76aSMatthew DillonWhile all 17f063d76aSMatthew Dillon.Bx 18d93b26d6SMatthew Dillonmulti-user systems have some inherent security, the job of building and 19d93b26d6SMatthew Dillonmaintaining additional security mechanisms to keep those users 20568e4cbbSGuy Helmer.Sq honest 21568e4cbbSGuy Helmeris probably 226ac7e896SDavid E. O'Brienone of the single largest undertakings of the sysadmin. Machines are 23f063d76aSMatthew Dillononly as secure as you make them, and security concerns are ever competing 24568e4cbbSGuy Helmerwith the human necessity for convenience. 25568e4cbbSGuy Helmer.Ux 26568e4cbbSGuy Helmersystems, 276ac7e896SDavid E. O'Brienin general, are capable of running a huge number of simultaneous processes 28f063d76aSMatthew Dillonand many of these processes operate as servers - meaning that external entities 29f063d76aSMatthew Dilloncan connect and talk to them. As yesterday's mini-computers and mainframes 30f063d76aSMatthew Dillonbecome today's desktops, and as computers become networked and internetworked, 31f063d76aSMatthew Dillonsecurity becomes an ever bigger issue. 32f063d76aSMatthew Dillon.Pp 33d93b26d6SMatthew DillonSecurity is best implemented through a layered onion approach. In a nutshell, 34d93b26d6SMatthew Dillonwhat you want to do is to create as many layers of security as are convenient 35d93b26d6SMatthew Dillonand then carefully monitor the system for intrusions. You do not want to 36d93b26d6SMatthew Dillonoverbuild your security or you will interefere with the detection side, and 37d93b26d6SMatthew Dillondetection is one of the single most important aspects of any security 38d93b26d6SMatthew Dillonmechanism. For example, it makes little sense to set the 39d93b26d6SMatthew Dillon.Pa schg 40d93b26d6SMatthew Dillonflags 41d93b26d6SMatthew Dillon.Po 42d93b26d6SMatthew Dillonsee 43d93b26d6SMatthew Dillon.Xr chflags 1 44d93b26d6SMatthew Dillon.Pc 45d93b26d6SMatthew Dillonon every system binary because while this may temporarily protect the 46d93b26d6SMatthew Dillonbinaries, it prevents a hacker who has broken in from making an 47d93b26d6SMatthew Dilloneasily detectable change that may result in your security mechanisms not 48d93b26d6SMatthew Dillondetecting the hacker at all. 49d93b26d6SMatthew Dillon.Pp 50d93b26d6SMatthew DillonSystem security also pertains to dealing with various forms of attack, 51d93b26d6SMatthew Dillonincluding attacks that attempt to crash or otherwise make a system unusable 52d93b26d6SMatthew Dillonbut do not attempt to break root. Security concerns can be split up into 53d93b26d6SMatthew Dillonseveral categories: 54f063d76aSMatthew Dillon.Bl -enum -offset indent 55f063d76aSMatthew Dillon.It 56f063d76aSMatthew DillonDenial of service attacks 57f063d76aSMatthew Dillon.It 58f063d76aSMatthew DillonUser account compromises 59f063d76aSMatthew Dillon.It 606ac7e896SDavid E. O'BrienRoot compromise through accessible servers 61f063d76aSMatthew Dillon.It 626ac7e896SDavid E. O'BrienRoot compromise via user accounts 63d93b26d6SMatthew Dillon.It 64d93b26d6SMatthew DillonBackdoor creation 65f063d76aSMatthew Dillon.El 66f063d76aSMatthew Dillon.Pp 67f063d76aSMatthew DillonA denial of service attack is an action that deprives the machine of needed 68f063d76aSMatthew Dillonresources. Typically, D.O.S. attacks are brute-force mechanisms that attempt 69f063d76aSMatthew Dillonto crash or otherwise make a machine unusable by overwhelming its servers or 70f063d76aSMatthew Dillonnetwork stack. Some D.O.S. attacks try to take advantages of bugs in the 71f063d76aSMatthew Dillonnetworking stack to crash a machine with a single packet. The latter can 72f063d76aSMatthew Dillononly be fixed by applying a bug fix to the kernel. Attacks on servers can 73d93b26d6SMatthew Dillonoften be fixed by properly specifying options to limit the load the servers 74d93b26d6SMatthew Dillonincur on the system under adverse conditions. Brute-force network 75f063d76aSMatthew Dillonattacks are harder to deal with. A spoofed-packet attack, for example, is 76f063d76aSMatthew Dillonnearly impossible to stop short of cutting your system off from the internet. 77d93b26d6SMatthew DillonIt may not be able to take your machine down, but it can fill up internet 78d93b26d6SMatthew Dillonpipe. 79f063d76aSMatthew Dillon.Pp 80f063d76aSMatthew DillonA user account compromise is even more common then a D.O.S. attack. Many 816ac7e896SDavid E. O'Briensysadmins still run standard telnetd, rlogind, rshd, and ftpd servers on their 82f063d76aSMatthew Dillonmachines. These servers, by default, do not operate over encrypted 83f063d76aSMatthew Dillonconnections. The result is that if you have any moderate-sized user base, 84f063d76aSMatthew Dillonone or more of your users logging into your system from a remote location 85568e4cbbSGuy Helmer.Po 86568e4cbbSGuy Helmerwhich is the most common and convenient way to login to a system 87568e4cbbSGuy Helmer.Pc 88568e4cbbSGuy Helmerwill 89f063d76aSMatthew Dillonhave his or her password sniffed. The attentive system admin will analyze 90d93b26d6SMatthew Dillonhis remote access logs looking for suspicious source addresses 91f063d76aSMatthew Dilloneven for successful logins. 92f063d76aSMatthew Dillon.Pp 93f063d76aSMatthew DillonOne must always assume that once an attacker has access to a user account, 94f063d76aSMatthew Dillonthe attacker can break root. However, the reality is that in a well secured 95f063d76aSMatthew Dillonand maintained system, access to a user account does not necessarily give the 96f063d76aSMatthew Dillonattacker access to root. The distinction is important because without access 97f063d76aSMatthew Dillonto root the attacker cannot generally hide his tracks and may, at best, be 98d93b26d6SMatthew Dillonable to do nothing more then mess with the user's files or crash the machine. 99d93b26d6SMatthew DillonUser account compromises are very common because users tend not to take the 100d93b26d6SMatthew Dillonprecautions that sysads take. 101f063d76aSMatthew Dillon.Pp 102d93b26d6SMatthew DillonSystem administrators must keep in mind that there are potentially many ways 103d93b26d6SMatthew Dillonto break root on a machine. The attacker may know the root password, 104d93b26d6SMatthew Dillonthe attacker 105f063d76aSMatthew Dillonmay find a bug in a root-run server and be able to break root over a network 106f063d76aSMatthew Dillonconnection to that server, or the attacker may know of a bug in an suid-root 107f063d76aSMatthew Dillonprogram that allows the attacker to break root once he has broken into a 108d93b26d6SMatthew Dillonuser's account. If an attacker has found a way to break root on a machine, 109d93b26d6SMatthew Dillon.Pa the attacker may not have a need to install a backdoor. 110d93b26d6SMatthew DillonMany of the root holes found and closed to date involve a considerable amount 111d93b26d6SMatthew Dillonof work by the hacker to cleanup after himself, so most hackers do install 112d93b26d6SMatthew Dillonbackdoors. This gives you a convienient way to detect the hacker. Making 113d93b26d6SMatthew Dillonit impossible for a hacker to install a backdoor may actually be detrimental 114d93b26d6SMatthew Dillonto your security because it will not close off the hole the hacker found to 115d93b26d6SMatthew Dillonbreak in in the first place. 116f063d76aSMatthew Dillon.Pp 117d93b26d6SMatthew DillonSecurity remedies should always be implemented with a multi-layered 118568e4cbbSGuy Helmer.Sq onion peel 119f063d76aSMatthew Dillonapproach and can be categorized as follows: 120f063d76aSMatthew Dillon.Bl -enum -offset indent 121f063d76aSMatthew Dillon.It 122f063d76aSMatthew DillonSecuring root and staff accounts 123f063d76aSMatthew Dillon.It 124f063d76aSMatthew DillonSecuring root - root-run servers and suid/sgid binaries 125f063d76aSMatthew Dillon.It 126f063d76aSMatthew DillonSecuring user accounts 127f063d76aSMatthew Dillon.It 128f063d76aSMatthew DillonSecuring the password file 129f063d76aSMatthew Dillon.It 130f063d76aSMatthew DillonSecuring the kernel core, raw devices, and filesystems 131f063d76aSMatthew Dillon.It 132d93b26d6SMatthew DillonQuick detection of inappropriate changes made to the system 133f063d76aSMatthew Dillon.It 134f063d76aSMatthew DillonParanoia 135f063d76aSMatthew Dillon.El 136f063d76aSMatthew Dillon.Sh SECURING THE ROOT ACCOUNT AND SECURING STAFF ACCOUNTS 137f063d76aSMatthew Dillon.Pp 138f063d76aSMatthew DillonDon't bother securing staff accounts if you haven't secured the root 139f063d76aSMatthew Dillonaccount. Most systems have a password assigned to the root account. The 140568e4cbbSGuy Helmerfirst thing you do is assume that the password is 141568e4cbbSGuy Helmer.Sq always 142d93b26d6SMatthew Dilloncompromised. This does not mean that you should remove the password. The 143d93b26d6SMatthew Dillonpassword is almost always necessary for console access to the machine. 144d93b26d6SMatthew DillonWhat it does mean is that you should not make it possible to use the password 145d93b26d6SMatthew Dillonoutside of the console or possibly even with a 146d93b26d6SMatthew Dillon.Xr su 1 147d93b26d6SMatthew Dilloncommand. 148d93b26d6SMatthew DillonFor example, make sure that your pty's are specified as being unsecure 149d93b26d6SMatthew Dillonin the 150568e4cbbSGuy Helmer.Sq Pa /etc/ttys 151d93b26d6SMatthew Dillonfile 152d93b26d6SMatthew Dillonso that direct root logins via telnet or rlogin are disallowed. If using 153d93b26d6SMatthew Dillonother login services such as sshd, make sure that direct root logins are 154d93b26d6SMatthew Dillondisabled there as well. Consider every access method - services such as 155d93b26d6SMatthew Dillonftp often fall through the cracks. Direct root logins should only be allowed 156d93b26d6SMatthew Dillonvia the system console. 157f063d76aSMatthew Dillon.Pp 1587626ae52SMatthew DillonOf course, as a sysadmin you have to be able to get to root, so we open up 159f063d76aSMatthew Dillona few holes. But we make sure these holes require additional password 160f063d76aSMatthew Dillonverification to operate. One way to make root accessible is to add appropriate 161568e4cbbSGuy Helmerstaff accounts to the wheel group 162568e4cbbSGuy Helmer.Pq in Pa /etc/group . 163568e4cbbSGuy HelmerThe staff members placed 164568e4cbbSGuy Helmerin the wheel group are allowed to 165568e4cbbSGuy Helmer.Sq su 166568e4cbbSGuy Helmerto root. You should never give staff 167d93b26d6SMatthew Dillonmembers native wheel access by putting the min the wheel group in their 168d93b26d6SMatthew Dillonpassword entry. Staff accounts should be placed in a 169568e4cbbSGuy Helmer.Sq staff 170d93b26d6SMatthew Dillongroup, and then added to the wheel group via the 171d93b26d6SMatthew Dillon.Sq Pa /etc/group 172d93b26d6SMatthew Dillonfile. Only those staff members who actually need to have root access 173d93b26d6SMatthew Dillonshould be placed in the wheel group. It is also possible, when using an 174d93b26d6SMatthew Dillonauthentication method such as kerberos, to use kerberos's 175d93b26d6SMatthew Dillon.Sq Pa .k5login 176d93b26d6SMatthew Dillonfile in the root account to allow a 177d93b26d6SMatthew Dillon.Xr ksu 1 178d93b26d6SMatthew Dillonto root without having to place anyone at all in the wheel group. This 179d93b26d6SMatthew Dillonmay be the better solution since the wheel mechanism still allows an 180d93b26d6SMatthew Dillonintruder to break root if the intruder has gotten hold of your password 181d93b26d6SMatthew Dillonfile and can break into a staff account. While having the wheel mechanism 182d93b26d6SMatthew Dillonis better then having nothing at all, it isn't necessarily the safest 183d93b26d6SMatthew Dillonoption. 184f063d76aSMatthew Dillon.Pp 185f063d76aSMatthew DillonAn indirect way to secure the root account is to secure your staff accounts 186f063d76aSMatthew Dillonby using an alternative login access method and *'ing out the crypted password 1876ac7e896SDavid E. O'Brienfor the staff accounts. This way an intruder may be able to steal the password 188f063d76aSMatthew Dillonfile but will not be able to break into any staff accounts (or, indirectly, 189f063d76aSMatthew Dillonroot, even if root has a crypted password associated with it). Staff members 190f063d76aSMatthew Dillonget into their staff accounts through a secure login mechanism such as 191568e4cbbSGuy Helmer.Xr kerberos 1 192568e4cbbSGuy Helmeror 193568e4cbbSGuy Helmer.Xr ssh 1 194568e4cbbSGuy Helmer.Po 195568e4cbbSGuy Helmersee 196568e4cbbSGuy Helmer.Pa /usr/ports/security/ssh 197568e4cbbSGuy Helmer.Pc 198568e4cbbSGuy Helmerusing a private/public 199f063d76aSMatthew Dillonkey pair. When you use something like kerberos you generally must secure 200f063d76aSMatthew Dillonthe machines which run the kerberos servers and your desktop workstation. 201f063d76aSMatthew DillonWhen you use a public/private key pair with ssh, you must generally secure 202568e4cbbSGuy Helmerthe machine you are logging in FROM 203568e4cbbSGuy Helmer.Pq typically your workstation , 204568e4cbbSGuy Helmerbut you can 205f063d76aSMatthew Dillonalso add an additional layer of protection to the key pair by password 206568e4cbbSGuy Helmerprotecting the keypair when you create it with 207568e4cbbSGuy Helmer.Xr ssh-keygen 1 . 208568e4cbbSGuy HelmerBeing able 2096ac7e896SDavid E. O'Briento *-out the passwords for staff accounts also guarantees that staff members 210f063d76aSMatthew Dilloncan only login through secure access methods that you have setup. You can 211f063d76aSMatthew Dillonthus force all staff members to use secure, encrypted connections for 2126ac7e896SDavid E. O'Brienall their sessions which closes an important hole used by many intruders: That 213f063d76aSMatthew Dillonof sniffing the network from an unrelated, less secure machine. 214f063d76aSMatthew Dillon.Pp 215f063d76aSMatthew DillonThe more indirect security mechanisms also assume that you are logging in 216f063d76aSMatthew Dillonfrom a more restrictive server to a less restrictive server. For example, 217f063d76aSMatthew Dillonif your main box is running all sorts of servers, your workstation shouldn't 218f063d76aSMatthew Dillonbe running any. In order for your workstation to be reasonably secure 219f063d76aSMatthew Dillonyou should run as few servers as possible, up to and including no servers 220f063d76aSMatthew Dillonat all, and you should run a password-protected screen blanker. 221f063d76aSMatthew DillonOf course, given physical access to 222f063d76aSMatthew Dillona workstation an attacker can break any sort of security you put on it. 223f063d76aSMatthew DillonThis is definitely a problem that you should consider but you should also 2246ac7e896SDavid E. O'Brienconsider the fact that the vast majority of break-ins occur remotely, over 2257626ae52SMatthew Dillona network, from people who do not have physical access to your workstation or 226f063d76aSMatthew Dillonservers. 227f063d76aSMatthew Dillon.Pp 228f063d76aSMatthew DillonUsing something like kerberos also gives you the ability to disable or 229f063d76aSMatthew Dillonchange the password for a staff account in one place and have it immediately 230f063d76aSMatthew Dilloneffect all the machine the staff member may have an account on. If a staff 231f063d76aSMatthew Dillonmember's account gets compromised, the ability to instantly change his 232f063d76aSMatthew Dillonpassword on all machines should not be underrated. With discrete passwords, 233f063d76aSMatthew Dillonchanging a password on N machines can be a mess. You can also impose 234f063d76aSMatthew Dillonre-passwording restrictions with kerberos: not only can a kerberos ticket 235f063d76aSMatthew Dillonbe made to timeout after a while, but the kerberos system can require that 236568e4cbbSGuy Helmerthe user choose a new password after a certain period of time 237568e4cbbSGuy Helmer.Pq say, once a month . 238f063d76aSMatthew Dillon.Sh SECURING ROOT - ROOT-RUN SERVERS AND SUID/SGID BINARIES 239f063d76aSMatthew Dillon.Pp 2407626ae52SMatthew DillonThe prudent sysadmin only runs the servers he needs to, no more, no less. Be 241f063d76aSMatthew Dillonaware that third party servers are often the most bug-prone. For example, 242f063d76aSMatthew Dillonrunning an old version of imapd or popper is like giving a universal root 243f063d76aSMatthew Dillonticket out to the entire world. Never run a server that you have not checked 244f063d76aSMatthew Dillonout carefully. Many servers do not need to be run as root. For example, 245568e4cbbSGuy Helmerthe ntalk, comsat, and finger daemons can be run in special user 246568e4cbbSGuy Helmer.Sq sandboxes . 2476ac7e896SDavid E. O'BrienA sandbox isn't perfect unless you go to a large amount of trouble, but the 248f063d76aSMatthew Dillononion approach to security still stands: If someone is able to break in 249f063d76aSMatthew Dillonthrough a server running in a sandbox, they still have to break out of the 250f063d76aSMatthew Dillonsandbox. The more layers the attacker must break through, the lower the 251f063d76aSMatthew Dillonlikelihood of his success. Root holes have historically been found in 252f063d76aSMatthew Dillonvirtually every server ever run as root, including basic system servers. 253f063d76aSMatthew DillonIf you are running a machine through which people only login via sshd and 254f063d76aSMatthew Dillonnever login via telnetd or rshd or rlogind, then turn off those services! 255f063d76aSMatthew Dillon.Pp 256f6f8f44dSAlexey Zelkin.Fx 257568e4cbbSGuy Helmernow defaults to running ntalkd, comsat, and finger in a sandbox. 258f063d76aSMatthew DillonAnother program which may be a candidate for running in a sandbox is 259568e4cbbSGuy Helmer.Xr named 8 . 260568e4cbbSGuy HelmerThe default rc.conf includes the arguments necessary to run 261f063d76aSMatthew Dillonnamed in a sandbox in a commented-out form. Depending on whether you 262f063d76aSMatthew Dillonare installing a new system or upgrading an existing system, the special 263f063d76aSMatthew Dillonuser accounts used by these sandboxes may not be installed. The prudent 2647626ae52SMatthew Dillonsysadmin would research and implement sandboxes for servers whenever possible. 265f063d76aSMatthew Dillon.Pp 266f063d76aSMatthew DillonThere are a number of other servers that typically do not run in sandboxes: 267f063d76aSMatthew Dillonsendmail, popper, imapd, ftpd, and others. There are alternatives to 268f063d76aSMatthew Dillonsome of these, but installing them may require more work then you are willing 269568e4cbbSGuy Helmerto put 270568e4cbbSGuy Helmer.Pq the convenience factor strikes again . 271568e4cbbSGuy HelmerYou may have to run these 2726ac7e896SDavid E. O'Brienservers as root and rely on other mechanisms to detect break-ins that might 273f063d76aSMatthew Dillonoccur through them. 274f063d76aSMatthew Dillon.Pp 275f063d76aSMatthew DillonThe other big potential root hole in a system are the suid-root and sgid 276f063d76aSMatthew Dillonbinaries installed on the system. Most of these binaries, such as rlogin, 277568e4cbbSGuy Helmerreside in 278568e4cbbSGuy Helmer.Pa /bin , 279568e4cbbSGuy Helmer.Pa /sbin , 280568e4cbbSGuy Helmer.Pa /usr/bin , 281568e4cbbSGuy Helmeror 282568e4cbbSGuy Helmer.Pa /usr/sbin . 283568e4cbbSGuy HelmerWhile nothing is 100% safe, 284f063d76aSMatthew Dillonthe system-default suid and sgid binaries can be considered reasonably safe. 2856ac7e896SDavid E. O'BrienStill, root holes are occasionally found in these binaries. A root hole 286568e4cbbSGuy Helmerwas found in Xlib in 1998 that made xterm 287568e4cbbSGuy Helmer.Pq which is typically suid 288568e4cbbSGuy Helmervulnerable. 2897626ae52SMatthew DillonIt is better to be safe then sorry and the prudent sysadmin will restrict suid 290f063d76aSMatthew Dillonbinaries that only staff should run to a special group that only staff can 291568e4cbbSGuy Helmeraccess, and get rid of 292568e4cbbSGuy Helmer.Pq chmod 000 293568e4cbbSGuy Helmerany suid binaries that nobody uses. A 294f063d76aSMatthew Dillonserver with no display generally does not need an xterm binary. Sgid binaries 2956ac7e896SDavid E. O'Briencan be almost as dangerous. If an intruder can break an sgid-kmem binary the 296568e4cbbSGuy Helmerintruder might be able to read 297568e4cbbSGuy Helmer.Pa /dev/kmem 298568e4cbbSGuy Helmerand thus read the crypted password 299d93b26d6SMatthew Dillonfile, potentially compromising any passworded account. Alternatively an 300d93b26d6SMatthew Dillonintruder who breaks group kmem can monitor keystrokes sent through pty's, 301d93b26d6SMatthew Dillonincluding pty's used by users who login through secure methods. An intruder 302d93b26d6SMatthew Dillonthat breaks the tty group can write to almost any user's tty. If a user 303d93b26d6SMatthew Dillonis running a terminal 304d93b26d6SMatthew Dillonprogram or emulator with a keyboard-simulation feature, the intruder can 305d93b26d6SMatthew Dillonpotentially 306f063d76aSMatthew Dillongenerate a data stream that causes the user's terminal to echo a command, which 307f063d76aSMatthew Dillonis then run as that user. 308f063d76aSMatthew Dillon.Sh SECURING USER ACCOUNTS 309f063d76aSMatthew Dillon.Pp 310f063d76aSMatthew DillonUser accounts are usually the most difficult to secure. While you can impose 3116ac7e896SDavid E. O'BrienDraconian access restrictions on your staff and *-out their passwords, you 312f063d76aSMatthew Dillonmay not be able to do so with any general user accounts you might have. If 313f063d76aSMatthew Dillonyou do have sufficient control then you may win out and be able to secure the 314f063d76aSMatthew Dillonuser accounts properly. If not, you simply have to be more vigilant in your 315f063d76aSMatthew Dillonmonitoring of those accounts. Use of ssh and kerberos for user accounts is 316d93b26d6SMatthew Dillonmore problematic due to the extra administration and technical support 317d93b26d6SMatthew Dillonrequired, but still a very good solution compared to a crypted password 318d93b26d6SMatthew Dillonfile. 319f063d76aSMatthew Dillon.Sh SECURING THE PASSWORD FILE 320f063d76aSMatthew Dillon.Pp 321f063d76aSMatthew DillonThe only sure fire way is to *-out as many passwords as you can and 322f063d76aSMatthew Dillonuse ssh or kerberos for access to those accounts. Even though the 323568e4cbbSGuy Helmercrypted password file 324568e4cbbSGuy Helmer.Pq Pa /etc/spwd.db 325568e4cbbSGuy Helmercan only be read by root, it may 326568e4cbbSGuy Helmerbe possible for an intruder to obtain read access to that file even if the 327f063d76aSMatthew Dillonattacker cannot obtain root-write access. 328f063d76aSMatthew Dillon.Pp 329f063d76aSMatthew DillonYour security scripts should always check for and report changes to 330568e4cbbSGuy Helmerthe password file 331568e4cbbSGuy Helmer.Po 332568e4cbbSGuy Helmersee 333568e4cbbSGuy Helmer.Sq Checking file integrity 334568e4cbbSGuy Helmerbelow 335568e4cbbSGuy Helmer.Pc . 336f063d76aSMatthew Dillon.Sh SECURING THE KERNEL CORE, RAW DEVICES, AND FILESYSTEMS 337f063d76aSMatthew Dillon.Pp 338f063d76aSMatthew DillonIf an attacker breaks root he can do just about anything, but there 339f063d76aSMatthew Dillonare certain conveniences. For example, most modern kernels have a 340568e4cbbSGuy Helmerpacket sniffing device driver built in. Under 341f6f8f44dSAlexey Zelkin.Fx 342568e4cbbSGuy Helmerit is called 343568e4cbbSGuy Helmerthe 344568e4cbbSGuy Helmer.Sq bpf 345568e4cbbSGuy Helmerdevice. An intruder will commonly attempt to run a packet sniffer 3466ac7e896SDavid E. O'Brienon a compromised machine. You do not need to give the intruder the 347f063d76aSMatthew Dilloncapability and most systems should not have the bpf device compiled in. 348f063d76aSMatthew Dillon.Pp 349568e4cbbSGuy HelmerBut even if you turn off the bpf device, 350568e4cbbSGuy Helmeryou still have 351568e4cbbSGuy Helmer.Pa /dev/mem 352568e4cbbSGuy Helmerand 353568e4cbbSGuy Helmer.Pa /dev/kmem 354568e4cbbSGuy Helmerto worry about. For that matter, 355d93b26d6SMatthew Dillonthe intruder can still write to raw disk devices. 356d93b26d6SMatthew DillonAlso, there is another kernel feature called the module loader, 357568e4cbbSGuy Helmer.Xr kldload 8 . 358568e4cbbSGuy HelmerAn enterprising intruder can use a KLD module to install 359568e4cbbSGuy Helmerhis own bpf device or other sniffing device on a running kernel. 360568e4cbbSGuy HelmerTo avoid these problems you have to run 361568e4cbbSGuy Helmerthe kernel at a higher secure level, at least securelevel 1. The securelevel 362f063d76aSMatthew Dilloncan be set with a sysctl on the kern.securelevel variable. Once you have 363f063d76aSMatthew Dillonset the securelevel to 1, write access to raw devices will be denied and 364568e4cbbSGuy Helmerspecial chflags flags, such as 365568e4cbbSGuy Helmer.Sq schg , 366568e4cbbSGuy Helmerwill be enforced. You must also ensure 367568e4cbbSGuy Helmerthat the 368568e4cbbSGuy Helmer.Sq schg 369568e4cbbSGuy Helmerflag is set on critical startup binaries, directories, and 370f063d76aSMatthew Dillonscript files - everything that gets run up to the point where the securelevel 371f063d76aSMatthew Dillonis set. This might be overdoing it, and upgrading the system is much more 372f063d76aSMatthew Dillondifficult when you operate at a higher secure level. You may compromise and 373f063d76aSMatthew Dillonrun the system at a higher secure level but not set the schg flag for every 374d93b26d6SMatthew Dillonsystem file and directory under the sun. Another possibility is to simply 375d93b26d6SMatthew Dillonmount / and /usr read-only. It should be noted that being too draconian in 376d93b26d6SMatthew Dillonwhat you attempt to protect may prevent the all-important detection of an 377d93b26d6SMatthew Dillonintrusion. 378f063d76aSMatthew Dillon.Sh CHECKING FILE INTEGRITY: BINARIES, CONFIG FILES, ETC 379f063d76aSMatthew Dillon.Pp 380f063d76aSMatthew DillonWhen it comes right down to it, you can only protect your core system 381f063d76aSMatthew Dillonconfiguration and control files so much before the convenience factor 382d93b26d6SMatthew Dillonrears its ugly head. For example, using chflags to set the schg bit 383d93b26d6SMatthew Dillonon most of the files in / and /usr is probably counterproductive because 384d93b26d6SMatthew Dillonwhile it may protect the files, it also closes a detection window. The 385d93b26d6SMatthew Dillonlast layer of your security onion is perhaps the most important - detection. 386d93b26d6SMatthew DillonThe rest of your security is pretty much useless (or, worse, presents you with 387d93b26d6SMatthew Dillona false sense of safety) if you cannot detect potential incursions. Half 388d93b26d6SMatthew Dillonthe job of the onion is to slow down the attacker rather then stop him 389d93b26d6SMatthew Dillonin order to give the detection side of the equation a chance to catch him in 390d93b26d6SMatthew Dillonthe act. 391f063d76aSMatthew Dillon.Pp 392d93b26d6SMatthew DillonThe best way to detect an incursion is to look for modified, missing, or 393d93b26d6SMatthew Dillonunexpected files. The best 394d93b26d6SMatthew Dillonway to look for modified files is from another (often centralized) 395d93b26d6SMatthew Dillonlimited-access system. 396d93b26d6SMatthew DillonWriting your security scripts on the extra-secure limited-access system 397d93b26d6SMatthew Dillonmakes them mostly invisible to potential hackers, and this is important. 398d93b26d6SMatthew DillonIn order to take maximum advantage you generally have to give the 399d93b26d6SMatthew Dillonlimited-access box significant access to the other machines in the business, 400d93b26d6SMatthew Dillonusually either by doing a read-only NFS export of the other machines to the 401d93b26d6SMatthew Dillonlimited-access box, or by setting up ssh keypairs to allow the limit-access 402d93b26d6SMatthew Dillonbox to ssh to the other machines. Except for its network traffic, NFS is 403d93b26d6SMatthew Dillonthe least visible method - allowing you to monitor the filesystems on each 404d93b26d6SMatthew Dillonclient box virtually undetected. If your 405d93b26d6SMatthew Dillonlimited-access server is connected to the client boxes through a switch, 406d93b26d6SMatthew Dillonthe NFS method is often the better choice. If your limited-access server 407d93b26d6SMatthew Dillonis connected to the client boxes through a hub or through several layers 408d93b26d6SMatthew Dillonof routing, the NFS method may be too insecure (network-wise) and using ssh 409d93b26d6SMatthew Dillonmay be the better choice even with the audit-trail tracks that ssh lays. 410d93b26d6SMatthew Dillon.Pp 411d93b26d6SMatthew DillonOnce you give a limit-access box at least read access to the client systems 412d93b26d6SMatthew Dillonit is supposed to monitor, you must write scripts to do the actual 413d93b26d6SMatthew Dillonmonitoring. Given an NFS mount, you can write scripts out of simple system 414d93b26d6SMatthew Dillonutilities such as 415d93b26d6SMatthew Dillon.Xr find 1 416d93b26d6SMatthew Dillonand 417d93b26d6SMatthew Dillon.Xr md5 1 418d93b26d6SMatthew DillonIt is best to physically md5 the client-box files boxes at least once a 419d93b26d6SMatthew Dillonday, and to test control files such as those found in /etc and /usr/local/etc 420d93b26d6SMatthew Dilloneven more often. When mismatches are found relative to the base md5 421d93b26d6SMatthew Dilloninformation the limited-access machine knows is valid, it should scream at 422d93b26d6SMatthew Dillona sysadmin to go check it out. A good security script will also check for 423d93b26d6SMatthew Dilloninappropriate suid binaries and for new or deleted files on system partitions 424d93b26d6SMatthew Dillonsuch as 425d93b26d6SMatthew Dillon.Pa / 426568e4cbbSGuy Helmerand 427568e4cbbSGuy Helmer.Pa /usr 428f063d76aSMatthew Dillon.Pp 429d93b26d6SMatthew DillonWhen using ssh rather then NFS, writing the security script is much more 430d93b26d6SMatthew Dillondifficult. You essentially have to 431d93b26d6SMatthew Dillon.Pa scp 432d93b26d6SMatthew Dillonthe scripts to the client box in order to run them, making them visible, and 433d93b26d6SMatthew Dillonfor safety you also need to scp the binaries (such as find) that those scripts 434d93b26d6SMatthew Dillonuse. The ssh daemon on the client box may already be compromised. All in all, 435d93b26d6SMatthew Dillonusing ssh may be necessary when running over unsecure links, but it's also a 436d93b26d6SMatthew Dillonlot harder to deal with. 437f063d76aSMatthew Dillon.Pp 438f063d76aSMatthew DillonA good security script will also check for changes to user and staff members 439f063d76aSMatthew Dillonaccess configuration files: .rhosts, .shosts, .ssh/authorized_keys, and 440568e4cbbSGuy Helmerso forth... files that might fall outside the purview of the MD5 check. 441f063d76aSMatthew Dillon.Pp 442d93b26d6SMatthew DillonIf you have a huge amount of user disk space it may take too long to run 443d93b26d6SMatthew Dillonthrough every file on those partitions. In this case, setting mount 444d93b26d6SMatthew Dillonflags to disallow suid binaries and devices on those partitions is a good 445d93b26d6SMatthew Dillonidea. The 446568e4cbbSGuy Helmer.Sq nodev 447d93b26d6SMatthew Dillonand 448d93b26d6SMatthew Dillon.Sq nosuid 449d93b26d6SMatthew Dillonoptions 450d93b26d6SMatthew Dillon.Po 451d93b26d6SMatthew Dillonsee 452d93b26d6SMatthew Dillon.Xr mount 8 453568e4cbbSGuy Helmer.Pc 454d93b26d6SMatthew Dillonare what you want to look into. I would scan them anyway at least once a 455d93b26d6SMatthew Dillonweek, since the object of this layer is to detect a break-in whether or 456d93b26d6SMatthew Dillonnot the breakin is effective. 457f063d76aSMatthew Dillon.Pp 458568e4cbbSGuy HelmerProcess accounting 459568e4cbbSGuy Helmer.Po 460568e4cbbSGuy Helmersee 461f437b38cSChris Costello.Xr accton 8 462568e4cbbSGuy Helmer.Pc 463568e4cbbSGuy Helmeris a relatively low-overhead feature of 4646ac7e896SDavid E. O'Brienthe operating system which I recommend using as a post-break-in evaluation 4656ac7e896SDavid E. O'Brienmechanism. It is especially useful in tracking down how an intruder has 466d93b26d6SMatthew Dillonactually broken into a system, assuming the file is still intact after 4676ac7e896SDavid E. O'Brienthe break-in occurs. 468f063d76aSMatthew Dillon.Pp 469f063d76aSMatthew DillonFinally, security scripts should process the log files and the logs themselves 470d93b26d6SMatthew Dillonshould be generated in as secure a manner as possible - remote syslog can be 4716ac7e896SDavid E. O'Brienvery useful. An intruder tries to cover his tracks, and log files are critical 472d93b26d6SMatthew Dillonto the sysadmin trying to track down the time and method of the initial 473d93b26d6SMatthew Dillonbreak-in. One way to keep a permanent record of the log files is to run 474d93b26d6SMatthew Dillonthe system console to a serial port and collect the information on a 475d93b26d6SMatthew Dilloncontinuing basis through a secure machine monitoring the consoles. 476f063d76aSMatthew Dillon.Sh PARANOIA 477f063d76aSMatthew Dillon.Pp 4787626ae52SMatthew DillonA little paranoia never hurts. As a rule, a sysadmin can add any number 479f063d76aSMatthew Dillonof security features as long as they do not effect convenience, and 480f063d76aSMatthew Dilloncan add security features that do effect convenience with some added 481d93b26d6SMatthew Dillonthought. Even more importantly, a security administrator should mix it up 482d93b26d6SMatthew Dillona bit - if you use recommendations such as those given by this manual 483d93b26d6SMatthew Dillonpage verbatim, you give away your methodologies to the prospective 484d93b26d6SMatthew Dillonhacker who also has access to this manual page. 485f063d76aSMatthew Dillon.Sh SPECIAL SECTION ON D.O.S. ATTACKS 486f063d76aSMatthew Dillon.Pp 4876ac7e896SDavid E. O'BrienThis section covers Denial of Service attacks. A DOS attack is typically 488f063d76aSMatthew Dillona packet attack. While there isn't much you can do about modern spoofed 489f063d76aSMatthew Dillonpacket attacks that saturate your network, you can generally limit the damage 490f063d76aSMatthew Dillonby ensuring that the attacks cannot take down your servers. 491f063d76aSMatthew Dillon.Bl -enum -offset indent 492f063d76aSMatthew Dillon.It 493f063d76aSMatthew DillonLimiting server forks 494f063d76aSMatthew Dillon.It 495f063d76aSMatthew DillonLimiting springboard attacks (ICMP response attacks, ping broadcast, etc...) 496f063d76aSMatthew Dillon.It 497f063d76aSMatthew DillonKernel Route Cache 498f063d76aSMatthew Dillon.El 499f063d76aSMatthew Dillon.Pp 500f063d76aSMatthew DillonA common DOS attack is against a forking server that attempts to cause the 5016ac7e896SDavid E. O'Brienserver to eat processes, file descriptors, and memory until the machine 502568e4cbbSGuy Helmerdies. Inetd 503568e4cbbSGuy Helmer.Po 504568e4cbbSGuy Helmersee 505568e4cbbSGuy Helmer.Xr inetd 8 506568e4cbbSGuy Helmer.Pc 507568e4cbbSGuy Helmerhas several options to limit this sort of attack. 508f063d76aSMatthew DillonIt should be noted that while it is possible to prevent a machine from going 509f063d76aSMatthew Dillondown it is not generally possible to prevent a service from being disrupted 510f063d76aSMatthew Dillonby the attack. Read the inetd manual page carefully and pay specific attention 511568e4cbbSGuy Helmerto the 512568e4cbbSGuy Helmer.Fl c , 513568e4cbbSGuy Helmer.Fl C , 514568e4cbbSGuy Helmerand 515568e4cbbSGuy Helmer.Fl R 516568e4cbbSGuy Helmeroptions. Note that spoofed-IP attacks will circumvent 517568e4cbbSGuy Helmerthe 518568e4cbbSGuy Helmer.Fl C 519568e4cbbSGuy Helmeroption to inetd, so typically a combination of options must be used. 520f063d76aSMatthew DillonSome standalone servers have self-fork-limitation parameters. 521f063d76aSMatthew Dillon.Pp 522568e4cbbSGuy HelmerSendmail has its 523568e4cbbSGuy Helmer.Fl OMaxDaemonChildren 524568e4cbbSGuy Helmeroption which tends to work much 525f6c24291SGuy Helmerbetter than trying to use sendmail's load limiting options due to the 526568e4cbbSGuy Helmerload lag. You should specify a 527568e4cbbSGuy Helmer.Cm MaxDaemonChildren 528568e4cbbSGuy Helmerparameter when you start 529f063d76aSMatthew Dillonsendmail high enough to handle your expected load but no so high that the 530f063d76aSMatthew Dilloncomputer cannot handle that number of sendmails without falling on its face. 531568e4cbbSGuy HelmerIt is also prudent to run sendmail in queued mode 532568e4cbbSGuy Helmer.Pq Fl ODeliveryMode=queued 533568e4cbbSGuy Helmerand to run the daemon 534568e4cbbSGuy Helmer.Pq Cm sendmail -bd 535568e4cbbSGuy Helmerseparate from the queue-runs 536568e4cbbSGuy Helmer.Pq Cm sendmail -q15m . 537568e4cbbSGuy HelmerIf you still want realtime delivery you can run the queue 538568e4cbbSGuy Helmerat a much lower interval, such as 539568e4cbbSGuy Helmer.Fl q1m , 540568e4cbbSGuy Helmerbut be sure to specify a reasonable 541568e4cbbSGuy Helmer.Cm MaxDaemonChildren 542568e4cbbSGuy Helmeroption for that sendmail to prevent cascade failures. 543f063d76aSMatthew Dillon.Pp 544f063d76aSMatthew DillonSyslogd can be attacked directly and it is strongly recommended that you use 545568e4cbbSGuy Helmerthe 546568e4cbbSGuy Helmer.Fl s 547568e4cbbSGuy Helmeroption whenever possible, and the 548568e4cbbSGuy Helmer.Fl a 549568e4cbbSGuy Helmeroption otherwise. 550f063d76aSMatthew Dillon.Pp 551f063d76aSMatthew DillonYou should also be fairly careful 552f063d76aSMatthew Dillonwith connect-back services such as tcpwrapper's reverse-identd, which can 553f063d76aSMatthew Dillonbe attacked directly. You generally do not want to use the reverse-ident 554f063d76aSMatthew Dillonfeature of tcpwrappers for this reason. 555f063d76aSMatthew Dillon.Pp 556f063d76aSMatthew DillonIt is a very good idea to protect internal services from external access 557f063d76aSMatthew Dillonby firewalling them off at your border routers. The idea here is to prevent 558f063d76aSMatthew Dillonsaturation attacks from outside your LAN, not so much to protect internal 55985752545SGuy Helmerservices from network-based root compromise. Always configure an exclusive 560568e4cbbSGuy Helmerfirewall, i.e. 561568e4cbbSGuy Helmer.So 562568e4cbbSGuy Helmerfirewall everything *except* ports A, B, C, D, and M-Z 563568e4cbbSGuy Helmer.Sc . 564568e4cbbSGuy HelmerThis 565f063d76aSMatthew Dillonway you can firewall off all of your low ports except for certain specific 566568e4cbbSGuy Helmerservices such as named 567568e4cbbSGuy Helmer.Pq if you are primary for a zone , 568568e4cbbSGuy Helmerntalkd, sendmail, 569f063d76aSMatthew Dillonand other internet-accessible services. 570f063d76aSMatthew DillonIf you try to configure the firewall the other 571f063d76aSMatthew Dillonway - as an inclusive or permissive firewall, there is a good chance that you 572568e4cbbSGuy Helmerwill forget to 573568e4cbbSGuy Helmer.Sq close 574568e4cbbSGuy Helmera couple of services or that you will add a new internal 575f063d76aSMatthew Dillonservice and forget to update the firewall. You can still open up the 576f063d76aSMatthew Dillonhigh-numbered port range on the firewall to allow permissive-like operation 577568e4cbbSGuy Helmerwithout compromising your low ports. Also take note that 578f6f8f44dSAlexey Zelkin.Fx 579568e4cbbSGuy Helmerallows you to 580f063d76aSMatthew Dilloncontrol the range of port numbers used for dynamic binding via the various 581568e4cbbSGuy Helmernet.inet.ip.portrange sysctl's 582568e4cbbSGuy Helmer.Pq sysctl -a \&| fgrep portrange , 583568e4cbbSGuy Helmerwhich can also 584f063d76aSMatthew Dillonease the complexity of your firewall's configuration. I usually use a normal 585f063d76aSMatthew Dillonfirst/last range of 4000 to 5000, and a hiport range of 49152 to 65535, then 586568e4cbbSGuy Helmerblock everything under 4000 off in my firewall 587568e4cbbSGuy Helmer.Po 588568e4cbbSGuy Helmerexcept for certain specific 589568e4cbbSGuy Helmerinternet-accessible ports, of course 590568e4cbbSGuy Helmer.Pc . 591f063d76aSMatthew Dillon.Pp 592f063d76aSMatthew DillonAnother common DOS attack is called a springboard attack - to attack a server 593f063d76aSMatthew Dillonin a manner that causes the server to generate responses which then overload 594f063d76aSMatthew Dillonthe server, the local network, or some other machine. The most common attack 595568e4cbbSGuy Helmerof this nature is the ICMP PING BROADCAST attack. The attacker spoofs ping 596f063d76aSMatthew Dillonpackets sent to your LAN's broadcast address with the source IP address set 597f063d76aSMatthew Dillonto the actual machine they wish to attack. If your border routers are not 598f063d76aSMatthew Dillonconfigured to stomp on ping's to broadcast addresses, your LAN winds up 599f063d76aSMatthew Dillongenerating sufficient responses to the spoofed source address to saturate the 600f063d76aSMatthew Dillonvictim, especially when the attacker uses the same trick on several dozen 601f063d76aSMatthew Dillonbroadcast addresses over several dozen different networks at once. Broadcast 602f063d76aSMatthew Dillonattacks of over a hundred and twenty megabits have been measured. A second 603f063d76aSMatthew Dilloncommon springboard attack is against the ICMP error reporting system. By 604f063d76aSMatthew Dillonconstructing packets that generate ICMP error responses, an attacker can 605f063d76aSMatthew Dillonsaturate a server's incoming network and cause the server to saturate its 606f063d76aSMatthew Dillonoutgoing network with ICMP responses. This type of attack can also crash the 607f063d76aSMatthew Dillonserver by running it out of mbuf's, especially if the server cannot drain the 608568e4cbbSGuy HelmerICMP responses it generates fast enough. The 609f6f8f44dSAlexey Zelkin.Fx 610568e4cbbSGuy Helmerkernel has a new kernel 611f063d76aSMatthew Dilloncompile option called ICMP_BANDLIM which limits the effectiveness of these 612f063d76aSMatthew Dillonsorts of attacks. The last major class of springboard attacks is related to 613f063d76aSMatthew Dilloncertain internal inetd services such as the udp echo service. An attacker 614f063d76aSMatthew Dillonsimply spoofs a UDP packet with the source address being server A's echo port, 615f063d76aSMatthew Dillonand the destination address being server B's echo port, where server A and B 616f063d76aSMatthew Dillonare both on your LAN. The two servers then bounce this one packet back and 617f063d76aSMatthew Dillonforth between each other. The attacker can overload both servers and their 618f063d76aSMatthew DillonLANs simply by injecting a few packets in this manner. Similar problems 6197626ae52SMatthew Dillonexist with the internal chargen port. A competent sysadmin will turn off all 620f063d76aSMatthew Dillonof these inetd-internal test services. 621f063d76aSMatthew Dillon.Pp 622f063d76aSMatthew DillonSpoofed packet attacks may also be used to overload the kernel route cache. 623f063d76aSMatthew DillonRefer to the net.inet.ip.rtexpire, rtminexpire, and rtmaxcache sysctl 624f063d76aSMatthew Dillonparameters. A spoofed packet attack that uses a random source IP will cause 625f063d76aSMatthew Dillonthe kernel to generate a temporary cached route in the route table, viewable 626568e4cbbSGuy Helmerwith 627568e4cbbSGuy Helmer.Sq netstat -rna \&| fgrep W3 . 628568e4cbbSGuy HelmerThese routes typically timeout in 1600 629f063d76aSMatthew Dillonseconds or so. If the kernel detects that the cached route table has gotten 630f063d76aSMatthew Dillontoo big it will dynamically reduce the rtexpire but will never decrease it to 631f063d76aSMatthew Dillonless then rtminexpire. There are two problems: (1) The kernel does not react 632f063d76aSMatthew Dillonquickly enough when a lightly loaded server is suddenly attacked, and (2) The 633f063d76aSMatthew Dillonrtminexpire is not low enough for the kernel to survive a sustained attack. 634f063d76aSMatthew DillonIf your servers are connected to the internet via a T3 or better it may be 63585752545SGuy Helmerprudent to manually override both rtexpire and rtminexpire via 63685752545SGuy Helmer.Xr sysctl 8 . 637568e4cbbSGuy HelmerNever set either parameter to zero 638568e4cbbSGuy Helmer.Pq unless you want to crash the machine :-) . 639f063d76aSMatthew DillonSetting both parameters to 2 seconds should be sufficient to protect the route 640f063d76aSMatthew Dillontable from attack. 641d93b26d6SMatthew Dillon.Sh ACCESS ISSUES WITH KERBEROS AND SSH 642d93b26d6SMatthew Dillon.Pp 643d93b26d6SMatthew DillonThere are a few issues with both kerberos and ssh that need to be addressed 644d93b26d6SMatthew Dillonif you intend to use them. Kerberos V is an excellent authentication 645d93b26d6SMatthew Dillonprotocol but the kerberized telnet and rlogin suck rocks. There are bugs that 646d93b26d6SMatthew Dillonmake them unsuitable for dealing with binary streams. Also, by default 647d93b26d6SMatthew Dillonkerberos does not encrypt a session unless you use the 648d93b26d6SMatthew Dillon.Fl x 649d93b26d6SMatthew Dillonoption. Ssh encrypts everything by default. 650d93b26d6SMatthew Dillon.Pp 651d93b26d6SMatthew DillonSsh works quite well in every respect except that it forwards encryption keys 652d93b26d6SMatthew Dillonby default. What this means is that if you have a secure workstation holding 653d93b26d6SMatthew Dillonkeys that give you access to the rest of the system, and you ssh to an 654d93b26d6SMatthew Dillonunsecure machine, your keys becomes exposed. The actual keys themselves are 655d93b26d6SMatthew Dillonnot exposed, but ssh installs a forwarding port for the duration of your 656d93b26d6SMatthew Dillonlogin and if a hacker has broken root on the unsecure machine he can utilize 657d93b26d6SMatthew Dillonthat port to use your keys to gain access to any other machine that your 658d93b26d6SMatthew Dillonkeys unlock. 659d93b26d6SMatthew Dillon.Pp 660d93b26d6SMatthew DillonWe recommend that you use ssh in combination with kerberos whenever possible 661d93b26d6SMatthew Dillonfor staff logins. Ssh can be compiled with kerberos support. This reduces 662d93b26d6SMatthew Dillonyour reliance on potentially exposable ssh keys while at the same time 663d93b26d6SMatthew Dillonprotecting passwords via kerberos. Ssh keys 664d93b26d6SMatthew Dillonshould only be used for automated tasks from secure machines (something 665d93b26d6SMatthew Dillonthat kerberos is unsuited to). We also recommend that you either turn off 666d93b26d6SMatthew Dillonkey-forwarding in the ssh configuration, or that you make use of the 667d93b26d6SMatthew Dillon.Pa "from=IP/DOMAIN" 668d93b26d6SMatthew Dillonoption that ssh allows in its 669d93b26d6SMatthew Dillon.Pa authorized_keys 670d93b26d6SMatthew Dillonfile to make the key only useable to entities logging in from specific 671d93b26d6SMatthew Dillonmachines. 672f063d76aSMatthew Dillon 673f063d76aSMatthew Dillon.Sh SEE ALSO 674f063d76aSMatthew Dillon.Pp 675f063d76aSMatthew Dillon.Xr accton 1 , 676f063d76aSMatthew Dillon.Xr chflags 1 , 677f063d76aSMatthew Dillon.Xr find 1 , 6786ac7e896SDavid E. O'Brien.Xr kerberos 1 , 679f063d76aSMatthew Dillon.Xr md5 1 , 680f6f8f44dSAlexey Zelkin.Xr netstat 1 , 6816ac7e896SDavid E. O'Brien.Xr syslogd 1 , 6826ac7e896SDavid E. O'Brien.Xr xdm 1 , 683d93b26d6SMatthew Dillon.Xr ttys 5 , 684d93b26d6SMatthew Dillon.Xr group 5 , 685d93b26d6SMatthew Dillon.Xr vipw 8 , 686d93b26d6SMatthew Dillon.Xr init 8 , 687f063d76aSMatthew Dillon.Xr sysctl 8 688f6f8f44dSAlexey Zelkin 689f6f8f44dSAlexey ZelkinThe following are part of security ports collection: 690f6f8f44dSAlexey Zelkin 691f6f8f44dSAlexey Zelkin.Xr ssh 1 , 692f6f8f44dSAlexey Zelkin.Xr sshd 1 693f063d76aSMatthew Dillon.Sh HISTORY 694f063d76aSMatthew DillonThe 695f063d76aSMatthew Dillon.Nm 696568e4cbbSGuy Helmermanual page was originally written by 697568e4cbbSGuy Helmer.An Matthew Dillon 698568e4cbbSGuy Helmerand first appeared 699568e4cbbSGuy Helmerin 70085752545SGuy Helmer.Fx 3.1 , 701568e4cbbSGuy HelmerDecember 1998. 702