Skip to content

bind: Use rndc to control the daemon #26675

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

Merged
merged 1 commit into from
Jun 18, 2017
Merged

Conversation

kirelagin
Copy link
Member

No description provided.

@mention-bot
Copy link

@kirelagin, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @peti and @MarcWeber to be potential reviewers.

${pkgs.coreutils}/bin/mkdir -p /var/run/named
chown ${bindUser} /var/run/named
'';

script = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
script = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
reload = "${pkgs.bind.out}/sbin/rndc -k '/etc/bind/rndc.key' reload";
Copy link
Member

@Mic92 Mic92 Jun 18, 2017

Choose a reason for hiding this comment

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

/etc/bind/rndc.key is nice to have for other reasons,
but for simplicity, I would use the following in the unit file:

serviceConfig.ExecReload="${coreutils}/bin/kill -HUP $MAINPID";

Copy link
Member Author

Choose a reason for hiding this comment

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

man named says that

In routine operation, signals should not be used to control the nameserver; rndc should be used instead.

So, basically, signals will work, but they are not the right way of getting things done. As far as I understand the plan is to get rid of signals eventually (which is impossible, of course).

script = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
script = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
reload = "${pkgs.bind.out}/sbin/rndc -k '/etc/bind/rndc.key' reload";
preStop = "${pkgs.bind.out}/sbin/rndc -k '/etc/bind/rndc.key' stop";
Copy link
Member

Choose a reason for hiding this comment

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

What advantage do we get with this line? Is the SIGTERM signal not enough?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same thing. Doing things the right way.

Copy link
Member

Choose a reason for hiding this comment

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

Then it should be serviceConfig.ExecStop

${pkgs.coreutils}/bin/mkdir -p /var/run/named
chown ${bindUser} /var/run/named
'';

script = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
script = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
Copy link
Member

@Mic92 Mic92 Jun 18, 2017

Choose a reason for hiding this comment

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

This could be actually also rewritten as:

serviceConfig.ExecStart= "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f"

The shell script wrapper does not provide any benefit here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I agree. I have no idea why so many services use script instead of ExecStart for single line commands. I just did not feel like I was the one to change that. But if you insist, I can :).

Copy link
Member

Choose a reason for hiding this comment

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

Please do so. It is a left-over from the old upstart job.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Mic92 Mic92 merged commit f36cdf1 into NixOS:master Jun 18, 2017
@Mic92
Copy link
Member

Mic92 commented Jun 18, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants