Skip to content

Commit

Permalink
Merge pull request NixOS#53767 from kwohlfahrt/ssh
Browse files Browse the repository at this point in the history
ssh: put custom options before generated options
  • Loading branch information
infinisil authored Feb 19, 2019
2 parents 358efb6 + de7abf6 commit 266315c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nixos/modules/programs/ssh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ in
type = types.lines;
default = "";
description = ''
Extra configuration text appended to <filename>ssh_config</filename>.
Extra configuration text prepended to <filename>ssh_config</filename>. Other generated
options will be added after a <code>Host *</code> pattern.
See <citerefentry><refentrytitle>ssh_config</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for help.
'';
Expand Down Expand Up @@ -203,6 +204,11 @@ in
# generation in the sshd service.
environment.etc."ssh/ssh_config".text =
''
# Custom options from `extraConfig`, to override generated options
${cfg.extraConfig}
# Generated options from other settings
Host *
AddressFamily ${if config.networking.enableIPv6 then "any" else "inet"}
${optionalString cfg.setXAuthLocation ''
Expand All @@ -213,8 +219,6 @@ in
${optionalString (cfg.pubkeyAcceptedKeyTypes != []) "PubkeyAcceptedKeyTypes ${concatStringsSep "," cfg.pubkeyAcceptedKeyTypes}"}
${optionalString (cfg.hostKeyAlgorithms != []) "HostKeyAlgorithms ${concatStringsSep "," cfg.hostKeyAlgorithms}"}
${cfg.extraConfig}
'';

environment.etc."ssh/ssh_known_hosts".text = knownHostsText;
Expand Down

0 comments on commit 266315c

Please sign in to comment.