Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/ssh: add crypto options #41798

Merged
merged 1 commit into from Jun 8, 2020
Merged

nixos/ssh: add crypto options #41798

merged 1 commit into from Jun 8, 2020

Conversation

Izorkin
Copy link
Contributor

@Izorkin Izorkin commented Jun 10, 2018

Motivation for this change

Add custom options - PreferredAuthentications, KexAlgorithms, Ciphers, MACs.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.


This change is Reviewable

@grahamc
Copy link
Member

grahamc commented Jun 10, 2018

Is there a nice benefit to using the structured form here, compared to the extraConfig?

@Izorkin
Copy link
Contributor Author

Izorkin commented Jun 10, 2018

It seems to me that it looks better. Also, the user can see the description here https://nixos.org/nixos/options.html#programs.ssh. and apply it in your config

@oxij
Copy link
Member

oxij commented Jun 10, 2018 via email

@Izorkin
Copy link
Contributor Author

Izorkin commented Jun 10, 2018

@oxij variant with kexAlgorithms set to null not worked, error -
error: The option value programs.ssh.kexAlgorithms' in /home/test/src_nix/nixpkgs/nixos/modules/programs/ssh.nix' is not of type list of strings'.`
I do not plan to add all the options )

@oxij
Copy link
Member

oxij commented Jun 10, 2018 via email

@Izorkin Izorkin force-pushed the ssh-custom branch 3 times, most recently from d721e44 to 8d79b0b Compare June 14, 2018 05:15
@oxij oxij mentioned this pull request Jun 14, 2018
8 tasks
@qolii
Copy link
Contributor

qolii commented Jun 21, 2018

But what is your criteria for adding something

Honest question: what are ever the criteria? Is there a guideline? It seems like every module in the whole OS is subject to an arbitrary decision on how much of the configuration space to support "properly". Most modules of significant complexity seem not to support it all.

I've always seen deferring of module options to an extraConfig to be a necessary (due to manpower), but ultimately undesirable, practice, and thought that the more of the configuration space is supported, the better. Especially for something like sshd, where these things are quite stable; once the module code is in place, it should keep working and hopefully not need much maintenance.

What are the downsides? Worry about maintenance? Or does it bog down Hydra or something too?

@oxij
Copy link
Member

oxij commented Jun 21, 2018 via email

@Izorkin Izorkin force-pushed the ssh-custom branch 2 times, most recently from 4e3b5bd to 8791dab Compare July 21, 2018 12:18
@Izorkin Izorkin changed the title ssh: add custom options ssh: add crypto options Jul 21, 2018
@coretemp
Copy link
Contributor

If you write a script which translates sshd options into NixOS options, I think that would be something more people would welcome (at least, I would), but just adding code duplication (the ssh people already wrote that code) doesn't solve anything.

It's not as if NixOS would continue to support module options if the underlying tool would have removed it. As such for options for which NixOS cannot guarantee its continued support, manually created options don't make sense.

@aanderse
Copy link
Member

@Izorkin considering a few of these options have been implemented now and it seems unlikely the others will can we close this PR?

@Izorkin
Copy link
Contributor Author

Izorkin commented May 22, 2019

@aanderse, which options have been implemented? I've checked the code, and I don't see any changes to implement the options.

@aanderse
Copy link
Member

@Izorkin kexAlgorithms and ciphers appear on https://nixos.org/nixos/options.html#services.openssh.

@Izorkin
Copy link
Contributor Author

Izorkin commented May 22, 2019

This optins in openssh server. Such options are available for the openssh client.
https://man.openbsd.org/sshd_config#KexAlgorithms
https://man.openbsd.org/ssh_config#KexAlgorithms

@aanderse
Copy link
Member

@Izorkin ah sorry I only skimmed over this PR and didn't notice it was for the client software. Do you have any interest to rework this to include only the crypto options as @oxij mentioned?

@Izorkin
Copy link
Contributor Author

Izorkin commented May 22, 2019

@aanderse this variant normall?
Or preferredAuthentications remove?

@aanderse
Copy link
Member

I'm not sure if @oxij just meant kexAlgorithms and ciphers but that's what I assume.

@Izorkin
Copy link
Contributor Author

Izorkin commented May 22, 2019

preferredAuthentications removed.

@nixos-discourse
Copy link

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/15

@Izorkin
Copy link
Contributor Author

Izorkin commented Mar 23, 2020

Example ssh config after this PR:

  programs.ssh = {
    ...
    macs = [ "hmac-sha2-512-etm@openssh.com" "hmac-sha2-512" ];
    ciphers = [ "chacha20-poly1305@openssh.com" ];
    kexAlgorithms = [ "curve25519-sha256@libssh.org" ];
    ...
  };
  
  services.openssh = {
    ...
    macs = [ "hmac-sha2-512-etm@openssh.com" ];
    ciphers = [ "chacha20-poly1305@openssh.com" ];
    kexAlgorithms = [ "curve25519-sha256@libssh.org" ];
    ...
  };

@Izorkin Izorkin changed the title ssh: add crypto options nixos/ssh: add crypto options Mar 23, 2020
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-in-distress/3604/24

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff LGTM
brings client ssh into feature parity with the openssh daemon

cc @infinisil for final look-over

nixos/modules/programs/ssh.nix Outdated Show resolved Hide resolved
@infinisil infinisil merged commit 2f79f25 into NixOS:master Jun 8, 2020
@Izorkin Izorkin deleted the ssh-custom branch June 8, 2020 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants