From 33b3272692868d9a746f4f703c1d917fb7b9adb6 Mon Sep 17 00:00:00 2001 From: Florian Jacob Date: Sun, 10 Feb 2019 12:48:32 +0100 Subject: [PATCH] nixos/cups: Fix Unable to encrypt connection: Unable to create server credentials by creating /var/lib/cups/ssl directory. --- nixos/modules/services/printing/cupsd.nix | 4 ++++ nixos/tests/printing.nix | 2 ++ 2 files changed, 6 insertions(+) diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 1031d6f3d7e..3a43ebbb889 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -316,6 +316,10 @@ in mkdir -m 0755 -p ${cfg.tempDir} mkdir -m 0755 -p /var/lib/cups + # While cups will automatically create self-signed certificates if accessed via TLS, + # this directory to store the certificates needs to be created manually. + mkdir -m 0700 -p /var/lib/cups/ssl + # Backwards compatibility if [ ! -L /etc/cups ]; then mv /etc/cups/* /var/lib/cups diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix index d85abf3c105..7026637ead1 100644 --- a/nixos/tests/printing.nix +++ b/nixos/tests/printing.nix @@ -39,6 +39,8 @@ import ./make-test.nix ({pkgs, ... }: { $client->waitForUnit("cups.service"); $client->sleep(10); # wait until cups is fully initialized $client->succeed("lpstat -r") =~ /scheduler is running/ or die; + # check local encrypted connections work without error + $client->succeed("lpstat -E -r") =~ /scheduler is running/ or die; # Test that UNIX socket is used for connections. $client->succeed("lpstat -H") =~ "/var/run/cups/cups.sock" or die; # Test that HTTP server is available too.