git.iko.soy/typeable/nixpkgs
on master help sign in
rngd: add option to run w/debug flag

Added while testing if adding hardening directives to the service blocked access to various sources, might be useful in the future.

commitb809071ffbfb58bad5baf7480b08e951bb0c2744 authorWill Dietz <w@wdtz.org> dateMon 6 May 2019, 01:43 (8 years ago) parent5e407fc
1 file changed+23−10
nixos/modules/security/rngd.nix+23−10
nixos/modules/security/rngd.nix+23−10
@@ -2,20 +2,30 @@
22
33with lib;
44
5+let
6+ cfg = config.security.rngd;
7+in
58{
69 options = {
7− security.rngd.enable = mkOption {
8− type = types.bool;
9− default = true;
10− description = ''
11− Whether to enable the rng daemon, which adds entropy from
12− hardware sources of randomness to the kernel entropy pool when
13− available.
14− '';
10+ security.rngd = {
11+ enable = mkOption {
12+ type = types.bool;
13+ default = true;
14+ description = ''
15+ Whether to enable the rng daemon, which adds entropy from
16+ hardware sources of randomness to the kernel entropy pool when
17+ available.
18+ '';
19+ };
20+ debug = mkOption {
21+ type = types.bool;
22+ default = false;
23+ description = "Whether to enable debug output (-d).";
24+ };
1525 };
1626 };
1727
18− config = mkIf config.security.rngd.enable {
28+ config = mkIf cfg.enable {
1929 services.udev.extraRules = ''
2030 KERNEL=="random", TAG+="systemd"
2131 SUBSYSTEM=="cpu", ENV{MODALIAS}=="cpu:type:x86,*feature:*009E*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="rngd.service"
@@ -29,7 +39,10 @@ with lib;
2939
3040 description = "Hardware RNG Entropy Gatherer Daemon";
3141
32− serviceConfig.ExecStart = "${pkgs.rng-tools}/sbin/rngd -f";
42+ serviceConfig = {
43+ ExecStart = "${pkgs.rng-tools}/sbin/rngd -f"
44+ + optionalString cfg.debug " -d";
45+ };
3346 };
3447 };
3548}