Unverified Commit f46be218 authored by cr0n's avatar cr0n Committed by GitHub
Browse files

nixos/rsyncd: fix ini format for global section (#385064)

According to the manpage the rsyncd.conf has a global section without a
module header. Settings for listening port or bind address must be put
there and will not work if defined in a global submodule (i.e. below a
"[global]" header).

This commit changes the ini format generator for the rsyncd service to
allow a global section in the config file without a submodule header.

Fixes #304293

Credits to @nydragon

* remove retrocompat, add incompat release notes
parent 1de5bf89
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -443,6 +443,10 @@
- `services.netbird.tunnels` was renamed to [`services.netbird.clients`](#opt-services.netbird.clients),
  hardened (using dedicated less-privileged users) and significantly extended.

- `services.rsyncd.settings` now supports only two attributes `sections` and `globalSection`.
  As a result, all sections previously defined under `services.rsyncd.settings` must now be put in `services.rsyncd.settings.sections`.
  Global settings must now be placed in `services.rsyncd.settings.globalSection` instead of `services.rsyncd.settings.global`.

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

## Other Notable Changes {#sec-release-25.05-notable-changes}
+18 −15
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
}:
let
  cfg = config.services.rsyncd;
  settingsFormat = pkgs.formats.ini { };
  settingsFormat = pkgs.formats.iniWithGlobalSection { };
  configFile = settingsFormat.generate "rsyncd.conf" cfg.settings;
in
{
@@ -25,12 +25,14 @@ in
        inherit (settingsFormat) type;
        default = { };
        example = {
          global = {
          globalSection = {
            uid = "nobody";
            gid = "nobody";
            "use chroot" = true;
            "max connections" = 4;
            address = "0.0.0.0";
          };
          sections = {
            ftp = {
              path = "/var/ftp/./pub";
              comment = "whole ftp area";
@@ -45,6 +47,7 @@ in
              "secrets file" = "/etc/rsyncd.secrets";
            };
          };
        };
        description = ''
          Configuration for rsyncd. See
          {manpage}`rsyncd.conf(5)`.
@@ -81,7 +84,7 @@ in

  config = lib.mkIf cfg.enable {

    services.rsyncd.settings.global.port = toString cfg.port;
    services.rsyncd.settings.globalSection.port = toString cfg.port;

    systemd =
      let
+6 −4
Original line number Diff line number Diff line
@@ -15,10 +15,11 @@ import ./make-test-python.nix (
              enable = true;
              inherit socketActivated;
              settings = {
                global = {
                globalSection = {
                  "reverse lookup" = false;
                  "forward lookup" = false;
                };
                sections = {
                  tmp = {
                    path = "/nix/store";
                    comment = "test module";
@@ -26,6 +27,7 @@ import ./make-test-python.nix (
                };
              };
            };
          };
      in
      {
        a = mkNode false;