From bd7d63f90ab4e903b1fb807d2267256e8958fce5 Mon Sep 17 00:00:00 2001 From: elratt0r <6256988+elratt0r@users.noreply.github.com> Date: Sat, 18 Jan 2025 00:04:09 +0100 Subject: [PATCH 1/2] cockpit: fix listen port (#371245) (cherry picked from commit c460b15aa0aafa68dab1f8b48f2d9b9392e62457) --- nixos/modules/services/monitoring/cockpit.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/services/monitoring/cockpit.nix b/nixos/modules/services/monitoring/cockpit.nix index 31620b31eb31..0ea4a5c163f8 100644 --- a/nixos/modules/services/monitoring/cockpit.nix +++ b/nixos/modules/services/monitoring/cockpit.nix @@ -55,6 +55,7 @@ in { systemd.packages = [ cfg.package ]; systemd.sockets.cockpit.wantedBy = [ "multi-user.target" ]; + systemd.sockets.cockpit.listenStreams = [ "" (toString cfg.port) ]; systemd.tmpfiles.rules = [ # From $out/lib/tmpfiles.d/cockpit-tmpfiles.conf "C /run/cockpit/inactive.motd 0640 root root - ${cfg.package}/share/cockpit/motd/inactive.motd" From a911ce455bb66ef718b30332e117c0f695b6edbd Mon Sep 17 00:00:00 2001 From: elratt0r <6256988+elratt0r@users.noreply.github.com> Date: Sat, 18 Jan 2025 01:05:35 +0100 Subject: [PATCH 2/2] cockpit: extend test case to not use default port Closes: #371245 (cherry picked from commit 442e818b52bd9a1287c433d36383a08cac9682dc) --- nixos/tests/cockpit.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nixos/tests/cockpit.nix b/nixos/tests/cockpit.nix index 5236f5311f02..0433cebf3b56 100644 --- a/nixos/tests/cockpit.nix +++ b/nixos/tests/cockpit.nix @@ -21,10 +21,11 @@ import ./make-test-python.nix ( }; services.cockpit = { enable = true; + port = 7890; openFirewall = true; settings = { WebService = { - Origins = "https://server:9090"; + Origins = "https://server:7890"; }; }; }; @@ -65,7 +66,7 @@ import ./make-test-python.nix ( driver.implicitly_wait(10) log("Opening homepage") - driver.get("https://server:9090") + driver.get("https://server:7890") def wait_elem(by, query, timeout=10): @@ -107,7 +108,7 @@ import ./make-test-python.nix ( driver.find_element(By.CSS_SELECTOR, 'button#login-button').click() # driver.implicitly_wait(1) - # driver.get("https://server:9090/system") + # driver.get("https://server:7890/system") log("Waiting dashboard to load") wait_title_contains("${user}@server") @@ -143,9 +144,9 @@ import ./make-test-python.nix ( start_all() server.wait_for_unit("sockets.target") - server.wait_for_open_port(9090) + server.wait_for_open_port(7890) - client.succeed("curl -k https://server:9090 -o /dev/stderr") + client.succeed("curl -k https://server:7890 -o /dev/stderr") print(client.succeed("whoami")) client.succeed('PYTHONUNBUFFERED=1 selenium-script') '';