Skip to content

Commit

Permalink
fix sshd-keygen command location for amz linux 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
Stromweld committed Mar 12, 2024
1 parent abfd4ef commit 49717d5
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 49717d5

Please sign in to comment.