-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
nixos/unbound: add enableRemoteAccess option #79559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
installPhase = '' | ||
mkdir -p "$out/bin" | ||
makeWrapper ${pkgs.unbound}/bin/unbound-control $out/bin/unbound-control \ | ||
--add-flags "-c ${stateDir}/unbound.conf" | ||
makeWrapper ${pkgs.unbound}/bin/unbound-checkconf $out/bin/unbound-checkconf \ | ||
--add-flags "${stateDir}/unbound.conf" | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, I was supremely annoyed with the previous behavior.
server-key-file: ${stateDir}/unbound_server.key | ||
server-cert-file: ${stateDir}/unbound_server.pem | ||
control-key-file: ${stateDir}/unbound_control.key | ||
control-cert-file: ${stateDir}/unbound_control.pem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these going to be correctly auto-gen'd when the cfg is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just verified this since it was a long time since I wrote this and it works for me 👍
Option that sets remote-control setting to true in unbound.conf which in turn enables the new wrapping of unbound-control to access the server locally. Also includes options 'remoteAccessInterfaces' and 'remoteAccessPort' for remote access.
}; | ||
|
||
remoteAccessInterfaces = mkOption { | ||
default = [ "127.0.0.1" ] ++ optional config.networking.enableIPv6 "::1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added check for enableIPv6
I'd rather we went with a design as described in RFC 42 for this module. I guess we can keep the existing options and build on top of that. I'll try something and mention it here. |
@@ -126,11 +188,12 @@ in | |||
''} | |||
touch ${stateDir}/dev/random | |||
${pkgs.utillinux}/bin/mount --bind -n /dev/urandom ${stateDir}/dev/random | |||
${optionalString cfg.enableRemoteAccess "${pkgs.unbound}/bin/unbound-control-setup -d ${stateDir}"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be cfg.package
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly don't know. Saw your new PR, gj 👍. Keeping this one open til your is merged.
I marked this as stale due to inactivity. → More info |
Closing as #89572 is merged 🎉 |
Motivation for this change
unbound-control
which is installed with packageunbound
when activating the module wasn't able to access the server because it was looking for the config file in /etc so I thought I'd make options to enable this more easily.Things done
enableRemoteAccess
, an option that sets remote-control setting to true in unbound.conf127.0.0.1
and::1
by default. The interface + port can be altered with the other optionsremoteAccessInterfaces
andremoteAccessPort
for remote access.unbound-control
andunbound-checkconf
so it points to the config file instateDir
instead of the packages default configuration dir in /etcunbound-anchor
say the default dir for root key fil is under /nix/storeThoughts
I added the wrapping to systemPackages because I added
unbound-checkconf
to the wrapping.I could change this to
if that's better.
I am happy for pointers and tips of course :)
Checkboxes
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)