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

OpenSSH 8.0 KEXs support #172

Merged
merged 3 commits into from
May 25, 2020
Merged
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
27 changes: 18 additions & 9 deletions libraries/ssh_crypto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,19 @@ def valid_ciphers # rubocop:disable Metrics/CyclomaticComplexity
ciphers
end

def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity
def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
# define a set of default KEXs
kex80 = 'sntrup4591761x25519-sha512@tinyssh.org,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
kex66 = 'curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
kex59 = 'diffie-hellman-group-exchange-sha256'
kex = kex59

# adjust KEXs based on OS + release
case inspec.os[:name]
# https://packages.ubuntu.com/search?keywords=openssh-server
when 'ubuntu'
kex = kex66 if inspec.os[:release][0, 2] > '12'
kex = inspec.os[:release][0, 2] >= '19' ? kex80 : kex66
# https://packages.debian.org/search?keywords=openssh-server
when 'debian'
case inspec.os[:release]
when /^6\./
Expand All @@ -86,6 +89,8 @@ def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity
kex = kex59
when /^8\./, /^9\./, /^10\./
kex = kex66
when /^11\./
kex = kex80
end
when 'redhat', 'centos', 'oracle'
case inspec.os[:release]
Expand All @@ -94,21 +99,25 @@ def valid_kexs # rubocop:disable Metrics/CyclomaticComplexity
when /^7\./, /^8\./
kex = kex66
end
when 'amazon', 'fedora', 'alpine'
# https://pkgs.alpinelinux.org/packages?name=openssh
when 'alpine'
kex = inspec.os[:release].split('.')[1] >= '10' ? kex80 : kex66
when 'amazon'
kex = kex66
# https://src.fedoraproject.org/rpms/openssh
when 'fedora'
kex = inspec.os[:release] >= '30' ? kex80 : kex66
# https://software.opensuse.org/package/openssh
when 'opensuse'
case inspec.os[:release]
when /^13\.2/
kex = kex66
when /^42\./
kex = kex66
end
kex = inspec.os[:release] >= '15.2' ? kex80 : kex66
when 'mac_os_x'
case inspec.os[:release]
when /^10.9\./
kex = kex59
when /^10.10\./, /^10.11\./, /^10.12\./
kex = kex66
when /^10.15\./
kex = kex80
end
end

Expand Down