nixos/printing: make access to web-interface configurable

Otherwise you'd always get a 403 when hosting the web-interface of cups
at a different location than `localhost`.
This commit is contained in:
Maximilian Bosch 2020-04-25 19:48:34 +02:00
parent 083ea0abbe
commit 4062592f3a
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E

View File

@ -153,6 +153,16 @@ in
'';
};
allowFrom = mkOption {
type = types.listOf types.str;
default = [ "localhost" ];
example = [ "all" ];
apply = concatMapStringsSep "\n" (x: "Allow ${x}");
description = ''
From which hosts to allow unconditional access.
'';
};
bindirCmds = mkOption {
type = types.lines;
internal = true;
@ -403,19 +413,19 @@ in
<Location />
Order allow,deny
Allow localhost
${cfg.allowFrom}
</Location>
<Location /admin>
Order allow,deny
Allow localhost
${cfg.allowFrom}
</Location>
<Location /admin/conf>
AuthType Basic
Require user @SYSTEM
Order allow,deny
Allow localhost
${cfg.allowFrom}
</Location>
<Policy default>