|
51 | 51 | # nixos-rebuild boot
|
52 | 52 | # reboot
|
53 | 53 | </programlisting>
|
| 54 | + <note><para> |
| 55 | + Enabling the grsecurity module overrides |
| 56 | + <option>boot.kernelPackages</option>, to reduce the risk of |
| 57 | + misconfiguration. <xref linkend="sec-grsec-custom-kernel" /> |
| 58 | + describes how to use a custom kernel package set. |
| 59 | + </para></note> |
| 60 | + |
54 | 61 | For most users, further configuration should be unnecessary. All users
|
55 | 62 | are encouraged to look over <xref linkend="sec-grsec-security" /> before
|
56 | 63 | using the system, however. If you experience problems, please refer to
|
|
205 | 212 | </para>
|
206 | 213 |
|
207 | 214 | <para>
|
208 |
| - To use a custom kernel with upstream's recommended settings for server |
209 |
| - deployments: |
| 215 | + To build a custom kernel using upstream's recommended settings for server |
| 216 | + deployments, while still using the NixOS module: |
210 | 217 | <programlisting>
|
211 |
| - boot.kernelPackages = |
212 |
| - let |
213 |
| - kernel = pkgs.linux_grsec_nixos.override { |
214 |
| - extraConfig = '' |
215 |
| - GRKERNSEC_CONFIG_AUTO y |
216 |
| - GRKERNSEC_CONFIG_SERVER y |
217 |
| - GRKERNSEC_CONFIG_SECURITY y |
218 |
| - ''; |
| 218 | + nixpkgs.config.packageOverrides = super: { |
| 219 | + linux_grsec_nixos = super.linux_grsec_nixos.override { |
| 220 | + extraConfig = '' |
| 221 | + GRKERNSEC_CONFIG_AUTO y |
| 222 | + GRKERNSEC_CONFIG_SERVER y |
| 223 | + GRKERNSEC_CONFIG_SECURITY y |
| 224 | + ''; |
219 | 225 | };
|
220 |
| - self = pkgs.linuxPackagesFor kernel self; |
221 |
| - in self; |
| 226 | + } |
222 | 227 | </programlisting>
|
| 228 | + </para> |
| 229 | + |
| 230 | + <para> |
223 | 231 | The wikibook provides an exhaustive listing of
|
224 | 232 | <link xlink:href="https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options">kernel configuration options</link>.
|
225 | 233 | </para>
|
|
228 | 236 | The NixOS module makes several assumptions about the kernel and so
|
229 | 237 | may be incompatible with your customised kernel. Currently, the only way
|
230 | 238 | to work around incompatibilities is to eschew the NixOS module.
|
| 239 | + |
| 240 | + If not using the NixOS module, a custom grsecurity package set can |
| 241 | + be specified inline instead, as in |
| 242 | + <programlisting> |
| 243 | + boot.kernelPackages = |
| 244 | + let |
| 245 | + kernel = pkgs.linux_grsec_nixos.override { |
| 246 | + extraConfig = /* as above */; |
| 247 | + }; |
| 248 | + self = pkgs.linuxPackagesFor kernel self; |
| 249 | + in self; |
| 250 | + </programlisting> |
231 | 251 | </para>
|
232 | 252 |
|
233 | 253 | </sect1>
|
|
0 commit comments