As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit 639e2ee3 authored by Stan Hu's avatar Stan Hu
Browse files

Drop diffie-hellman-group14-sha1 kex by default

OpenSSH doesn't offer this key exchange algorithm, and ssh-audit
considers it weak, so let's drop it by default.

Changelog: changed
parent 216446d8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -89,7 +89,7 @@ sshd:
# Specifies the available message authentication code algorithms that are used for protecting data integrity
macs: [hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1]
# Specifies the available Key Exchange algorithms
kex_algorithms: [curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group14-sha256, diffie-hellman-group14-sha1]
kex_algorithms: [curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group14-sha256]
# Specified the ciphers allowed
ciphers: [aes128-gcm@openssh.com, chacha20-poly1305@openssh.com, aes256-gcm@openssh.com, aes128-ctr, aes192-ctr,aes256-ctr]
# SSH host key files.
Loading
Loading
Loading
Loading
@@ -24,6 +24,15 @@ var supportedMACs = []string{
"hmac-sha1",
}
var supportedKeyExchanges = []string{
"curve25519-sha256",
"curve25519-sha256@libssh.org",
"ecdh-sha2-nistp256",
"ecdh-sha2-nistp384",
"ecdh-sha2-nistp521",
"diffie-hellman-group14-sha256",
}
type serverConfig struct {
cfg *config.Config
hostKeys []ssh.Signer
Loading
Loading
@@ -102,6 +111,8 @@ func (s *serverConfig) get(ctx context.Context) *ssh.ServerConfig {
if len(s.cfg.Server.KexAlgorithms) > 0 {
sshCfg.KeyExchanges = s.cfg.Server.KexAlgorithms
} else {
sshCfg.KeyExchanges = supportedKeyExchanges
}
if len(s.cfg.Server.Ciphers) > 0 {
Loading
Loading
Loading
Loading
@@ -85,7 +85,7 @@ func TestDefaultAlgorithms(t *testing.T) {
sshServerConfig := srvCfg.get(context.Background())
require.Equal(t, supportedMACs, sshServerConfig.MACs)
require.Nil(t, sshServerConfig.KeyExchanges)
require.Equal(t, supportedKeyExchanges, sshServerConfig.KeyExchanges)
require.Nil(t, sshServerConfig.Ciphers)
sshServerConfig.SetDefaults()
Loading
Loading
@@ -99,7 +99,6 @@ func TestDefaultAlgorithms(t *testing.T) {
"ecdh-sha2-nistp384",
"ecdh-sha2-nistp521",
"diffie-hellman-group14-sha256",
"diffie-hellman-group14-sha1",
}
require.Equal(t, defaultKeyExchanges, sshServerConfig.KeyExchanges)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment