From 7aa1b935cf83528985e20aa7b676166e28b1be6b Mon Sep 17 00:00:00 2001 From: bobberb Date: Tue, 8 Oct 2024 02:02:56 +0000 Subject: [PATCH 1/2] Onlyoffice - new boolean: allow LAN connections https://forum.onlyoffice.com/t/how-to-allow-private-ip-to-access-onlyoffice-documentserver/5755 --- nixos/modules/services/web-apps/onlyoffice.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/modules/services/web-apps/onlyoffice.nix b/nixos/modules/services/web-apps/onlyoffice.nix index 0d0e01d4f7bc05d..144fae2e29eb098 100644 --- a/nixos/modules/services/web-apps/onlyoffice.nix +++ b/nixos/modules/services/web-apps/onlyoffice.nix @@ -32,6 +32,12 @@ in description = "Port the OnlyOffice document server should listen on."; }; + allowLocalConnections = lib.mkOption { + type = lib.types.bool; + default = false; + description = "If true, allows clients with LAN-range IPs to access your instance."; + }; + examplePort = lib.mkOption { type = lib.types.port; default = null; @@ -221,6 +227,13 @@ in mkdir -p /run/onlyoffice/config/ /var/lib/onlyoffice/documentserver/sdkjs/{slide/themes,common}/ /var/lib/onlyoffice/documentserver/{fonts,server/FileConverter/bin}/ cp -r ${cfg.package}/etc/onlyoffice/documentserver/* /run/onlyoffice/config/ chmod u+w /run/onlyoffice/config/default.json + + #Allow LAN-range IPs if set true + ${lib.optionalString (cfg.allowLocalConnections) '' + sed -i 's/"allowPrivateIPAddress": false/"allowPrivateIPAddress": true/' /run/onlyoffice/config/default.json + sed -i 's/"allowMetaIPAddress": false/"allowMetaIPAddress": true/' /run/onlyoffice/config/default.json + ''} + # Allow members of the onlyoffice group to serve files under /var/lib/onlyoffice/documentserver/App_Data chmod g+x /var/lib/onlyoffice/documentserver From 9424057e923402cad8aeeaeb5549241b7c218709 Mon Sep 17 00:00:00 2001 From: bobberb Date: Tue, 8 Oct 2024 02:12:26 +0000 Subject: [PATCH 2/2] remove whitespace --- nixos/modules/services/web-apps/onlyoffice.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/web-apps/onlyoffice.nix b/nixos/modules/services/web-apps/onlyoffice.nix index 144fae2e29eb098..9246245bbc6c339 100644 --- a/nixos/modules/services/web-apps/onlyoffice.nix +++ b/nixos/modules/services/web-apps/onlyoffice.nix @@ -227,7 +227,7 @@ in mkdir -p /run/onlyoffice/config/ /var/lib/onlyoffice/documentserver/sdkjs/{slide/themes,common}/ /var/lib/onlyoffice/documentserver/{fonts,server/FileConverter/bin}/ cp -r ${cfg.package}/etc/onlyoffice/documentserver/* /run/onlyoffice/config/ chmod u+w /run/onlyoffice/config/default.json - + #Allow LAN-range IPs if set true ${lib.optionalString (cfg.allowLocalConnections) '' sed -i 's/"allowPrivateIPAddress": false/"allowPrivateIPAddress": true/' /run/onlyoffice/config/default.json