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

fix sshd-keygen command location for amz linux 2023 #184

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the openssh cookbook.

## Unreleased

- fix sshd-keygen command location for Amazon Linux 2023

## 2.11.6 - *2023-12-21*

## 2.11.5 - *2023-09-29*
Expand Down
4 changes: 2 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ def listen_addr_for(interface, type)
# this will only execute on RHEL / Fedora systems where sshd has never been started
# 99.99% of the time this is going to be a docker container
if keygen_platform? && sshd_host_keys_missing?
if platform_family?('fedora', 'rhel') && node['platform_version'].to_i >= 8 # fedora and RHEL 8+
if platform_family?('fedora', 'rhel', 'amazon') && node['platform_version'].to_i >= 8 # fedora, RHEL 8+, Amazonlinux 2023+
node['openssh']['server']['host_key'].each do |key|
keytype = key.split('_')[-2]
execute "/usr/libexec/openssh/sshd-keygen #{keytype}"
end
elsif platform_family?('rhel', 'amazon') # RHEL < 8 or Amazon Linux
elsif platform_family?('rhel', 'amazon') # RHEL < 8 or Amazon Linux 2
execute '/usr/sbin/sshd-keygen'
elsif platform_family?('suse')
execute '/usr/sbin/sshd-gen-keys-start'
Expand Down
Loading