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

Support sshd password authentication on Rocky 8 #565

Merged
merged 5 commits into from
Feb 12, 2025
Merged

Conversation

jovial
Copy link
Collaborator

@jovial jovial commented Feb 10, 2025

Adds a sshd_config.d directory so that we can use the same templated config file as Rocky 9.

@jovial jovial requested a review from a team as a code owner February 10, 2025 11:46
@jovial
Copy link
Collaborator Author

jovial commented Feb 11, 2025

Try using Include

@jovial
Copy link
Collaborator Author

jovial commented Feb 11, 2025

Try using Include

Seems to work. I found that the variables defined in sshd_config override the drop in ones. I'm guessing it is using the first value it encounters (and Include was at the bottom of the file). We could put the Include at the top which is similar to Rocky 9:

#       $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/
sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

# To modify the system-wide sshd configuration, create a  *.conf  file under
#  /etc/ssh/sshd_config.d/  which will be automatically included below
Include /etc/ssh/sshd_config.d/*.conf

@jovial jovial marked this pull request as draft February 11, 2025 12:36
@jovial jovial marked this pull request as ready for review February 11, 2025 15:01
@jovial
Copy link
Collaborator Author

jovial commented Feb 11, 2025

This is what we end up with:

[root@cclr-dev-login-0 ~]# cat /etc/ssh/sshd_config
#	$OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.
# BEGIN ANSIBLE MANAGED BLOCK
# To modify the system-wide sshd configuration, create a  *.conf  file under
#  /etc/ssh/sshd_config.d/  which will be automatically included below
Include /etc/ssh/sshd_config.d/*.conf
# END ANSIBLE MANAGED BLOCK

Which isn't ideal, but we don't have append_newline and prepend_newline in our version of ansible.

@jovial
Copy link
Collaborator Author

jovial commented Feb 11, 2025

We could also do this at build time to make it simpler to apply runtime config. Thoughts?

@sjpb
Copy link
Collaborator

sjpb commented Feb 12, 2025

I'm guessing it is using the first value it encounters

From the man page:

For each keyword, the first obtained value will be used.
so, yes

@sjpb
Copy link
Collaborator

sjpb commented Feb 12, 2025

We could also do this at build time to make it simpler to apply runtime config. Thoughts?

I don't think we actually need to TBH. In the interest of progress/not getting blocked by image builds lets carry on - if Bertie decides that would be easier for compute-init support he could do that as part of that.

Rocky 8 doesn't have an sshd_config.d directory, so we need
to adjust the main configuration file.
@sjpb had a preference for using the same drop in pattern as Rocky 9 so that people can customize the template file
Try and match format of Rocky 9
@sjpb sjpb force-pushed the bugfix/rocky8/sshd branch from 329ef01 to f026fa7 Compare February 12, 2025 09:51
Copy link
Collaborator

@sjpb sjpb left a comment

Choose a reason for hiding this comment

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

LGTM

@sjpb sjpb merged commit 9a8f123 into main Feb 12, 2025
0 of 2 checks passed
@sjpb sjpb deleted the bugfix/rocky8/sshd branch February 12, 2025 09:52
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.

2 participants