diff --git a/nixos/doc/manual/configuration/ssh.section.md b/nixos/doc/manual/configuration/ssh.section.md
index cba81eb43f49..9e239a848178 100644
--- a/nixos/doc/manual/configuration/ssh.section.md
+++ b/nixos/doc/manual/configuration/ssh.section.md
@@ -8,7 +8,7 @@ services.openssh.enable = true;
By default, root logins using a password are disallowed. They can be
disabled entirely by setting
-[](#opt-services.openssh.permitRootLogin) to `"no"`.
+[](#opt-services.openssh.settings.PermitRootLogin) to `"no"`.
You can declaratively specify authorised RSA/DSA public keys for a user
as follows:
diff --git a/nixos/doc/manual/from_md/configuration/ssh.section.xml b/nixos/doc/manual/from_md/configuration/ssh.section.xml
index a330457f51d6..e0d4031443ef 100644
--- a/nixos/doc/manual/from_md/configuration/ssh.section.xml
+++ b/nixos/doc/manual/from_md/configuration/ssh.section.xml
@@ -9,7 +9,7 @@ services.openssh.enable = true;
By default, root logins using a password are disallowed. They can be
disabled entirely by setting
- to
+ to
"no".
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
index d6dea111b97b..e1317621418d 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
@@ -324,6 +324,24 @@
services.usbmuxd.package
+
+
+ A few openssh options have been moved from extraConfig to the
+ new freeform option settings and renamed as
+ follow:
+ services.openssh.kbdInteractiveAuthentication
+ to
+ services.openssh.settings.KbdInteractiveAuthentication,
+ services.openssh.passwordAuthentication to
+ services.openssh.settings.PasswordAuthentication,
+ services.openssh.useDns to
+ services.openssh.settings.UseDns,
+ services.openssh.permitRootLogin to
+ services.openssh.settings.PermitRootLogin,
+ services.openssh.logLevel to
+ services.openssh.settings.LogLevel.
+
+ services.mastodon gained a tootctl wrapped
diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md
index beffe19c2ea7..1620e98f3aa3 100644
--- a/nixos/doc/manual/release-notes/rl-2305.section.md
+++ b/nixos/doc/manual/release-notes/rl-2305.section.md
@@ -85,6 +85,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- The module `usbmuxd` now has the ability to change the package used by the daemon. In case you're experiencing issues with `usbmuxd` you can try an alternative program like `usbmuxd2`. Available as [services.usbmuxd.package](#opt-services.usbmuxd.package)
+- A few openssh options have been moved from extraConfig to the new freeform option `settings` and renamed as follow: `services.openssh.kbdInteractiveAuthentication` to `services.openssh.settings.KbdInteractiveAuthentication`, `services.openssh.passwordAuthentication` to `services.openssh.settings.PasswordAuthentication`, `services.openssh.useDns` to `services.openssh.settings.UseDns`, `services.openssh.permitRootLogin` to `services.openssh.settings.PermitRootLogin`, `services.openssh.logLevel` to `services.openssh.settings.LogLevel`.
+
- `services.mastodon` gained a tootctl wrapped named `mastodon-tootctl` similar to `nextcloud-occ` which can be executed from any user and switches to the configured mastodon user with sudo and sources the environment variables.
- The `dnsmasq` service now takes configuration via the
diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix
index 4d9bd69666c0..980720691a43 100644
--- a/nixos/modules/profiles/installation-device.nix
+++ b/nixos/modules/profiles/installation-device.nix
@@ -72,7 +72,7 @@ with lib;
# mounting the storage in a different system.
services.openssh = {
enable = true;
- permitRootLogin = "yes";
+ settings.PermitRootLogin = "yes";
};
# Enable wpa_supplicant, but don't start it by default.
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index 37d7518ab3c4..3a8640171b70 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -12,8 +12,23 @@ let
then cfgc.package
else pkgs.buildPackages.openssh;
+ # reports boolean as yes / no
+ mkValueStringSshd = v:
+ if isInt v then toString v
+ else if isString v then v
+ else if true == v then "yes"
+ else if false == v then "no"
+ else throw "unsupported type ${typeOf v}: ${(lib.generators.toPretty {}) v}";
+
+ # dont use the "=" operator
+ settingsFormat = (pkgs.formats.keyValue {
+ mkKeyValue = lib.generators.mkKeyValueDefault {
+ mkValueString = mkValueStringSshd;
+ } " ";});
+
+ configFile = settingsFormat.generate "config" cfg.settings;
sshconf = pkgs.runCommand "sshd.conf-validated" { nativeBuildInputs = [ validationPackage ]; } ''
- cat >$out <$out <