nixos/onlyoffice: require a user supplied nonce (#462100)

This commit is contained in:
Arnout Engelen
2025-11-16 11:36:39 +00:00
committed by GitHub

View File

@@ -7,10 +7,6 @@
let let
cfg = config.services.onlyoffice; cfg = config.services.onlyoffice;
defaultNginxNonceFileContent = "set $secure_link_secret \"mynonce\";";
defaultNginxNonceFile = pkgs.writeText "onlyoffice-nonce-nginx.conf" ''
${defaultNginxNonceFileContent}
'';
in in
{ {
options.services.onlyoffice = { options.services.onlyoffice = {
@@ -26,17 +22,14 @@ in
securityNonceFile = lib.mkOption { securityNonceFile = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "${defaultNginxNonceFile}"; example = "/run/keys/onlyoffice-nginx-nonce.conf";
defaultText = lib.literalExpression ''
(pkgs.writeText "onlyoffice-nonce-nginx.conf" \'\'
${defaultNginxNonceFileContent}
\'\').outPath;
'';
description = '' description = ''
Path to a file that contains a secret to sign web requests. File holding nginx configuration that sets the nonce used to create secret links.
This file should set a 'secure_link_secret' nginx variable,
and ideally be managed by a Example:
[secret managing scheme](https://wiki.nixos.org/wiki/Comparison_of_secret_managing_schemes). ```
set $secure_link_secret "changeme";
```
''; '';
}; };
@@ -103,12 +96,6 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
warnings = [
(lib.optionalString (cfg.securityNonceFile == "${defaultNginxNonceFile}") ''
Please set `options.services.onlyoffice.securityNonceFile`
to avoid an (albeit unlikely) information disclosure issue.
'')
];
services = { services = {
nginx = { nginx = {
enable = lib.mkDefault true; enable = lib.mkDefault true;