xref: /netbsd-src/share/man/man7/security.7 (revision 59613fc8ef89629281634a2c9c1c6fd586ec5ccd)
1*59613fc8Sgutteridge.\" $NetBSD: security.7,v 1.18 2024/10/31 01:13:19 gutteridge Exp $
2f6eafc1dSjruoho.\"
3f6eafc1dSjruoho.\" Copyright (c) 2006, 2011 Elad Efrat <elad@NetBSD.org>
4f6eafc1dSjruoho.\" All rights reserved.
5f6eafc1dSjruoho.\"
6f6eafc1dSjruoho.\" Redistribution and use in source and binary forms, with or without
7f6eafc1dSjruoho.\" modification, are permitted provided that the following conditions
8f6eafc1dSjruoho.\" are met:
9f6eafc1dSjruoho.\" 1. Redistributions of source code must retain the above copyright
10f6eafc1dSjruoho.\"    notice, this list of conditions and the following disclaimer.
11f6eafc1dSjruoho.\" 2. Redistributions in binary form must reproduce the above copyright
12f6eafc1dSjruoho.\"    notice, this list of conditions and the following disclaimer in the
13f6eafc1dSjruoho.\"    documentation and/or other materials provided with the distribution.
14f6eafc1dSjruoho.\" 3. The name of the author may not be used to endorse or promote products
15f6eafc1dSjruoho.\"    derived from this software without specific prior written permission.
16f6eafc1dSjruoho.\"
17f6eafc1dSjruoho.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18f6eafc1dSjruoho.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19f6eafc1dSjruoho.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20f6eafc1dSjruoho.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21f6eafc1dSjruoho.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22f6eafc1dSjruoho.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23f6eafc1dSjruoho.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24f6eafc1dSjruoho.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25f6eafc1dSjruoho.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26f6eafc1dSjruoho.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27f6eafc1dSjruoho.\"
28*59613fc8Sgutteridge.Dd October 31, 2024
29f6eafc1dSjruoho.Dt SECURITY 7
30f6eafc1dSjruoho.Os
31f6eafc1dSjruoho.Sh NAME
32f6eafc1dSjruoho.Nm security
33f6eafc1dSjruoho.Nd
34f6eafc1dSjruoho.Nx
35f6eafc1dSjruohosecurity features
36f6eafc1dSjruoho.Sh DESCRIPTION
37f6eafc1dSjruoho.Nx
38f6eafc1dSjruohosupports a variety of security features.
39f6eafc1dSjruohoBelow is a brief description of them with some quick usage examples
40f6eafc1dSjruohothat will help you get started.
41f6eafc1dSjruoho.Pp
42f6eafc1dSjruohoContents:
43f6eafc1dSjruoho.Pp
44f6eafc1dSjruoho.Bl -hyphen -compact -offset indent
45f6eafc1dSjruoho.It
46f6eafc1dSjruohoVeriexec
47f6eafc1dSjruoho.Pq file integrity
48f6eafc1dSjruoho.It
49f6eafc1dSjruohoExploit mitigation
50f6eafc1dSjruoho.It
51f6eafc1dSjruohoPer-user
52f6eafc1dSjruoho.Pa /tmp
53f6eafc1dSjruohodirectory
54f6eafc1dSjruoho.It
55f6eafc1dSjruohoInformation filtering
56bbf5008aSjruoho.It
57bbf5008aSjruohoAdministrative security
58f6eafc1dSjruoho.El
59cba96d16Sriastradh.Pp
60cba96d16SriastradhSee also
61cba96d16Sriastradh.Xr entropy 7 .
62ffb49bc1Sjruoho.Ss Veriexec
63f6eafc1dSjruoho.Em Veriexec
64f6eafc1dSjruohois a file integrity subsystem.
65f6eafc1dSjruoho.Pp
66f6eafc1dSjruohoFor more information about it, and a quick guide on how to use it, please see
67f6eafc1dSjruoho.Xr veriexec 8 .
68f6eafc1dSjruoho.Pp
69f6eafc1dSjruohoIn a nutshell, once enabled,
70f6eafc1dSjruoho.Em Veriexec
71f6eafc1dSjruohocan be started as follows:
72f6eafc1dSjruoho.Bd -literal -offset indent
7301869ca4Swiz# veriexecgen && veriexecctl load
74f6eafc1dSjruoho.Ed
75ffb49bc1Sjruoho.Ss Exploit mitigation
76f6eafc1dSjruoho.Nx
77f6eafc1dSjruohoincorporates some exploit mitigation features.
78f6eafc1dSjruohoThe purpose of exploit mitigation features is to interfere
79f6eafc1dSjruohowith the way exploits work, in order to prevent them from succeeding.
80f6eafc1dSjruohoDue to that, some features may have other impacts on the system, so be sure to
81f6eafc1dSjruohofully understand the implications of each feature.
82f6eafc1dSjruoho.Pp
83f6eafc1dSjruoho.Nx
84f6eafc1dSjruohoprovides the following exploit mitigation features:
85f6eafc1dSjruoho.Pp
86f6eafc1dSjruoho.Bl -hyphen -compact -offset indent
87f6eafc1dSjruoho.It
88f6eafc1dSjruoho.Tn PaX ASLR
89f6eafc1dSjruoho.Pq Address Space Layout Randomization .
90f6eafc1dSjruoho.It
91f6eafc1dSjruoho.Tn PaX MPROTECT
92f6eafc1dSjruoho.Xr ( mprotect 2
93f6eafc1dSjruohorestrictions)
94f6eafc1dSjruoho.It
95f6eafc1dSjruoho.Tn PaX SegvGuard
96f6eafc1dSjruoho.It
97f6eafc1dSjruoho.Xr gcc 1
98f6eafc1dSjruohostack-smashing protection
99f6eafc1dSjruoho.Pq Tn SSP
100f6eafc1dSjruoho.It
101f6eafc1dSjruohobounds checked libc functions
102f6eafc1dSjruoho.Pq Tn FORTIFY_SOURCE
103f6eafc1dSjruoho.It
104f6eafc1dSjruohoProtections against
105f6eafc1dSjruoho.Dv NULL
106f6eafc1dSjruohopointer dereferences
107f6eafc1dSjruoho.El
108f6eafc1dSjruoho.Ss PaX ASLR
109f6eafc1dSjruoho.Em PaX ASLR
110f6eafc1dSjruohoimplements Address Space Layout Randomization
111f6eafc1dSjruoho.Pq Tn ASLR ,
112f6eafc1dSjruohomeant to complement non-executable mappings.
113f6eafc1dSjruohoIts purpose is to harden prediction of the address space layout, namely
114f6eafc1dSjruoholocation of library and application functions that can be used by an attacker
115f6eafc1dSjruohoto circumvent non-executable mappings by using a technique called
116f6eafc1dSjruoho.Dq return to library
117f6eafc1dSjruohoto bypass the need to write new code to (potentially executable) regions of
118f6eafc1dSjruohomemory.
119f6eafc1dSjruoho.Pp
120f6eafc1dSjruohoWhen
121f6eafc1dSjruoho.Em PaX ASLR
122f6eafc1dSjruohois used, it is more likely the attacker will fail to predict the addresses of
123f6eafc1dSjruohosuch functions, causing the application to segfault.
124f6eafc1dSjruohoTo detect cases where an attacker might try and brute-force the return address
125f6eafc1dSjruohoof respawning services,
126f6eafc1dSjruoho.Em PaX Segvguard
127f6eafc1dSjruohocan be used (see below).
128f6eafc1dSjruoho.Pp
129f6eafc1dSjruohoFor non-PIE
130f6eafc1dSjruoho.Pq Position Independent Executable
131f6eafc1dSjruohoexecutables, the
132f6eafc1dSjruoho.Nx
133f6eafc1dSjruoho.Em PaX ASLR
134f6eafc1dSjruohoimplementation introduces randomization to the following memory regions:
135f6eafc1dSjruoho.Pp
136f6eafc1dSjruoho.Bl -enum -compact -offset indent
137f6eafc1dSjruoho.It
138f6eafc1dSjruohoThe stack
139f6eafc1dSjruoho.El
140f6eafc1dSjruoho.Pp
141f6eafc1dSjruohoFor
142f6eafc1dSjruoho.Tn PIE
143f6eafc1dSjruohoexecutables:
144f6eafc1dSjruoho.Pp
145f6eafc1dSjruoho.Bl -enum -compact -offset indent
146f6eafc1dSjruoho.It
147f6eafc1dSjruohoThe program itself (exec base)
148f6eafc1dSjruoho.It
149f6eafc1dSjruohoAll shared libraries
150f6eafc1dSjruoho.It
151f6eafc1dSjruohoThe data segment
152f6eafc1dSjruoho.It
153f6eafc1dSjruohoThe stack
154f6eafc1dSjruoho.El
155f6eafc1dSjruoho.Pp
156f6eafc1dSjruohoWhile it can be enabled globally,
157f6eafc1dSjruoho.Nx
158f6eafc1dSjruohoprovides a tool,
159f6eafc1dSjruoho.Xr paxctl 8 ,
160f6eafc1dSjruohoto enable
161f6eafc1dSjruoho.Em PaX ASLR
162f6eafc1dSjruohoon a per-program basis.
163f6eafc1dSjruoho.Pp
164f6eafc1dSjruohoExample usage:
165f6eafc1dSjruoho.Bd -literal -offset indent
166f6eafc1dSjruoho# paxctl +A /usr/sbin/sshd
167f6eafc1dSjruoho.Ed
168f6eafc1dSjruoho.Pp
169f6eafc1dSjruohoEnabling
170f6eafc1dSjruoho.Em PaX ASLR
171f6eafc1dSjruohoglobally:
172f6eafc1dSjruoho.Bd -literal -offset indent
173f6eafc1dSjruoho# sysctl -w security.pax.aslr.global=1
174f6eafc1dSjruoho.Ed
175f6eafc1dSjruoho.Ss PaX MPROTECT
176f6eafc1dSjruoho.Em PaX MPROTECT
177f6eafc1dSjruohoimplements memory protection restrictions,
178f6eafc1dSjruohomeant to complement non-executable mappings.
179f6eafc1dSjruohoThe purpose is to prevent situations where malicious code attempts to mark
180f6eafc1dSjruohowritable memory regions as executable, often by trashing arguments to an
181f6eafc1dSjruoho.Xr mprotect 2
182f6eafc1dSjruohocall.
183f6eafc1dSjruoho.Pp
184f6eafc1dSjruohoWhile it can be enabled globally,
185f6eafc1dSjruoho.Nx
186f6eafc1dSjruohoprovides a tool,
187f6eafc1dSjruoho.Xr paxctl 8 ,
188f6eafc1dSjruohoto enable
189f6eafc1dSjruoho.Em PaX MPROTECT
190f6eafc1dSjruohoon a per-program basis.
191f6eafc1dSjruoho.Pp
192f6eafc1dSjruohoExample usage:
193f6eafc1dSjruoho.Bd -literal -offset indent
194f6eafc1dSjruoho# paxctl +M /usr/sbin/sshd
195f6eafc1dSjruoho.Ed
196f6eafc1dSjruoho.Pp
197f6eafc1dSjruohoEnabling
198f6eafc1dSjruoho.Em PaX MPROTECT
199f6eafc1dSjruohoglobally:
200f6eafc1dSjruoho.Bd -literal -offset indent
201f6eafc1dSjruoho# sysctl -w security.pax.mprotect.global=1
202f6eafc1dSjruoho.Ed
2032bd2f7a2Schristos.Pp
2042bd2f7a2SchristosPaX MPROTECT affects the following three uses:
2052bd2f7a2Schristos.Bl -bullet -offset indent
2062bd2f7a2Schristos.It
2072bd2f7a2SchristosProcesses that utilize code generation (such as the JVM) might need to have
2082bd2f7a2SchristosMPROTECT disabled.
2092bd2f7a2Schristos.It
2102bd2f7a2SchristosMiscompiled programs that have text relocations, will now core dump instead
2112bd2f7a2Schristosof having their relocations corrected.
2122bd2f7a2SchristosYou will need to fix those programs (recompile them properly).
2132bd2f7a2Schristos.It
2142bd2f7a2SchristosDebugger breakpoints:
2152bd2f7a2Schristos.Xr gdb 1
2162bd2f7a2Schristosneeds to be able to write to the text segment in order to insert and
2172bd2f7a2Schristosdelete breakpoints.
2182bd2f7a2SchristosThis will not work unless MPROTECT is disabled on the executable.
2192bd2f7a2Schristos.El
220f6eafc1dSjruoho.Ss PaX Segvguard
221f6eafc1dSjruoho.Em PaX Segvguard
222f6eafc1dSjruohomonitors the number of segmentation faults in a program on a per-user basis,
223f6eafc1dSjruohoin an attempt to detect on-going exploitation attempts and possibly prevent
224f6eafc1dSjruohothem.
225f6eafc1dSjruohoFor instance,
226f6eafc1dSjruoho.Em PaX Segvguard
227f6eafc1dSjruohocan help detect when an attacker tries to brute-force a function
228f6eafc1dSjruohoreturn address, when attempting to perform a return-to-lib attack.
229f6eafc1dSjruoho.Pp
230f6eafc1dSjruoho.Em PaX Segvguard
231f6eafc1dSjruohoconsumes kernel memory, so use it wisely.
232f6eafc1dSjruohoWhile it provides rate-limiting protections, records are tracked for all
233f6eafc1dSjruohousers on a per-program basis, meaning that irresponsible use may result in
234f6eafc1dSjruohotracking all segmentation faults in the system, possibly consuming all kernel
235f6eafc1dSjruohomemory.
236f6eafc1dSjruoho.Pp
237f6eafc1dSjruohoFor this reason, it is highly recommended to have
238f6eafc1dSjruoho.Em PaX Segvguard
239f6eafc1dSjruohoenabled explicitly only for network services or
240f6eafc1dSjruohoother processes deemed as critical to system security.
241f6eafc1dSjruohoEnabling
242f6eafc1dSjruoho.Em PaX Segvguard
243f6eafc1dSjruohoexplicitly works like this:
244f6eafc1dSjruoho.Bd -literal -offset indent
245f6eafc1dSjruoho# paxctl +G /usr/sbin/sshd
246f6eafc1dSjruoho.Ed
247f6eafc1dSjruoho.Pp
248f6eafc1dSjruohoHowever, a global knob is still provided, for use in strict environments
249f6eafc1dSjruohowith no local users (for example, some network appliances, embedded devices,
250f6eafc1dSjruohoand firewalls)
251f6eafc1dSjruoho.Bd -literal -offset indent
252f6eafc1dSjruoho# sysctl -w security.pax.segvguard.global=1
253f6eafc1dSjruoho.Ed
254f6eafc1dSjruoho.Pp
255f6eafc1dSjruohoExplicitly disabling
256f6eafc1dSjruoho.Em PaX Segvguard
257f6eafc1dSjruohois also possible:
258f6eafc1dSjruoho.Bd -literal -offset indent
259f6eafc1dSjruoho# paxctl +g /bin/ls
260f6eafc1dSjruoho.Ed
261f6eafc1dSjruoho.Pp
262f6eafc1dSjruohoIn addition,
263f6eafc1dSjruoho.Em PaX Segvguard
264f6eafc1dSjruohoprovides several tunable options.
265f6eafc1dSjruohoFor example, to limit a program to 5 segmentation faults from the same user in
266f6eafc1dSjruohoa 60 second timeframe:
267f6eafc1dSjruoho.Bd -literal -offset indent
268f6eafc1dSjruoho# sysctl -w security.pax.segvguard.max_crashes=5
269f6eafc1dSjruoho# sysctl -w security.pax.segvguard.expiry_timeout=60
270f6eafc1dSjruoho.Ed
271f6eafc1dSjruoho.Pp
272f6eafc1dSjruohoThe number of seconds a user will be suspended from running the culprit
273f6eafc1dSjruohoprogram is also configurable.
274f6eafc1dSjruohoFor example, 10 minutes seem like a sane setting:
275f6eafc1dSjruoho.Bd -literal -offset indent
276f6eafc1dSjruoho# sysctl -w security.pax.segvguard.suspend_timeout=600
277f6eafc1dSjruoho.Ed
278f6eafc1dSjruoho.Ss GCC Stack Smashing Protection ( SSP )
279f6eafc1dSjruohoAs of
280f6eafc1dSjruoho.Nx 4.0 ,
281f6eafc1dSjruoho.Xr gcc 1
282f6eafc1dSjruohoincludes
283f6eafc1dSjruoho.Em SSP ,
284f6eafc1dSjruohoa set of compiler extensions to raise the bar on exploitation attempts by
285f6eafc1dSjruohodetecting corruption of variables and buffer overruns, which may be used to
286f6eafc1dSjruohoaffect program control flow.
287f6eafc1dSjruoho.Pp
288f6eafc1dSjruohoUpon detection of a buffer overrun,
289f6eafc1dSjruoho.Em SSP
290f6eafc1dSjruohowill immediately abort execution of the program and send a log message
291f6eafc1dSjruohoto
292f6eafc1dSjruoho.Xr syslog 3 .
293f6eafc1dSjruoho.Pp
294f6eafc1dSjruohoThe system (userland and kernel) can be built with
295f6eafc1dSjruoho.Em SSP
296f6eafc1dSjruohoby using the
297f6eafc1dSjruoho.Dq USE_SSP
298f6eafc1dSjruohoflag in
299f6eafc1dSjruoho.Pa /etc/mk.conf :
300f6eafc1dSjruoho.Bd -literal -offset indent
301f6eafc1dSjruohoUSE_SSP=yes
302f6eafc1dSjruoho.Ed
303f6eafc1dSjruoho.Pp
304f6eafc1dSjruohoYou are encouraged to use
305f6eafc1dSjruoho.Em SSP
306f6eafc1dSjruohofor software you build, by providing one of the
307f6eafc1dSjruoho.Fl fstack-protector
308f6eafc1dSjruohoor
309f6eafc1dSjruoho.Fl fstack-protector-all
310f6eafc1dSjruohoflags to
311f6eafc1dSjruoho.Xr gcc 1 .
312f6eafc1dSjruohoKeep in mind, however, that
313f6eafc1dSjruoho.Em SSP
314f6eafc1dSjruohowill not work for functions that make use of
315f6eafc1dSjruoho.Xr alloca 3 ,
316f6eafc1dSjruohoas the latter modifies the stack size during run-time, while
317f6eafc1dSjruoho.Em SSP
318f6eafc1dSjruohorelies on it being a compile-time static.
319f6eafc1dSjruoho.Pp
320f6eafc1dSjruohoUse of
321f6eafc1dSjruoho.Em SSP
322f6eafc1dSjruohois especially encouraged on platforms without per-page execute bit granularity
323f6eafc1dSjruohosuch as i386.
324f6eafc1dSjruohoAs of
325f6eafc1dSjruoho.Nx 6.0 ,
326f6eafc1dSjruoho.Em SSP
327f6eafc1dSjruohois used by default on i386 and amd64 architectures.
328f6eafc1dSjruoho.Ss FORTIFY_SOURCE
329f6eafc1dSjruohoThe so-called
330f6eafc1dSjruoho.Em FORTIFY_SOURCE
331f6eafc1dSjruohois a relatively simple technique to detect a subset of buffer overflows
332f6eafc1dSjruohobefore these can do damage.
333f6eafc1dSjruohoIt is integrated to
334f6eafc1dSjruoho.Xr gcc 1
335f6eafc1dSjruohotogether with some common memory and string functions in the standard
336f6eafc1dSjruohoC library of
337f6eafc1dSjruoho.Nx .
338f6eafc1dSjruoho.Pp
339f6eafc1dSjruohoThe underlying idea builds on the observation that there are cases where
340f6eafc1dSjruohothe compiler knows the size of a buffer.
341f6eafc1dSjruohoIf a buffer overflow is suspected in a function that does little or no
342f6eafc1dSjruohobounds checking, either a compile time warning can be issued or a
343f6eafc1dSjruohosafer substitute function can be used at runtime.
344f6eafc1dSjruohoRefer to
345f6eafc1dSjruoho.Xr ssp 3
346f6eafc1dSjruohofor additional details.
347f6eafc1dSjruoho.Pp
348f6eafc1dSjruohoThe
349f6eafc1dSjruoho.Em FORTIFY_SOURCE
350f6eafc1dSjruohois enabled by default in some parts of the
351f6eafc1dSjruoho.Nx
352f6eafc1dSjruohosource tree.
353f6eafc1dSjruohoIt is also possible to explicitly enable it by defining
354f6eafc1dSjruohothe following in
355f6eafc1dSjruoho.Xr mk.conf 5 :
356f6eafc1dSjruoho.Bd -literal -offset indent
357f6eafc1dSjruohoUSE_FORT=yes
358f6eafc1dSjruoho.Ed
359f6eafc1dSjruoho.Ss Protections against NULL pointer dereferences
360f6eafc1dSjruohoA certain class of attacks rely on kernel bugs that dereference
361f6eafc1dSjruoho.Dv NULL
362f6eafc1dSjruohopointers.
363f6eafc1dSjruohoIf user processes are allowed to map the virtual address 0 with
364f6eafc1dSjruoho.Xr mmap 2
365f6eafc1dSjruohoor by other means, there is a risk that code or data
366f6eafc1dSjruohocan be injected into the kernel address space.
367f6eafc1dSjruoho.Pp
368f6eafc1dSjruohoIn
369f6eafc1dSjruoho.Nx
370f6eafc1dSjruohoit is possible to restrict whether user processes are
371f6eafc1dSjruohoallowed to make mappings at the zero address.
3720bda128cSshmBy default, address 0 mappings are restricted on all architectures.
373f6eafc1dSjruohoIt is however known that some third-party programs
374f6eafc1dSjruohomay not function properly with the restriction.
375f6eafc1dSjruohoSuch mappings can be allowed either by using the
376f6eafc1dSjruoho.Dv USER_VA0_DISABLE_DEFAULT
377384721eeSjruohokernel configuration option or by changing the following variable at runtime:
378f6eafc1dSjruoho.Bd -literal -offset indent
379f6eafc1dSjruoho# sysctl -w vm.user_va0_disable=0
380f6eafc1dSjruoho.Ed
381f6eafc1dSjruoho.Pp
382f6eafc1dSjruohoNote that if
383f6eafc1dSjruoho.Em securelevel
384f6eafc1dSjruoho(see
385f6eafc1dSjruoho.Xr secmodel_securelevel 9 )
386f6eafc1dSjruohois greater than zero, it is not possible to change the
387f6eafc1dSjruoho.Xr sysctl 8
388f6eafc1dSjruohovariable.
389ffb49bc1Sjruoho.Ss Per-user temporary storage
390f6eafc1dSjruohoIt is possible to configure per-user temporary storage to avoid potential
391f6eafc1dSjruohosecurity issues (race conditions, etc.) in programs that do not make secure
392f6eafc1dSjruohousage of
393f6eafc1dSjruoho.Pa /tmp .
394f6eafc1dSjruoho.Pp
395f6eafc1dSjruohoTo enable per-user temporary storage, add the following line to
396f6eafc1dSjruoho.Xr rc.conf 5 :
397f6eafc1dSjruoho.Bd -literal -offset indent
398f6eafc1dSjruohoper_user_tmp=YES
399f6eafc1dSjruoho.Ed
400f6eafc1dSjruoho.Pp
401f6eafc1dSjruohoIf
402f6eafc1dSjruoho.Pa /tmp
403f6eafc1dSjruohois a mount point, you will also need to update its
404f6eafc1dSjruoho.Xr fstab 5
405f6eafc1dSjruohoentry to use
406f6eafc1dSjruoho.Dq /private/tmp
407f6eafc1dSjruoho(or whatever directory you want, if you override the default using the
408f6eafc1dSjruoho.Dq per_user_tmp_dir
409f6eafc1dSjruoho.Xr rc.conf 5
410f6eafc1dSjruohokeyword) instead of
411f6eafc1dSjruoho.Dq /tmp .
412f6eafc1dSjruoho.Pp
413f6eafc1dSjruohoFollowing that, run:
414f6eafc1dSjruoho.Bd -literal -offset indent
415f6eafc1dSjruoho# /etc/rc.d/perusertmp start
416f6eafc1dSjruoho.Ed
417f6eafc1dSjruoho.Pp
418f6eafc1dSjruohoThe per-user temporary storage is implemented by using
419f6eafc1dSjruoho.Dq magic symlinks .
420f6eafc1dSjruohoThese are further described in
421f6eafc1dSjruoho.Xr symlink 7 .
42211035986Sgutteridge.Pp
42311035986SgutteridgeNote that some programs will not work correctly with the present
42411035986Sgutteridge.Dq magic symlinks
42511035986Sgutteridgeimplementation, if they invoke
42611035986Sgutteridge.Xr realpath 3
427*59613fc8Sgutteridgeon temporary file paths, for example
428*59613fc8Sgutteridge.Xr tmux 1 .
42911035986SgutteridgeIn this case, resolution will fail, so this feature is not suited for
43011035986Sgutteridgeall uses.
431ffb49bc1Sjruoho.Ss Information filtering
432f6eafc1dSjruoho.Nx
433f6eafc1dSjruohoprovides administrators the ability to restrict information passed from
434f6eafc1dSjruohothe kernel to userland so that users can only view information they
435f6eafc1dSjruoho.Dq own .
436f6eafc1dSjruoho.Pp
437f6eafc1dSjruohoThe hooks that manage this restriction are located in various parts of the
438f6eafc1dSjruohosystem and affect programs such as
439f6eafc1dSjruoho.Xr ps 1 ,
440f6eafc1dSjruoho.Xr fstat 1 ,
441f6eafc1dSjruohoand
442f6eafc1dSjruoho.Xr netstat 1 .
443f6eafc1dSjruohoInformation filtering is enabled as follows:
444f6eafc1dSjruoho.Bd -literal -offset indent
445f6eafc1dSjruoho# sysctl -w security.curtain=1
446f6eafc1dSjruoho.Ed
44740e6b557Sjruoho.Ss Administrative security
44840e6b557SjruohoAlso certain administrative tasks are related to security.
449523ab187SwizFor instance, the daily maintenance script includes some basic
45040e6b557Sjruohoconsistency checks; see
45140e6b557Sjruoho.Xr security.conf 5
45240e6b557Sjruohofor more details.
45340e6b557SjruohoIn particular, it is possible to configure
45440e6b557Sjruoho.Nx
45540e6b557Sjruohoto automatically audit all third-party packages installed via
45640e6b557Sjruoho.Xr pkgsrc 7 .
45740e6b557SjruohoTo audit for any known vulnerabilities on daily basis, set the following in
45839d81999Snjoly.Pa /etc/daily.conf :
45940e6b557Sjruoho.Bd -literal -offset indent
46040e6b557Sjruohofetch_pkg_vulnerabilities=YES
46140e6b557Sjruoho.Ed
462f6eafc1dSjruoho.Sh SEE ALSO
463f6eafc1dSjruoho.Xr ssp 3 ,
464f6eafc1dSjruoho.Xr options 4 ,
465cba96d16Sriastradh.Xr entropy 7 ,
466f6eafc1dSjruoho.Xr paxctl 8 ,
467f6eafc1dSjruoho.Xr sysctl 8 ,
468a5f9dd4fSjruoho.Xr veriexec 8 ,
469a5f9dd4fSjruoho.Xr kauth 9
470a5f9dd4fSjruoho.\"
471a5f9dd4fSjruoho.Rs
472a5f9dd4fSjruoho.%A Joseph Kong
473a5f9dd4fSjruoho.%B "Designing BSD Rootkits: An Introduction to Kernel Hacking"
474a5f9dd4fSjruoho.%D 2007
475a5f9dd4fSjruoho.%I "No Starch Press"
476a5f9dd4fSjruoho.Re
477a5f9dd4fSjruoho.\"
478a5f9dd4fSjruoho.Rs
479a5f9dd4fSjruoho.%A Enrico Perla
480a5f9dd4fSjruoho.%A Massimiliano Oldani
481a5f9dd4fSjruoho.%B "A Guide to Kernel Exploitation: Attacking the Core"
482a5f9dd4fSjruoho.%D 2010
483a5f9dd4fSjruoho.%I "Elsevier"
484a5f9dd4fSjruoho.Re
485a5f9dd4fSjruoho.\"
486a5f9dd4fSjruoho.Rs
487a5f9dd4fSjruoho.%A Erik Buchanan
488a5f9dd4fSjruoho.%A Ryan Roemer
489a5f9dd4fSjruoho.%A Hovav Shacham
490a5f9dd4fSjruoho.%A Stefan Savage
491a5f9dd4fSjruoho.%T "When Good Instructions Go Bad: \
492a5f9dd4fSjruohoGeneralizing Return-Oriented Programming to RISC"
493a5f9dd4fSjruoho.%P 27-38
494a5f9dd4fSjruoho.%O CCS '08: Proceedings of the 15th ACM Conference \
495a5f9dd4fSjruohoon Computer and Communications Security
496a5f9dd4fSjruoho.%I ACM Press
497a5f9dd4fSjruoho.%D October 27-31, 2008
498a5f9dd4fSjruoho.%U http://cseweb.ucsd.edu/~hovav/dist/sparc.pdf
499a5f9dd4fSjruoho.Re
500a5f9dd4fSjruoho.\"
501a5f9dd4fSjruoho.Rs
502a5f9dd4fSjruoho.%A Sebastian Krahmer
503a5f9dd4fSjruoho.%T "x86-64 Buffer Overflow Exploits and \
504a5f9dd4fSjruohothe Borrowed Code Chunks Exploitation Technique"
505a5f9dd4fSjruoho.%D September 28, 2005
506a5f9dd4fSjruoho.%U http://www.suse.de/~krahmer/no-nx.pdf
507a5f9dd4fSjruoho.Re
508f6eafc1dSjruoho.Sh AUTHORS
509214b65a5SjruohoMany of the security features were pioneered by
510a5684d07Swiz.An Elad Efrat Aq Mt elad@NetBSD.org .
511