Skip to content

Conversation

@bhouse-nexthop
Copy link
Contributor

@bhouse-nexthop bhouse-nexthop commented Apr 11, 2025

The SSH configuration does not contain many of the hardening requirements by the various standards bodies. This adds support for:

  • password_authentication - ability to disable password auth
  • permit_root_login - ability to control root login rights
  • ciphers - ability to specify available ciphers
  • kex_algorithms - ability to specify key exchange algorithms
  • macs - ability to specify macs

Depends on sonic-net/sonic-buildimage#22308
Fixes sonic-net/sonic-buildimage#22309

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft requested review from Copilot and liuh-80 June 19, 2025 18:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the SSH configuration options to support hardening requirements by adding new configuration vectors for password authentication, root login, ciphers, key exchange algorithms, and MACs. Key changes include:

  • Updates to test vectors and sample outputs for various SSH hardening options.
  • Addition of new test cases in hostcfgd tests to validate the updated SSH configuration.
  • Modifications in the SshServer code to support the new configuration keys and proper value conversion.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

File Description
tests/hostcfgd/test_ssh_server_vectors.py Added new test vectors for password_authentication, permit_root_login, ciphers, kex_algorithms, and macs.
tests/hostcfgd/sample_output/*/sshd_config Updated sample SSHD configuration outputs to reflect the new hardening options.
tests/hostcfgd/hostcfgd_ssh_server_test.py Added new test cases corresponding to each new SSH hardening option.
scripts/hostcfgd Modified the SSH configuration processing to support additional options and value conversions.

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prabhataravind
Copy link
Contributor

@bhouse-nexthop it looks like there is a test failure. Could you pls check?

=========================== short test summary info ============================
FAILED tests/hostcfgd/hostcfgd_ssh_server_test.py::TestHostcfgdSSHServer::test_hostcfgd_sshs_all_0_SSH_SERVER
============= 1 failed, 319 passed, 7 warnings in 91.13s (0:01:31) =============

@bradh352
Copy link

looks like the input file was changed by a different PR, I'll update to match

@bhouse-nexthop bhouse-nexthop force-pushed the bhouse-nexthop/ssh-config branch from 97608cb to ec3d188 Compare October 16, 2025 02:51
@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lguohan
Copy link

lguohan commented Oct 18, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@bhouse-nexthop
Copy link
Contributor Author

@lguohan I think there is a test failure here due to the ssh config used for the test having changed since I originally wrote this PR. I rebased a few days ago but haven't yet looked into this, I'll try to get to that tomorrow. I just got back to the east coast an hour or two ago and am pretty tired :)

bhouse-nexthop and others added 3 commits October 24, 2025 15:37
The SSH configuration does not contain many of the hardening
requirements by the various standards bodies.  This adds
support for:
 * password_authentication - ability to disable password auth
 * permit_root_login - ability to prevent root logins
 * ciphers - ability to specify available ciphers
 * kex_algorithms - ability to specify key exchange algorithms
 * macs - ability to specify macs

Signed-off-by: Brad House <[email protected]>
@bhouse-nexthop bhouse-nexthop force-pushed the bhouse-nexthop/ssh-config branch from ec3d188 to 69d12ee Compare October 24, 2025 15:37
@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@bhouse-nexthop
Copy link
Contributor Author

@lguohan any chance you can review this?

@lguohan lguohan merged commit 85607f8 into sonic-net:master Oct 24, 2025
5 checks passed
@bhouse-nexthop bhouse-nexthop deleted the bhouse-nexthop/ssh-config branch October 24, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: SSH configuration hardening

8 participants