Puppet Class: cis_security_hardening::rules::sshd_kex
- Defined in:
- manifests/rules/sshd_kex.pp
Summary
Ensure only strong Key Exchange algorithms are usedOverview
Key exchange is any method in cryptography by which cryptographic keys are exchanged between two parties, allowing use of a cryptographic algorithm. If the sender and receiver wish to exchange encrypted messages, each must be equipped to encrypt messages to be sent and decrypt messages received
Rationale: Key exchange methods that are considered weak should be removed. A key exchange method may be weak because too few bits are used, or the hashing algorithm is considered too weak. Using weak algorithms could expose connections to man-in-the-middle attacks.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'manifests/rules/sshd_kex.pp', line 26
class cis_security_hardening::rules::sshd_kex (
Boolean $enforce = false,
Array $kexs = [],
) {
if $enforce {
if (!empty($kexs)) {
$path = ($facts['os']['name'] == 'SLES' and $facts['os']['release']['major'] == '12') ? {
true => '/usr/etc/ssh/sshd_config',
default => '/etc/ssh/sshd_config',
}
$kexlist = $kexs.join(',')
file_line { 'sshd-kexs':
ensure => present,
path => $path,
line => "Kexalgorithms ${kexlist}",
match => '^#?Kexalgorithms.*',
notify => Exec['reload-sshd'],
}
}
}
}
|