Skip to content
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

dnsmasq nixos: make sure it always runs #30319

Merged
merged 1 commit into from Oct 25, 2017
Merged

Conversation

peterhoeg
Copy link
Member

Motivation for this change

If dnsmasq has been enabled, we probably want to do what we can to make sure it keeps running so we always restart it.

Also lock down the service a bit.

Cc: @fpletz

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

PrivateTmp = true;
ProtectSystem = true;
ProtectHome = true;
Restart = "always";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Restart = "on-failure";?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I think Restart = "on-failure"; should be applied but as dnsmasq is a pretty critical piece of infrastructure, it should probably be running the whole time even if manually shut down.

You can very easily argue though that this is a policy we shouldn't be setting for our users.

Would you feel more comfortable if I made that a configuration setting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be configurable:

systemd.services.dnsmasq.serviceConfig.Restart = "always";

is simple enough.
Under which circumstances dnsmasq shuts down itself gracefully, when it should not? Sounds like the bug is somewhere else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed - if it exits with 0, we probably still want it to restart - it should simply be running all the time. Bug or no bug.

By default we only restart if the dnsmasq daemon fails but we introduce an
option to always keep it running.
@fpletz fpletz merged commit fd9ae92 into NixOS:master Oct 25, 2017
@peterhoeg peterhoeg deleted the f/dnsmasq branch October 25, 2017 02:56
@peterhoeg peterhoeg restored the f/dnsmasq branch October 25, 2017 05:16
@peterhoeg peterhoeg deleted the f/dnsmasq branch November 1, 2017 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants