diff options
author | Niklas Hambüchen <mail@nh2.me> | 2022-10-25 15:53:43 +0200 |
---|---|---|
committer | Kerstin <kerstin@erictapen.name> | 2022-10-25 23:11:50 +0200 |
commit | f5c53868700881084a0d132aa18e24d3b71698a3 (patch) | |
tree | b07e9d002016b8876e268afa521b1872d2debb0f | |
parent | ac6cf8a78b688fdae6e4f6c3008a0b3925d3f22d (diff) | |
download | nixpkgs-f5c53868700881084a0d132aa18e24d3b71698a3.tar nixpkgs-f5c53868700881084a0d132aa18e24d3b71698a3.tar.gz nixpkgs-f5c53868700881084a0d132aa18e24d3b71698a3.tar.bz2 nixpkgs-f5c53868700881084a0d132aa18e24d3b71698a3.tar.lz nixpkgs-f5c53868700881084a0d132aa18e24d3b71698a3.tar.xz nixpkgs-f5c53868700881084a0d132aa18e24d3b71698a3.tar.zst nixpkgs-f5c53868700881084a0d132aa18e24d3b71698a3.zip |
nixos/smokeping: Don't show `413 Forbidden` on thttpd `/`. Fixes #197704
-rw-r--r-- | nixos/modules/services/networking/smokeping.nix | 11 | ||||
-rw-r--r-- | nixos/tests/smokeping.nix | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix index df4f8905ec6..3a5fb7dfb9e 100644 --- a/nixos/modules/services/networking/smokeping.nix +++ b/nixos/modules/services/networking/smokeping.nix @@ -318,6 +318,17 @@ in description = "smokeping daemon user"; home = smokepingHome; createHome = true; + # When `cfg.webService` is enabled, `thttpd` makes SmokePing available + # under `${cfg.host}:${cfg.port}/smokeping.fcgi` as per the `ln -s` below. + # We also want that going to `${cfg.host}:${cfg.port}` without `smokeping.fcgi` + # makes it easy for the user to find SmokePing. + # However `thttpd` does not seem to support easy redirections from `/` to `smokeping.fcgi` + # and only allows directory listings or `/` -> `index.html` resolution if the directory + # has `chmod 755` (see https://acme.com/software/thttpd/thttpd_man.html#PERMISSIONS, + # " directories should be 755 if you want to allow indexing"). + # Otherwise it shows `403 Forbidden` on `/`. + # Thus, we need to make `smokepingHome` (which is given to `thttpd -d` below) `755`. + homeMode = "755"; }; users.groups.${cfg.user} = {}; systemd.services.smokeping = { diff --git a/nixos/tests/smokeping.nix b/nixos/tests/smokeping.nix index ccacf60cfe4..04f81396429 100644 --- a/nixos/tests/smokeping.nix +++ b/nixos/tests/smokeping.nix @@ -28,6 +28,8 @@ import ./make-test-python.nix ({ pkgs, ...} : { sm.wait_for_unit("thttpd") sm.wait_for_file("/var/lib/smokeping/data/Local/LocalMachine.rrd") sm.succeed("curl -s -f localhost:8081/smokeping.fcgi?target=Local") + # Check that there's a helpful page without explicit path as well. + sm.succeed("curl -s -f localhost:8081") sm.succeed("ls /var/lib/smokeping/cache/Local/LocalMachine_mini.png") sm.succeed("ls /var/lib/smokeping/cache/index.html") ''; |