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

nixos/nginx: use the directory given in the ACME configuration #29556

Closed
wants to merge 1 commit into from

Conversation

andrew-d
Copy link
Contributor

Motivation for this change

This is useful in cases where we'd like to store the ACME certificates
and keys in a more centralized location; for example, on a mounted EBS
volume in Amazon, or to centralize secrets in a centralized directory
for monitoring purposes.

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
    • Linux
  • 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.

@mention-bot
Copy link

@andrew-d, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fadenb, @fpletz and @globin to be potential reviewers.

@andrew-d andrew-d changed the title nixos/nginx: add 'acmeDir' option to configure nginx's ACME data nixos/nginx: add 'acmeDir' option to change ACME directory Sep 19, 2017
@andrew-d
Copy link
Contributor Author

Note that this is similar to the directory option in nixos/modules/security/acme.nix.

@andrew-d
Copy link
Contributor Author

cc @globin (last person to commit to this file) - thoughts?

@@ -13,8 +13,8 @@ let
vhostConfig // {
inherit serverName;
} // (optionalAttrs vhostConfig.enableACME {
sslCertificate = "/var/lib/acme/${serverName}/fullchain.pem";
sslCertificateKey = "/var/lib/acme/${serverName}/key.pem";
sslCertificate = "${cfg.acmeDir}/${serverName}/fullchain.pem";
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't tested this, but I think you should be able to use config.security.acme.directory directly here instead of making an nginx-specific wrapper option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it appears that this does work - just pushed a commit to use that instead. Thanks for the suggestion! 😀

@andrew-d andrew-d changed the title nixos/nginx: add 'acmeDir' option to change ACME directory nixos/nginx: use the directory given in the ACME configuration Sep 25, 2017
This commit changes the default `/var/lib/acme` directory to instead be
the directory that was specified in the acme config:
`config.security.acme.directory`.  This doesn't change anything by
default, since the default value of that option is the same.

This is useful in cases where we'd like to store the ACME certificates
and keys in a more centralized location; for example, on a mounted EBS
volume in Amazon, or to centralize secrets in a centralized directory
for monitoring purposes.
@andrew-d
Copy link
Contributor Author

andrew-d commented Oct 8, 2017

@aneeshusa - Thanks for the review! Just rebased & force-pushed, and the build is now passing.

@aneeshusa
Copy link
Contributor

This LGTM, but I don't have merge rights.

@andrew-d andrew-d closed this Apr 3, 2018
@andrew-d andrew-d deleted the adunham/nginx-acme branch June 5, 2018 05:15
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

5 participants