1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
From: Gordon Malm <gengor@gentoo.org>
From: Jory A. Pratt <anarchy@gentoo.org>
From: Kerin Millar <kerframil@gmail.com>
Add Hardened Gentoo [server/workstation] predefined grsecurity
levels. They're designed to provide a comparitively high level of
security while remaining generally suitable for as great a majority
of the userbase as possible (particularly new users).
Make Hardened Gentoo [workstation] predefined grsecurity level the
default. The Hardened Gentoo [server] level is more restrictive
and conflicts with some software and thus would be less suitable.
The original version of this patch was conceived and created by:
Ned Ludd <solar@gentoo.org>
--- a/grsecurity/Kconfig 2009-07-31 02:34:44.661115764 +0100
+++ b/grsecurity/Kconfig 2009-08-01 02:04:02.047475888 +0100
@@ -18,7 +18,7 @@
choice
prompt "Security Level"
depends on GRKERNSEC
- default GRKERNSEC_CUSTOM
+ default GRKERNSEC_HARDENED_WORKSTATION_NO_RBAC
config GRKERNSEC_LOW
bool "Low"
@@ -191,6 +191,416 @@
- Ptrace restrictions
- Restricted vm86 mode
+config GRKERNSEC_HARDENED_SERVER
+ bool "Hardened Gentoo [server]"
+ select GRKERNSEC_LINK
+ select GRKERNSEC_FIFO
+ select GRKERNSEC_EXECVE
+ select GRKERNSEC_DMESG
+ select GRKERNSEC_FORKFAIL
+ select GRKERNSEC_TIME
+ select GRKERNSEC_SIGNAL
+ select GRKERNSEC_CHROOT
+ select GRKERNSEC_CHROOT_SHMAT
+ select GRKERNSEC_CHROOT_UNIX
+ select GRKERNSEC_CHROOT_MOUNT
+ select GRKERNSEC_CHROOT_FCHDIR
+ select GRKERNSEC_CHROOT_PIVOT
+ select GRKERNSEC_CHROOT_DOUBLE
+ select GRKERNSEC_CHROOT_CHDIR
+ select GRKERNSEC_CHROOT_MKNOD
+ select GRKERNSEC_CHROOT_CAPS
+ select GRKERNSEC_CHROOT_SYSCTL
+ select GRKERNSEC_CHROOT_FINDTASK
+ select GRKERNSEC_PROC
+ select GRKERNSEC_PROC_MEMMAP if (PAX_NOEXEC || PAX_ASLR)
+ select GRKERNSEC_HIDESYM
+ select GRKERNSEC_BRUTE
+ select GRKERNSEC_PROC_USERGROUP
+ select GRKERNSEC_KMEM
+ select GRKERNSEC_RESLOG
+ select GRKERNSEC_RANDNET
+ select GRKERNSEC_PROC_ADD
+ select GRKERNSEC_CHROOT_CHMOD
+ select GRKERNSEC_CHROOT_NICE
+ select GRKERNSEC_AUDIT_MOUNT
+ select GRKERNSEC_MODHARDEN if (MODULES)
+ select GRKERNSEC_VM86 if (X86_32)
+ select GRKERNSEC_IO if (X86)
+ select GRKERNSEC_PROC_IPADDR
+ select GRKERNSEC_SYSCTL
+ select GRKERNSEC_SYSCTL_ON
+ select PAX
+ select PAX_RANDUSTACK
+ select PAX_ASLR
+ select PAX_RANDMMAP
+ select PAX_NOEXEC
+ select PAX_MPROTECT
+ select PAX_EI_PAX
+ select PAX_PT_PAX_FLAGS
+ select PAX_HAVE_ACL_FLAGS
+ select PAX_KERNEXEC if (X86 && (!X86_32 || X86_WP_WORKS_OK))
+ select PAX_MEMORY_UDEREF if (X86_32)
+ select PAX_RANDKSTACK if (X86_TSC && !X86_64)
+ select PAX_SEGMEXEC if (X86_32)
+ select PAX_PAGEEXEC
+ select PAX_EMUPLT if (ALPHA || PARISC || SPARC32 || SPARC64)
+ select PAX_EMUTRAMP if (PARISC)
+ select PAX_EMUSIGRT if (PARISC)
+ select PAX_ETEXECRELOCS if (ALPHA || IA64 || PARISC)
+ select PAX_REFCOUNT if (X86 || SPARC64)
+ select PAX_USERCOPY if ((X86 || PPC32 || PPC64 || SPARC32 || SPARC64) && (SLAB || SLUB || SLOB))
+ select PAX_MEMORY_SANITIZE
+ help
+ If you say Y here, a configuration will be used that is endorsed by
+ the Hardened Gentoo project. Therefore, many of the protections
+ made available by grsecurity and PaX will be enabled.
+
+ Hardened Gentoo's pre-defined security levels are designed to provide
+ a high level of security while minimizing incompatibilities with the
+ majority of available software. For further information, please
+ view <http://www.grsecurity.net> and <http://pax.grsecurity.net> as
+ well as the Hardened Gentoo Primer at
+ <http://www.gentoo.org/proj/en/hardened/primer.xml>.
+
+ This Hardened Gentoo [server] level is identical to the
+ Hardened Gentoo [workstation] level, but with the GRKERNSEC_IO,
+ PAX_KERNEXEC and PAX_NOELFRELOCS security features enabled.
+ Accordingly, this is the preferred security level if the system will
+ not be utilizing software incompatible with the aforementioned
+ grsecurity/PaX features.
+
+ You may wish to emerge paxctl, a utility which allows you to toggle
+ PaX features on problematic binaries on an individual basis. Note that
+ this only works for ELF binaries that contain a PT_PAX_FLAGS header.
+ Translated, this means that if you wish to toggle PaX features on
+ binaries provided by applications that are distributed only in binary
+ format (rather than being built locally from sources), you will need to
+ run paxctl -C on the binaries beforehand so as to inject the missing
+ headers.
+
+ When this level is selected, some options cannot be changed. However,
+ you may opt to fully customize the options that are selected by
+ choosing "Custom" in the Security Level menu. You may find it helpful
+ to inherit the options selected by the "Hardened Gentoo [server]"
+ security level as a starting point for further configuration. To
+ accomplish this, select this security level then exit the menuconfig
+ interface, saving changes when prompted. Then, run make menuconfig
+ again and select the "Custom" level.
+
+ Note that this security level probably should not be used if the
+ target system is a 32bit x86 virtualized guest. If you intend to run
+ the kernel in a 32bit x86 virtualized guest you will likely need to
+ disable the PAX_MEMORY_UDEREF option in order to avoid an unacceptable
+ impact on performance.
+
+config GRKERNSEC_HARDENED_SERVER_NO_RBAC
+ bool "Hardened Gentoo [server no rbac]"
+ select GRKERNSEC_LINK
+ select GRKERNSEC_FIFO
+ select GRKERNSEC_EXECVE
+ select GRKERNSEC_DMESG
+ select GRKERNSEC_FORKFAIL
+ select GRKERNSEC_TIME
+ select GRKERNSEC_SIGNAL
+ select GRKERNSEC_CHROOT
+ select GRKERNSEC_CHROOT_SHMAT
+ select GRKERNSEC_CHROOT_UNIX
+ select GRKERNSEC_CHROOT_MOUNT
+ select GRKERNSEC_CHROOT_FCHDIR
+ select GRKERNSEC_CHROOT_PIVOT
+ select GRKERNSEC_CHROOT_DOUBLE
+ select GRKERNSEC_CHROOT_CHDIR
+ select GRKERNSEC_CHROOT_MKNOD
+ select GRKERNSEC_CHROOT_CAPS
+ select GRKERNSEC_CHROOT_SYSCTL
+ select GRKERNSEC_CHROOT_FINDTASK
+ select GRKERNSEC_PROC
+ select GRKERNSEC_PROC_MEMMAP if (PAX_NOEXEC || PAX_ASLR)
+ select GRKERNSEC_HIDESYM
+ select GRKERNSEC_BRUTE
+ select GRKERNSEC_PROC_USERGROUP
+ select GRKERNSEC_KMEM
+ select GRKERNSEC_RESLOG
+ select GRKERNSEC_RANDNET
+ select GRKERNSEC_PROC_ADD
+ select GRKERNSEC_CHROOT_CHMOD
+ select GRKERNSEC_CHROOT_NICE
+ select GRKERNSEC_AUDIT_MOUNT
+ select GRKERNSEC_MODHARDEN if (MODULES)
+ select GRKERNSEC_VM86 if (X86_32)
+ select GRKERNSEC_IO if (X86)
+ select GRKERNSEC_PROC_IPADDR
+ select GRKERNSEC_SYSCTL
+ select GRKERNSEC_SYSCTL_ON
+ select GRKERNSEC_NO_RBAC
+ select PAX
+ select PAX_RANDUSTACK
+ select PAX_ASLR
+ select PAX_RANDMMAP
+ select PAX_NOEXEC
+ select PAX_MPROTECT
+ select PAX_EI_PAX
+ select PAX_PT_PAX_FLAGS
+ select PAX_NO_ACL_FLAGS
+ select PAX_KERNEXEC if (X86 && (!X86_32 || X86_WP_WORKS_OK))
+ select PAX_MEMORY_UDEREF if (X86_32)
+ select PAX_RANDKSTACK if (X86_TSC && !X86_64)
+ select PAX_SEGMEXEC if (X86_32)
+ select PAX_PAGEEXEC
+ select PAX_EMUPLT if (ALPHA || PARISC || SPARC32 || SPARC64)
+ select PAX_EMUTRAMP if (PARISC)
+ select PAX_EMUSIGRT if (PARISC)
+ select PAX_ETEXECRELOCS if (ALPHA || IA64 || PARISC)
+ select PAX_REFCOUNT if (X86 || SPARC64)
+ select PAX_USERCOPY if ((X86 || PPC32 || PPC64 || SPARC32 || SPARC64) && (SLAB || SLUB || SLOB))
+ select PAX_MEMORY_SANITIZE
+ help
+ If you say Y here, a configuration will be used that is endorsed by
+ the Hardened Gentoo project. Therefore, many of the protections
+ made available by grsecurity and PaX will be enabled.
+
+ Hardened Gentoo's pre-defined security levels are designed to provide
+ a high level of security while minimizing incompatibilities with the
+ majority of available software. For further information, please
+ view <http://www.grsecurity.net> and <http://pax.grsecurity.net> as
+ well as the Hardened Gentoo Primer at
+ <http://www.gentoo.org/proj/en/hardened/primer.xml>.
+
+ This Hardened Gentoo [server] level is identical to the
+ Hardened Gentoo [workstation] level, but with the GRKERNSEC_IO,
+ PAX_KERNEXEC and PAX_NOELFRELOCS security features enabled.
+ Accordingly, this is the preferred security level if the system will
+ not be utilizing software incompatible with the aforementioned
+ grsecurity/PaX features.
+
+ You may wish to emerge paxctl, a utility which allows you to toggle
+ PaX features on problematic binaries on an individual basis. Note that
+ this only works for ELF binaries that contain a PT_PAX_FLAGS header.
+ Translated, this means that if you wish to toggle PaX features on
+ binaries provided by applications that are distributed only in binary
+ format (rather than being built locally from sources), you will need to
+ run paxctl -C on the binaries beforehand so as to inject the missing
+ headers.
+
+ When this level is selected, some options cannot be changed. However,
+ you may opt to fully customize the options that are selected by
+ choosing "Custom" in the Security Level menu. You may find it helpful
+ to inherit the options selected by the "Hardened Gentoo [server]"
+ security level as a starting point for further configuration. To
+ accomplish this, select this security level then exit the menuconfig
+ interface, saving changes when prompted. Then, run make menuconfig
+ again and select the "Custom" level.
+
+ Note that this security level probably should not be used if the
+ target system is a 32bit x86 virtualized guest. If you intend to run
+ the kernel in a 32bit x86 virtualized guest you will likely need to
+ disable the PAX_MEMORY_UDEREF option in order to avoid an unacceptable
+ impact on performance.
+
+config GRKERNSEC_HARDENED_WORKSTATION
+ bool "Hardened Gentoo [workstation]"
+ select GRKERNSEC_LINK
+ select GRKERNSEC_FIFO
+ select GRKERNSEC_EXECVE
+ select GRKERNSEC_DMESG
+ select GRKERNSEC_FORKFAIL
+ select GRKERNSEC_TIME
+ select GRKERNSEC_SIGNAL
+ select GRKERNSEC_CHROOT
+ select GRKERNSEC_CHROOT_SHMAT
+ select GRKERNSEC_CHROOT_UNIX
+ select GRKERNSEC_CHROOT_MOUNT
+ select GRKERNSEC_CHROOT_FCHDIR
+ select GRKERNSEC_CHROOT_PIVOT
+ select GRKERNSEC_CHROOT_DOUBLE
+ select GRKERNSEC_CHROOT_CHDIR
+ select GRKERNSEC_CHROOT_MKNOD
+ select GRKERNSEC_CHROOT_CAPS
+ select GRKERNSEC_CHROOT_SYSCTL
+ select GRKERNSEC_CHROOT_FINDTASK
+ select GRKERNSEC_PROC
+ select GRKERNSEC_PROC_MEMMAP if (PAX_NOEXEC || PAX_ASLR)
+ select GRKERNSEC_HIDESYM
+ select GRKERNSEC_BRUTE
+ select GRKERNSEC_PROC_USERGROUP
+ select GRKERNSEC_KMEM
+ select GRKERNSEC_RESLOG
+ select GRKERNSEC_RANDNET
+ select GRKERNSEC_CHROOT_CHMOD
+ select GRKERNSEC_CHROOT_NICE
+ select GRKERNSEC_AUDIT_MOUNT
+ select GRKERNSEC_MODHARDEN if (MODULES)
+ select GRKERNSEC_VM86 if (X86_32)
+ select GRKERNSEC_PROC_IPADDR
+ select GRKERNSEC_SYSCTL
+ select GRKERNSEC_SYSCTL_ON
+ select PAX
+ select PAX_RANDUSTACK
+ select PAX_ASLR
+ select PAX_RANDMMAP
+ select PAX_NOEXEC
+ select PAX_MPROTECT
+ select PAX_EI_PAX
+ select PAX_PT_PAX_FLAGS
+ select PAX_HAVE_ACL_FLAGS
+ # select PAX_KERNEXEC if (X86 && (!X86_32 || X86_WP_WORKS_OK))
+ select PAX_MEMORY_UDEREF if (X86_32)
+ select PAX_RANDKSTACK if (X86_TSC && !X86_64)
+ select PAX_SEGMEXEC if (X86_32)
+ select PAX_PAGEEXEC
+ select PAX_EMUPLT if (ALPHA || PARISC || SPARC32 || SPARC64)
+ select PAX_EMUTRAMP if (PARISC)
+ select PAX_EMUSIGRT if (PARISC)
+ select PAX_ETEXECRELOCS if (ALPHA || IA64 || PARISC)
+ select PAX_REFCOUNT if (X86 || SPARC64)
+ select PAX_USERCOPY if ((X86 || PPC32 || PPC64 || SPARC32 || SPARC64) && (SLAB || SLUB || SLOB))
+ select PAX_MEMORY_SANITIZE
+ help
+ If you say Y here, a configuration will be used that is endorsed by
+ the Hardened Gentoo project. Therefore, many of the protections
+ made available by grsecurity and PaX will be enabled.
+
+ Hardened Gentoo's pre-defined security levels are designed to provide
+ a high level of security while minimizing incompatibilities with the
+ majority of available software. For further information, please
+ view <http://www.grsecurity.net> and <http://pax.grsecurity.net> as
+ well as the Hardened Gentoo Primer at
+ <http://www.gentoo.org/proj/en/hardened/primer.xml>.
+
+ This Hardened Gentoo [workstation] level is designed for machines
+ which are intended to run software not compatible with the
+ GRKERNSEC_IO, PAX_KERNEXEC and PAX_NOELFRELOCS features of grsecurity.
+ Accordingly, this security level is suitable for use with the X server
+ "Xorg" and/or any system that will act as host OS to the virtualization
+ softwares vmware-server or virtualbox.
+
+ You may wish to emerge paxctl, a utility which allows you to toggle
+ PaX features on problematic binaries on an individual basis. Note that
+ this only works for ELF binaries that contain a PT_PAX_FLAGS header.
+ Translated, this means that if you wish to toggle PaX features on
+ binaries provided by applications that are distributed only in binary
+ format (rather than being built locally from sources), you will need to
+ run paxctl -C on the binaries beforehand so as to inject the missing
+ headers.
+
+ When this level is selected, some options cannot be changed. However,
+ you may opt to fully customize the options that are selected by
+ choosing "Custom" in the Security Level menu. You may find it helpful
+ to inherit the options selected by the "Hardened Gentoo [workstation]"
+ security level as a starting point for further configuration. To
+ accomplish this, select this security level then exit the menuconfig
+ interface, saving changes when prompted. Then, run make menuconfig
+ again and select the "Custom" level.
+
+ Note that this security level probably should not be used if the
+ target system is a 32bit x86 virtualized guest. If you intend to run
+ the kernel in a 32bit x86 virtualized guest you will likely need to
+ disable the PAX_MEMORY_UDEREF option in order to avoid an unacceptable
+ impact on performance.
+
+config GRKERNSEC_HARDENED_WORKSTATION_NO_RBAC
+ bool "Hardened Gentoo [workstation no rbac]"
+ select GRKERNSEC_LINK
+ select GRKERNSEC_FIFO
+ select GRKERNSEC_EXECVE
+ select GRKERNSEC_DMESG
+ select GRKERNSEC_FORKFAIL
+ select GRKERNSEC_TIME
+ select GRKERNSEC_SIGNAL
+ select GRKERNSEC_CHROOT
+ select GRKERNSEC_CHROOT_SHMAT
+ select GRKERNSEC_CHROOT_UNIX
+ select GRKERNSEC_CHROOT_MOUNT
+ select GRKERNSEC_CHROOT_FCHDIR
+ select GRKERNSEC_CHROOT_PIVOT
+ select GRKERNSEC_CHROOT_DOUBLE
+ select GRKERNSEC_CHROOT_CHDIR
+ select GRKERNSEC_CHROOT_MKNOD
+ select GRKERNSEC_CHROOT_CAPS
+ select GRKERNSEC_CHROOT_SYSCTL
+ select GRKERNSEC_CHROOT_FINDTASK
+ select GRKERNSEC_PROC
+ select GRKERNSEC_PROC_MEMMAP if (PAX_NOEXEC || PAX_ASLR)
+ select GRKERNSEC_HIDESYM
+ select GRKERNSEC_BRUTE
+ select GRKERNSEC_PROC_USERGROUP
+ select GRKERNSEC_KMEM
+ select GRKERNSEC_RESLOG
+ select GRKERNSEC_RANDNET
+ select GRKERNSEC_CHROOT_CHMOD
+ select GRKERNSEC_CHROOT_NICE
+ select GRKERNSEC_AUDIT_MOUNT
+ select GRKERNSEC_MODHARDEN if (MODULES)
+ select GRKERNSEC_VM86 if (X86_32)
+ select GRKERNSEC_PROC_IPADDR
+ select GRKERNSEC_SYSCTL
+ select GRKERNSEC_SYSCTL_ON
+ select GRKERNSEC_NO_RBAC
+ select PAX
+ select PAX_RANDUSTACK
+ select PAX_ASLR
+ select PAX_RANDMMAP
+ select PAX_NOEXEC
+ select PAX_MPROTECT
+ select PAX_EI_PAX
+ select PAX_PT_PAX_FLAGS
+ select PAX_NO_ACL_FLAGS
+ # select PAX_KERNEXEC if (X86 && (!X86_32 || X86_WP_WORKS_OK))
+ select PAX_MEMORY_UDEREF if (X86_32)
+ select PAX_RANDKSTACK if (X86_TSC && !X86_64)
+ select PAX_SEGMEXEC if (X86_32)
+ select PAX_PAGEEXEC
+ select PAX_EMUPLT if (ALPHA || PARISC || SPARC32 || SPARC64)
+ select PAX_EMUTRAMP if (PARISC)
+ select PAX_EMUSIGRT if (PARISC)
+ select PAX_ETEXECRELOCS if (ALPHA || IA64 || PARISC)
+ select PAX_REFCOUNT if (X86 || SPARC64)
+ select PAX_USERCOPY if ((X86 || PPC32 || PPC64 || SPARC32 || SPARC64) && (SLAB || SLUB || SLOB))
+ select PAX_MEMORY_SANITIZE
+ help
+ If you say Y here, a configuration will be used that is endorsed by
+ the Hardened Gentoo project. Therefore, many of the protections
+ made available by grsecurity and PaX will be enabled.
+
+ Hardened Gentoo's pre-defined security levels are designed to provide
+ a high level of security while minimizing incompatibilities with the
+ majority of available software. For further information, please
+ view <http://www.grsecurity.net> and <http://pax.grsecurity.net> as
+ well as the Hardened Gentoo Primer at
+ <http://www.gentoo.org/proj/en/hardened/primer.xml>.
+
+ This Hardened Gentoo [workstation] level is designed for machines
+ which are intended to run software not compatible with the
+ GRKERNSEC_IO, PAX_KERNEXEC and PAX_NOELFRELOCS features of grsecurity.
+ Accordingly, this security level is suitable for use with the X server
+ "Xorg" and/or any system that will act as host OS to the virtualization
+ softwares vmware-server or virtualbox.
+
+ You may wish to emerge paxctl, a utility which allows you to toggle
+ PaX features on problematic binaries on an individual basis. Note that
+ this only works for ELF binaries that contain a PT_PAX_FLAGS header.
+ Translated, this means that if you wish to toggle PaX features on
+ binaries provided by applications that are distributed only in binary
+ format (rather than being built locally from sources), you will need to
+ run paxctl -C on the binaries beforehand so as to inject the missing
+ headers.
+
+ When this level is selected, some options cannot be changed. However,
+ you may opt to fully customize the options that are selected by
+ choosing "Custom" in the Security Level menu. You may find it helpful
+ to inherit the options selected by the "Hardened Gentoo [workstation]"
+ security level as a starting point for further configuration. To
+ accomplish this, select this security level then exit the menuconfig
+ interface, saving changes when prompted. Then, run make menuconfig
+ again and select the "Custom" level.
+
+ Note that this security level probably should not be used if the
+ target system is a 32bit x86 virtualized guest. If you intend to run
+ the kernel in a 32bit x86 virtualized guest you will likely need to
+ disable the PAX_MEMORY_UDEREF option in order to avoid an unacceptable
+ impact on performance.
+
config GRKERNSEC_CUSTOM
bool "Custom"
help
|