File tree Expand file tree Collapse file tree 3 files changed +41
-9
lines changed
modules/services/monitoring Expand file tree Collapse file tree 3 files changed +41
-9
lines changed Original file line number Diff line number Diff line change 1212 mkEnableOption
1313 mkOption
1414 mkIf
15- literalMD
1615 mkPackageOption
1716 ;
1817 settingsFormat = pkgs . formats . ini { } ;
2625 default = [ "cockpit" ] ;
2726 } ;
2827
28+ allowed-origins = lib . mkOption {
29+ type = types . listOf types . str ;
30+
31+ default = [ ] ;
32+
33+ description = ''
34+ List of allowed origins.
35+
36+ Maps to the WebService.Origins setting and allows merging from multiple modules.
37+ '' ;
38+ } ;
39+
2940 settings = lib . mkOption {
3041 type = settingsFormat . type ;
3142
6273 # generate cockpit settings
6374 environment . etc . "cockpit/cockpit.conf" . source = settingsFormat . generate "cockpit.conf" cfg . settings ;
6475
65- security . pam . services . cockpit = { } ;
76+ security . pam . services . cockpit = {
77+ startSession = true ;
78+ } ;
6679
6780 networking . firewall . allowedTCPPorts = mkIf cfg . openFirewall [ cfg . port ] ;
6881
6982 systemd . packages = [ cfg . package ] ;
7083 systemd . sockets . cockpit . wantedBy = [ "multi-user.target" ] ;
7184 systemd . sockets . cockpit . listenStreams = [
72- ""
85+ "" # workaround so it doesn't listen on both ports caused by the runtime merging
7386 ( toString cfg . port )
7487 ] ;
7588
8093 "L+ /run/cockpit/motd - - - - inactive.motd"
8194 "d /etc/cockpit/ws-certs.d 0600 root root 0"
8295 ] ;
96+
97+ services . cockpit . allowed-origins = [
98+ "https://localhost:${ toString config . services . cockpit . port } "
99+ ] ;
100+
101+ services . cockpit . settings . WebService . Origins = builtins . concatStringsSep " " config . services . cockpit . allowed-origins ;
83102 } ;
84103
85104 meta . maintainers = pkgs . cockpit . meta . maintainers ;
Original file line number Diff line number Diff line change @@ -23,11 +23,9 @@ import ./make-test-python.nix (
2323 enable = true ;
2424 port = 7890 ;
2525 openFirewall = true ;
26- settings = {
27- WebService = {
28- Origins = "https://server:7890" ;
29- } ;
30- } ;
26+ allowed-origins = [
27+ "https://server:${ toString config . services . cockpit . port } "
28+ ] ;
3129 } ;
3230 } ;
3331 client =
@@ -130,7 +128,7 @@ import ./make-test-python.nix (
130128
131129 log("Checking that /nonexistent is not a thing")
132130 assert '/nonexistent' not in driver.page_source
133- assert driver.find_element (By.CSS_SELECTOR, '#machine-reconnect') is not None
131+ assert len( driver.find_elements (By.CSS_SELECTOR, '#machine-reconnect')) == 0
134132
135133 driver.close()
136134 '' ;
Original file line number Diff line number Diff line change 1414 git ,
1515 glib ,
1616 glib-networking ,
17+ gnused ,
1718 gnutls ,
19+ iproute2 ,
1820 json-glib ,
1921 krb5 ,
2022 libssh ,
3335 systemd ,
3436 udev ,
3537 xmlto ,
38+ which ,
3639} :
3740
3841stdenv . mkDerivation ( finalAttrs : {
@@ -63,6 +66,7 @@ stdenv.mkDerivation (finalAttrs: {
6366 python3Packages . setuptools
6467 systemd
6568 xmlto
69+ which
6670 ] ;
6771
6872 buildInputs = [
@@ -93,6 +97,9 @@ stdenv.mkDerivation (finalAttrs: {
9397 substituteInPlace src/common/cockpitconf.c \
9498 --replace-fail 'const char *cockpit_config_dirs[] = { PACKAGE_SYSCONF_DIR' 'const char *cockpit_config_dirs[] = { "/etc"'
9599
100+ substituteInPlace src/**/*.c \
101+ --replace '"/bin/sh"' "\"$(which sh)\""
102+
96103 # instruct users with problems to create a nixpkgs issue instead of nagging upstream directly
97104 substituteInPlace configure.ac \
98105 --replace-fail '[email protected] ' 'https://github.com/NixOS/nixpkgs/issues/new?assignees=&labels=0.kind%3A+bug&template=bug_report.md&title=cockpit%25' @@ -171,6 +178,14 @@ stdenv.mkDerivation (finalAttrs: {
171178 --prefix PYTHONPATH : $out/${ python3Packages . python . sitePackages }
172179 done
173180
181+ patchShebangs $out/share/cockpit/issue/update-issue
182+ wrapProgram $out/share/cockpit/issue/update-issue \
183+ --prefix PATH : ${ lib . makeBinPath [
184+ iproute2
185+ gnused
186+ ] }
187+
188+
174189 substituteInPlace $out/${ python3Packages . python . sitePackages } /cockpit/_vendor/systemd_ctypes/libsystemd.py \
175190 --replace-warn libsystemd.so.0 ${ systemd } /lib/libsystemd.so.0
176191
You can’t perform that action at this time.
0 commit comments