1 .\" Copyright (C) 1998 Matthew Dillon. All rights reserved.
2 .\" Copyright (c) 2019 The FreeBSD Foundation, Inc.
4 .\" Parts of this documentation were written by
5 .\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
6 .\" from the FreeBSD Foundation.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
17 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .Nd introduction to security under FreeBSD
38 Security is a function that begins and ends with the system administrator.
41 multi-user systems have some inherent security, the job of building and
42 maintaining additional security mechanisms to keep users
45 one of the single largest undertakings of the sysadmin.
47 only as secure as you make them, and security concerns are ever competing
48 with the human necessity for convenience.
51 in general, are capable of running a huge number of simultaneous processes
52 and many of these processes operate as servers \(em meaning that external
53 entities can connect and talk to them.
54 As yesterday's mini-computers and mainframes
55 become today's desktops, and as computers become networked and internetworked,
56 security becomes an ever bigger issue.
58 Security is best implemented through a layered onion approach.
60 what you want to do is to create as many layers of security as are convenient
61 and then carefully monitor the system for intrusions.
63 System security also pertains to dealing with various forms of attacks,
64 including attacks that attempt to crash or otherwise make a system unusable
65 but do not attempt to break root.
66 Security concerns can be split up into
68 .Bl -enum -offset indent
70 Denial of Service attacks (DoS)
72 User account compromises
74 Root compromise through accessible servers
76 Root compromise via user accounts
81 A denial of service attack is an action that deprives the machine of needed
83 Typically, DoS attacks are brute-force mechanisms that attempt
84 to crash or otherwise make a machine unusable by overwhelming its servers or
86 Some DoS attacks try to take advantages of bugs in the
87 networking stack to crash a machine with a single packet.
89 only be fixed by applying a bug fix to the kernel.
90 Attacks on servers can
91 often be fixed by properly specifying options to limit the load the servers
92 incur on the system under adverse conditions.
93 Brute-force network attacks are harder to deal with.
94 A spoofed-packet attack, for example, is
95 nearly impossible to stop short of cutting your system off from the Internet.
96 It may not be able to take your machine down, but it can fill up your Internet
99 A user account compromise is even more common than a DoS attack.
101 sysadmins still run standard
107 servers on their machines.
108 These servers, by default, do not operate over encrypted
110 The result is that if you have any moderate-sized user base,
111 one or more of your users logging into your system from a remote location
112 (which is the most common and convenient way to log in to a system)
113 will have his or her password sniffed.
114 The attentive system administrator will analyze
115 his remote access logs looking for suspicious source addresses
116 even for successful logins.
118 One must always assume that once an attacker has access to a user account,
119 the attacker can break root.
120 However, the reality is that in a well secured
121 and maintained system, access to a user account does not necessarily give the
122 attacker access to root.
123 The distinction is important because without access
124 to root the attacker cannot generally hide his tracks and may, at best, be
125 able to do nothing more than mess with the user's files or crash the machine.
126 User account compromises are very common because users tend not to take the
127 precautions that sysadmins take.
129 System administrators must keep in mind that there are potentially many ways
130 to break root on a machine.
131 The attacker may know the root password,
133 may find a bug in a root-run server and be able to break root over a network
134 connection to that server, or the attacker may know of a bug in an SUID-root
135 program that allows the attacker to break root once he has broken into a
137 If an attacker has found a way to break root on a machine,
138 the attacker may not have a need to install a backdoor.
139 Many of the root holes found and closed to date involve a considerable amount
140 of work by the attacker to clean up after himself, so most attackers do install
142 This gives you a convenient way to detect the attacker.
144 it impossible for an attacker to install a backdoor may actually be detrimental
145 to your security because it will not close off the hole the attacker used to
148 Security remedies should always be implemented with a multi-layered
150 approach and can be categorized as follows:
151 .Bl -enum -offset indent
153 Securing root and staff accounts
155 Securing root \(em root-run servers and SUID/SGID binaries
157 Securing user accounts
159 Securing the password file
161 Securing the kernel core, raw devices, and file systems
163 Quick detection of inappropriate changes made to the system
167 .Sh SECURING THE ROOT ACCOUNT AND SECURING STAFF ACCOUNTS
168 Do not bother securing staff accounts if you have not secured the root
170 Most systems have a password assigned to the root account.
172 first thing you do is assume that the password is
175 This does not mean that you should remove the password.
177 password is almost always necessary for console access to the machine.
178 What it does mean is that you should not make it possible to use the password
179 outside of the console or possibly even with a
182 For example, make sure that your PTYs are specified as being
187 so that direct root logins via
193 other login services such as
195 make sure that direct root logins are
196 disabled there as well.
197 Consider every access method \(em services such as
199 often fall through the cracks.
200 Direct root logins should only be allowed
201 via the system console.
203 Of course, as a sysadmin you have to be able to get to root, so we open up
205 But we make sure these holes require additional password
206 verification to operate.
207 One way to make root accessible is to add appropriate
208 staff accounts to the
212 The staff members placed in the
217 You should never give staff
220 access by putting them in the
222 group in their password entry.
223 Staff accounts should be placed in a
225 group, and then added to the
230 Only those staff members who actually need to have root access
231 should be placed in the
234 It is also possible, when using an
235 authentication method such as Kerberos, to use Kerberos's
237 file in the root account to allow a
239 to root without having to place anyone at all in the
243 may be the better solution since the
245 mechanism still allows an
246 intruder to break root if the intruder has gotten hold of your password
247 file and can break into a staff account.
251 is better than having nothing at all, it is not necessarily the safest
254 An indirect way to secure the root account is to secure your staff accounts
255 by using an alternative login access method and *'ing out the crypted password
256 for the staff accounts.
257 This way an intruder may be able to steal the password
258 file but will not be able to break into any staff accounts or root, even if
259 root has a crypted password associated with it (assuming, of course, that
260 you have limited root access to the console).
262 get into their staff accounts through a secure login mechanism such as
266 using a private/public
268 When you use something like Kerberos you generally must secure
269 the machines which run the Kerberos servers and your desktop workstation.
270 When you use a public/private key pair with SSH, you must generally secure
271 the machine you are logging in
273 (typically your workstation),
275 also add an additional layer of protection to the key pair by password
276 protecting the keypair when you create it with
279 to *-out the passwords for staff accounts also guarantees that staff members
280 can only log in through secure access methods that you have set up.
282 thus force all staff members to use secure, encrypted connections for
283 all their sessions which closes an important hole used by many intruders: that
284 of sniffing the network from an unrelated, less secure machine.
286 The more indirect security mechanisms also assume that you are logging in
287 from a more restrictive server to a less restrictive server.
289 if your main box is running all sorts of servers, your workstation should not
291 In order for your workstation to be reasonably secure
292 you should run as few servers as possible, up to and including no servers
293 at all, and you should run a password-protected screen blanker.
294 Of course, given physical access to
295 a workstation, an attacker can break any sort of security you put on it.
296 This is definitely a problem that you should consider but you should also
297 consider the fact that the vast majority of break-ins occur remotely, over
298 a network, from people who do not have physical access to your workstation or
301 Using something like Kerberos also gives you the ability to disable or
302 change the password for a staff account in one place and have it immediately
303 affect all the machines the staff member may have an account on.
305 member's account gets compromised, the ability to instantly change his
306 password on all machines should not be underrated.
307 With discrete passwords, changing a password on N machines can be a mess.
309 re-passwording restrictions with Kerberos: not only can a Kerberos ticket
310 be made to timeout after a while, but the Kerberos system can require that
311 the user choose a new password after a certain period of time
313 .Sh SECURING ROOT \(em ROOT-RUN SERVERS AND SUID/SGID BINARIES
314 The prudent sysadmin only runs the servers he needs to, no more, no less.
315 Be aware that third party servers are often the most bug-prone.
317 running an old version of
320 .Xr popper 8 Pq Pa ports/mail/popper
321 is like giving a universal root
322 ticket out to the entire world.
323 Never run a server that you have not checked
325 Many servers do not need to be run as root.
332 daemons can be run in special user
334 A sandbox is not perfect unless you go to a large amount of trouble, but the
335 onion approach to security still stands: if someone is able to break in
336 through a server running in a sandbox, they still have to break out of the
338 The more layers the attacker must break through, the lower the
339 likelihood of his success.
340 Root holes have historically been found in
341 virtually every server ever run as root, including basic system servers.
342 If you are running a machine through which people only log in via
349 then turn off those services!
352 now defaults to running
358 Depending on whether you
359 are installing a new system or upgrading an existing system, the special
360 user accounts used by these sandboxes may not be installed.
362 sysadmin would research and implement sandboxes for servers whenever possible.
364 There are a number of other servers that typically do not run in sandboxes:
370 There are alternatives to
371 some of these, but installing them may require more work than you are willing
373 (the convenience factor strikes again).
374 You may have to run these
375 servers as root and rely on other mechanisms to detect break-ins that might
378 The other big potential root hole in a system are the SUID-root and SGID
379 binaries installed on the system.
380 Most of these binaries, such as
383 .Pa /bin , /sbin , /usr/bin ,
386 While nothing is 100% safe,
387 the system-default SUID and SGID binaries can be considered reasonably safe.
388 Still, root holes are occasionally found in these binaries.
390 was found in Xlib in 1998 that made
391 .Xr xterm 1 Pq Pa ports/x11/xterm
392 (which is typically SUID)
394 It is better to be safe than sorry and the prudent sysadmin will restrict SUID
395 binaries that only staff should run to a special group that only staff can
396 access, and get rid of
397 .Pq Dq Li "chmod 000"
398 any SUID binaries that nobody uses.
399 A server with no display generally does not need an
402 SGID binaries can be almost as dangerous.
403 If an intruder can break an SGID-kmem binary the
404 intruder might be able to read
406 and thus read the crypted password
407 file, potentially compromising any passworded account.
409 intruder who breaks group
411 can monitor keystrokes sent through PTYs,
412 including PTYs used by users who log in through secure methods.
416 group can write to almost any user's TTY.
418 is running a terminal
419 program or emulator with a keyboard-simulation feature, the intruder can
421 generate a data stream that causes the user's terminal to echo a command, which
422 is then run as that user.
423 .Sh SECURING USER ACCOUNTS
424 User accounts are usually the most difficult to secure.
426 draconian access restrictions on your staff and *-out their passwords, you
427 may not be able to do so with any general user accounts you might have.
429 you do have sufficient control then you may win out and be able to secure the
430 user accounts properly.
431 If not, you simply have to be more vigilant in your
432 monitoring of those accounts.
433 Use of SSH and Kerberos for user accounts is
434 more problematic due to the extra administration and technical support
435 required, but still a very good solution compared to a crypted password
437 .Sh SECURING THE PASSWORD FILE
438 The only sure fire way is to *-out as many passwords as you can and
439 use SSH or Kerberos for access to those accounts.
441 crypted password file
443 can only be read by root, it may
444 be possible for an intruder to obtain read access to that file even if the
445 attacker cannot obtain root-write access.
447 Your security scripts should always check for and report changes to
450 .Sx CHECKING FILE INTEGRITY
452 .Sh SECURING THE KERNEL CORE, RAW DEVICES, AND FILE SYSTEMS
453 If an attacker breaks root he can do just about anything, but there
454 are certain conveniences.
455 For example, most modern kernels have a packet sniffing device driver built in.
462 An intruder will commonly attempt to run a packet sniffer
463 on a compromised machine.
464 You do not need to give the intruder the
465 capability and most systems should not have the
469 But even if you turn off the
471 device, you still have
477 the intruder can still write to raw disk devices.
478 Also, there is another kernel feature called the module loader,
480 An enterprising intruder can use a KLD module to install
483 device or other sniffing device on a running kernel.
484 To avoid these problems you have to run
485 the kernel at a higher security level, at least level 1.
486 The security level can be set with a
492 set the security level to 1, write access to raw devices will be denied and
501 flag is set on critical startup binaries, directories, and
502 script files \(em everything that gets run
503 up to the point where the security level is set.
504 This might be overdoing it, and upgrading the system is much more
505 difficult when you operate at a higher security level.
506 You may compromise and
507 run the system at a higher security level but not set the
510 system file and directory under the sun.
511 Another possibility is to simply
517 It should be noted that being too draconian in
518 what you attempt to protect may prevent the all-important detection of an
521 The kernel runs with five different security levels.
522 Any super-user process can raise the level, but no process
524 The security levels are:
527 Permanently insecure mode \- always run the system in insecure mode.
528 This is the default initial value.
530 Insecure mode \- immutable and append-only flags may be turned off.
531 All devices may be read or written subject to their permissions.
533 Secure mode \- the system immutable and system append-only flags may not
535 disks for mounted file systems,
539 may not be opened for writing;
541 (if your platform has it) may not be opened at all;
544 may not be loaded or unloaded.
545 The kernel debugger may not be entered using the
548 A panic or trap cannot be forced using the
552 Highly secure mode \- same as secure mode, plus disks may not be
553 opened for writing (except by
555 whether mounted or not.
556 This level precludes tampering with file systems by unmounting them,
557 but also inhibits running
559 while the system is multi-user.
561 In addition, kernel time changes are restricted to less than or equal to one
563 Attempts to change the time by more than this will log the message
564 .Dq Time adjustment clamped to +1 second .
566 Network secure mode \- same as highly secure mode, plus
567 IP packet filter rules (see
572 cannot be changed and
576 configuration cannot be adjusted.
579 The security level can be configured with variables documented in
581 .Sh CHECKING FILE INTEGRITY: BINARIES, CONFIG FILES, ETC
582 When it comes right down to it, you can only protect your core system
583 configuration and control files so much before the convenience factor
589 bit on most of the files in
593 is probably counterproductive because
594 while it may protect the files, it also closes a detection window.
596 last layer of your security onion is perhaps the most important \(em detection.
597 The rest of your security is pretty much useless (or, worse, presents you with
598 a false sense of safety) if you cannot detect potential incursions.
600 the job of the onion is to slow down the attacker rather than stop him
601 in order to give the detection layer a chance to catch him in
604 The best way to detect an incursion is to look for modified, missing, or
607 way to look for modified files is from another (often centralized)
608 limited-access system.
609 Writing your security scripts on the extra-secure limited-access system
610 makes them mostly invisible to potential attackers, and this is important.
611 In order to take maximum advantage you generally have to give the
612 limited-access box significant access to the other machines in the business,
613 usually either by doing a read-only NFS export of the other machines to the
614 limited-access box, or by setting up SSH keypairs to allow the limit-access
615 box to SSH to the other machines.
616 Except for its network traffic, NFS is
617 the least visible method \(em allowing you to monitor the file systems on each
618 client box virtually undetected.
620 limited-access server is connected to the client boxes through a switch,
621 the NFS method is often the better choice.
622 If your limited-access server
623 is connected to the client boxes through a hub or through several layers
624 of routing, the NFS method may be too insecure (network-wise) and using SSH
625 may be the better choice even with the audit-trail tracks that SSH lays.
627 Once you give a limit-access box at least read access to the client systems
628 it is supposed to monitor, you must write scripts to do the actual
630 Given an NFS mount, you can write scripts out of simple system
635 It is best to physically
637 the client-box files boxes at least once a
638 day, and to test control files such as those found in
643 When mismatches are found relative to the base MD5
644 information the limited-access machine knows is valid, it should scream at
645 a sysadmin to go check it out.
646 A good security script will also check for
647 inappropriate SUID binaries and for new or deleted files on system partitions
653 When using SSH rather than NFS, writing the security script is much more
655 You essentially have to
657 the scripts to the client box in order to run them, making them visible, and
658 for safety you also need to
660 the binaries (such as
662 that those scripts use.
665 daemon on the client box may already be compromised.
667 using SSH may be necessary when running over unsecure links, but it is also a
668 lot harder to deal with.
670 A good security script will also check for changes to user and staff members
671 access configuration files:
672 .Pa .rhosts , .shosts , .ssh/authorized_keys
673 and so forth, files that might fall outside the purview of the MD5 check.
675 If you have a huge amount of user disk space it may take too long to run
676 through every file on those partitions.
677 In this case, setting mount
678 flags to disallow SUID binaries on those partitions is a good
685 is what you want to look into.
686 I would scan them anyway at least once a
687 week, since the object of this layer is to detect a break-in whether or
688 not the break-in is effective.
693 is a relatively low-overhead feature of
694 the operating system which I recommend using as a post-break-in evaluation
696 It is especially useful in tracking down how an intruder has
697 actually broken into a system, assuming the file is still intact after
700 Finally, security scripts should process the log files and the logs themselves
701 should be generated in as secure a manner as possible \(em remote syslog can be
703 An intruder tries to cover his tracks, and log files are critical
704 to the sysadmin trying to track down the time and method of the initial
706 One way to keep a permanent record of the log files is to run
707 the system console to a serial port and collect the information on a
708 continuing basis through a secure machine monitoring the consoles.
710 A little paranoia never hurts.
711 As a rule, a sysadmin can add any number
712 of security features as long as they do not affect convenience, and
713 can add security features that do affect convenience with some added
715 Even more importantly, a security administrator should mix it up
716 a bit \(em if you use recommendations such as those given by this manual
717 page verbatim, you give away your methodologies to the prospective
718 attacker who also has access to this manual page.
719 .Sh SPECIAL SECTION ON DoS ATTACKS
720 This section covers Denial of Service attacks.
721 A DoS attack is typically a packet attack.
722 While there is not much you can do about modern spoofed
723 packet attacks that saturate your network, you can generally limit the damage
724 by ensuring that the attacks cannot take down your servers.
725 .Bl -enum -offset indent
727 Limiting server forks
729 Limiting springboard attacks (ICMP response attacks, ping broadcast, etc.)
734 A common DoS attack is against a forking server that attempts to cause the
735 server to eat processes, file descriptors, and memory until the machine
740 has several options to limit this sort of attack.
741 It should be noted that while it is possible to prevent a machine from going
742 down it is not generally possible to prevent a service from being disrupted
746 manual page carefully and pay specific attention
752 Note that spoofed-IP attacks will circumvent
757 so typically a combination of options must be used.
758 Some standalone servers have self-fork-limitation parameters.
763 .Fl OMaxDaemonChildren
764 option which tends to work much
765 better than trying to use
767 load limiting options due to the
770 .Va MaxDaemonChildren
771 parameter when you start
773 high enough to handle your expected load but not so high that the
774 computer cannot handle that number of
776 without falling on its face.
777 It is also prudent to run
782 .Pq Fl ODeliveryMode=queued
783 and to run the daemon
784 .Pq Dq Nm sendmail Fl bd
785 separate from the queue-runs
786 .Pq Dq Nm sendmail Fl q15m .
787 If you still want real-time delivery you can run the queue
788 at a much lower interval, such as
790 but be sure to specify a reasonable
791 .Va MaxDaemonChildren
794 to prevent cascade failures.
798 daemon can be attacked directly and it is strongly recommended that you use
801 option whenever possible, and the
805 You should also be fairly careful
806 with connect-back services such as tcpwrapper's reverse-identd, which can
807 be attacked directly.
808 You generally do not want to use the reverse-ident
809 feature of tcpwrappers for this reason.
811 It is a very good idea to protect internal services from external access
812 by firewalling them off at your border routers.
813 The idea here is to prevent
814 saturation attacks from outside your LAN, not so much to protect internal
815 services from network-based root compromise.
816 Always configure an exclusive
821 ports A, B, C, D, and M-Z
824 way you can firewall off all of your low ports except for certain specific
828 and other internet-accessible services.
829 If you try to configure the firewall the other
830 way \(em as an inclusive or permissive firewall, there is a good chance that you
833 a couple of services or that you will add a new internal
834 service and forget to update the firewall.
835 You can still open up the
836 high-numbered port range on the firewall to allow permissive-like operation
837 without compromising your low ports.
841 control the range of port numbers used for dynamic binding via the various
842 .Va net.inet.ip.portrange
844 .Pq Dq Li "sysctl net.inet.ip.portrange" ,
846 ease the complexity of your firewall's configuration.
847 I usually use a normal
848 first/last range of 4000 to 5000, and a hiport range of 49152 to 65535, then
849 block everything under 4000 off in my firewall
850 (except for certain specific
851 internet-accessible ports, of course).
853 Another common DoS attack is called a springboard attack \(em to attack a server
854 in a manner that causes the server to generate responses which then overload
855 the server, the local network, or some other machine.
856 The most common attack
857 of this nature is the ICMP PING BROADCAST attack.
858 The attacker spoofs ping
859 packets sent to your LAN's broadcast address with the source IP address set
860 to the actual machine they wish to attack.
861 If your border routers are not
862 configured to stomp on ping's to broadcast addresses, your LAN winds up
863 generating sufficient responses to the spoofed source address to saturate the
864 victim, especially when the attacker uses the same trick on several dozen
865 broadcast addresses over several dozen different networks at once.
866 Broadcast attacks of over a hundred and twenty megabits have been measured.
867 A second common springboard attack is against the ICMP error reporting system.
869 constructing packets that generate ICMP error responses, an attacker can
870 saturate a server's incoming network and cause the server to saturate its
871 outgoing network with ICMP responses.
872 This type of attack can also crash the
873 server by running it out of
875 especially if the server cannot drain the
876 ICMP responses it generates fast enough.
879 kernel has a new kernel
880 compile option called
882 which limits the effectiveness of these
884 The last major class of springboard attacks is related to
887 services such as the UDP echo service.
889 simply spoofs a UDP packet with the source address being server A's echo port,
890 and the destination address being server B's echo port, where server A and B
891 are both on your LAN.
892 The two servers then bounce this one packet back and
893 forth between each other.
894 The attacker can overload both servers and their
895 LANs simply by injecting a few packets in this manner.
897 exist with the internal chargen port.
898 A competent sysadmin will turn off all
900 .Xr inetd 8 Ns -internal
902 .Sh ACCESS ISSUES WITH KERBEROS AND SSH
903 There are a few issues with both Kerberos and SSH that need to be addressed
904 if you intend to use them.
905 Kerberos5 is an excellent authentication
906 protocol but the kerberized
911 There are bugs that make them unsuitable for dealing with binary streams.
913 Kerberos does not encrypt a session unless you use the
916 SSH encrypts everything by default.
918 SSH works quite well in every respect except when it is set up to
919 forward encryption keys.
920 What this means is that if you have a secure workstation holding
921 keys that give you access to the rest of the system, and you
924 unsecure machine, your keys become exposed.
925 The actual keys themselves are
928 installs a forwarding port for the duration of your
929 login and if an attacker has broken root on the unsecure machine he can utilize
930 that port to use your keys to gain access to any other machine that your
933 We recommend that you use SSH in combination with Kerberos whenever possible
935 SSH can be compiled with Kerberos support.
937 your reliance on potentially exposable SSH keys while at the same time
938 protecting passwords via Kerberos.
940 should only be used for automated tasks from secure machines (something
941 that Kerberos is unsuited to).
942 We also recommend that you either turn off
943 key-forwarding in the SSH configuration, or that you make use of the
944 .Va from Ns = Ns Ar IP/DOMAIN
945 option that SSH allows in its
947 file to make the key only usable to entities logging in from specific
951 provides several knobs and tweak handles that make some introspection
952 information access more restricted.
953 Some people consider this as improving system security, so the knobs are
954 briefly listed there, together with controls which enable some mitigations
955 of the hardware state leaks.
956 .Bl -tag -width security.bsd.unprivileged_proc_debug
957 .It Dv security.bsd.see_other_uids
958 Controls visibility of processes owned by different uid.
959 The knob directly affects the
961 sysctls filtering of data, which results in restricted output from
964 .It Dv security.bsd.see_other_gids
965 Same, for processes owned by different gid.
966 .It Dv security.bsd.see_jail_proc
967 Same, for processes belonging to a jail.
968 .It Dv security.bsd.conservative_signals
969 When enabled, unprivileged users are only allowed to send job control
970 and usual termination signals like
975 to the processes executing programs with changed uids.
976 .It Dv security.bsd.unprivileged_proc_debug
977 Controls availability of the process debugging facilities to non-root users.
984 Enables mode of operation of virtual memory system where usermode page
985 tables are sanitized to prevent so-called Meltdown information leak on
987 By default, the system detects whether the CPU needs the workaround,
988 and enables it automatically.
993 .It Dv hw.mds_disable
995 Controls Microarchitectural Data Sampling hardware information leak
997 .It Dv hw.spec_store_bypass_disable
999 Controls Speculative Store Bypass hardware information leak mitigation.
1000 .It Dv hw.ibrs_disable
1002 Controls Indirect Branch Restricted Speculation hardware information leak
1004 .It Dv machdep.syscall_ret_l1d_flush
1006 Controls force-flush of L1D cache on return from syscalls which report
1015 This is mostly a paranoid setting added to prevent hypothetical exploitation
1016 of unknown gadgets for unknown hardware issues.
1017 The error codes exclusion list is composed of the most common errors which
1018 typically occurs on normal system operation.
1019 .It Dv machdep.nmi_flush_l1d_sw
1021 Controls force-flush of L1D cache on NMI;
1022 this provides software assist for bhyve mitigation of L1 terminal fault
1023 hardware information leak.
1024 .It Dv hw.vmm.vmx.l1d_flush
1026 Controls the mitigation of L1 Terminal Fault in bhyve hypervisor.
1027 .It Dv kern.elf32.aslr.enable
1028 Controls system-global Address Space Layour Randomization (ASLR) for
1029 normal non-PIE (Position Independent Executable) 32bit binaries.
1034 also affected by the per-image control note flag.
1035 .It Dv kern.elf32.aslr.pie_enable
1036 Controls system-global Address Space Layout Randomization for
1037 position-independent (PIE) 32bit binaries.
1038 .It Dv kern.elf32.aslr.honor_sbrk
1039 Makes ASLR less aggressive and more compatible with old binaries
1040 relying on the sbrk area.
1041 .It Dv kern.elf32.aslr.aslr_stack_gap
1042 If ASLR is enabled for a binary, a non-zero value creates a randomized
1043 stack gap between strings and the end of the aux vector.
1044 The value is the maximum percentage of main stack to waste on the gap.
1045 Cannot be greater than 50, i.e., at most half of the stack.
1046 .It Dv kern.elf64.aslr.enable
1047 64bit binaries ASLR control.
1048 .It Dv kern.elf64.aslr.pie_enable
1049 64bit PIE binaries ASLR control.
1050 .It Dv kern.elf64.aslr.honor_sbrk
1051 64bit binaries ASLR sbrk compatibility control.
1052 .It Dv kern.elf32.aslr.aslr_stack_gap
1053 Controls stack gap for 64bit binaries.
1054 .It Dv kern.elf32.nxstack
1055 Enables non-executable stack for 32bit processes.
1056 Enabled by default if supported by hardware and corresponding binary.
1057 .It Dv kern.elf64.nxstack
1058 Enables non-executable stack for 64bit processes.
1069 .Xr xdm 1 Pq Pa ports/x11/xorg-clients ,
1081 manual page was originally written by