Skip to content

Commit bb80217

Browse files
drakkangopherbot
authored andcommitted
ssh: don't use dsa keys in integration tests
DSA has been disabled by default since OpenSSH 9.8, so tests fail with newer versions of OpenSSH Change-Id: I57b9abde8845cd05116a637a21cbbb8af740b2e0 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/599955 Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Nicola Murino <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
1 parent 6879722 commit bb80217

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ssh/agent/client_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ func testAgentInterface(t *testing.T, agent ExtendedAgent, key interface{}, cert
165165
sig, err := agent.Sign(pubKey, data)
166166
if err != nil {
167167
t.Logf("sign failed with key type %q", pubKey.Type())
168-
// In integration tests ssh-dss and ssh-rsa (SHA1 signatures) may be
169-
// disabled for security reasons, we check SHA-2 variants later.
170-
if pubKey.Type() != ssh.KeyAlgoDSA && pubKey.Type() != ssh.KeyAlgoRSA && pubKey.Type() != ssh.CertAlgoRSAv01 {
168+
// In integration tests ssh-rsa (SHA1 signatures) may be disabled for
169+
// security reasons, we check SHA-2 variants later.
170+
if pubKey.Type() != ssh.KeyAlgoRSA && pubKey.Type() != ssh.CertAlgoRSAv01 {
171171
t.Fatalf("Sign(%s): %v", pubKey.Type(), err)
172172
}
173173
} else {
@@ -251,7 +251,7 @@ func TestMalformedRequests(t *testing.T) {
251251
}
252252

253253
func TestAgent(t *testing.T) {
254-
for _, keyType := range []string{"rsa", "dsa", "ecdsa", "ed25519"} {
254+
for _, keyType := range []string{"rsa", "ecdsa", "ed25519"} {
255255
testOpenSSHAgent(t, testPrivateKeys[keyType], nil, 0)
256256
testKeyringAgent(t, testPrivateKeys[keyType], nil, 0)
257257
}
@@ -409,7 +409,7 @@ func testLockAgent(agent Agent, t *testing.T) {
409409
if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["rsa"], Comment: "comment 1"}); err != nil {
410410
t.Errorf("Add: %v", err)
411411
}
412-
if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["dsa"], Comment: "comment dsa"}); err != nil {
412+
if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["ecdsa"], Comment: "comment ecdsa"}); err != nil {
413413
t.Errorf("Add: %v", err)
414414
}
415415
if keys, err := agent.List(); err != nil {

ssh/test/agent_unix_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ func TestAgentForward(t *testing.T) {
2020
defer conn.Close()
2121

2222
keyring := agent.NewKeyring()
23-
if err := keyring.Add(agent.AddedKey{PrivateKey: testPrivateKeys["dsa"]}); err != nil {
23+
if err := keyring.Add(agent.AddedKey{PrivateKey: testPrivateKeys["ecdsa"]}); err != nil {
2424
t.Fatalf("Error adding key: %s", err)
2525
}
2626
if err := keyring.Add(agent.AddedKey{
27-
PrivateKey: testPrivateKeys["dsa"],
27+
PrivateKey: testPrivateKeys["ecdsa"],
2828
ConfirmBeforeUse: true,
2929
LifetimeSecs: 3600,
3030
}); err != nil {
3131
t.Fatalf("Error adding key with constraints: %s", err)
3232
}
33-
pub := testPublicKeys["dsa"]
33+
pub := testPublicKeys["ecdsa"]
3434

3535
sess, err := conn.NewSession()
3636
if err != nil {

0 commit comments

Comments
 (0)