Skip to content

Commit

Permalink
nixos/taskserver: Fix manual PKI management
Browse files Browse the repository at this point in the history
The helper tool had a very early check whether the automatically created
CA key/cert are available and thus it would abort if the key was
unavailable even though we don't need or even want to have the CA key.

Unfortunately our NixOS test didn't catch this, because it was just
switching from a configuration with an automatically created CA to a
manual configuration without deleting the generated keys and certs.

This is done now in the tests and it's also fixed in the helper tool.

Reported-by: @jpotier
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Tested-by: @jpotier
(cherry picked from commit b618843)
  • Loading branch information
aszlig committed Jul 17, 2017
1 parent 292343c commit 4d1e1d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/modules/services/misc/taskserver/helper-tool.py
Expand Up @@ -448,6 +448,8 @@ def cli(ctx):
"""
Manage Taskserver users and certificates
"""
if not IS_AUTO_CONFIG:
return
for path in (CA_KEY, CA_CERT, CRL_FILE):
if not os.path.exists(path):
msg = "CA setup not done or incomplete, missing file {}."
Expand Down
4 changes: 4 additions & 0 deletions nixos/tests/taskserver.nix
Expand Up @@ -246,6 +246,10 @@ in {
};
subtest "check manual configuration", sub {
# Remove the keys from automatic CA creation, to make sure the new
# generation doesn't use keys from before.
$server->succeed('rm -rf ${cfg.dataDir}/keys/* >&2');
$server->succeed('${switchToNewServer} >&2');
$server->waitForUnit("taskserver.service");
$server->waitForOpenPort(${portStr});
Expand Down

0 comments on commit 4d1e1d0

Please sign in to comment.