~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/golang.org/x/crypto/ssh/test/session_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
280
280
        var config ssh.Config
281
281
        config.SetDefaults()
282
282
        cipherOrder := config.Ciphers
283
 
        // This cipher will not be tested when commented out in cipher.go it will
 
283
        // These ciphers will not be tested when commented out in cipher.go it will
284
284
        // fallback to the next available as per line 292.
285
 
        cipherOrder = append(cipherOrder, "aes128-cbc")
 
285
        cipherOrder = append(cipherOrder, "aes128-cbc", "3des-cbc")
286
286
 
287
287
        for _, ciph := range cipherOrder {
288
288
                server := newServer(t)
289
289
                defer server.Shutdown()
290
290
                conf := clientConfig()
291
291
                conf.Ciphers = []string{ciph}
292
 
                // Don't fail if sshd doesnt have the cipher.
 
292
                // Don't fail if sshd doesn't have the cipher.
293
293
                conf.Ciphers = append(conf.Ciphers, cipherOrder...)
294
294
                conn, err := server.TryDial(conf)
295
295
                if err == nil {
310
310
                defer server.Shutdown()
311
311
                conf := clientConfig()
312
312
                conf.MACs = []string{mac}
313
 
                // Don't fail if sshd doesnt have the MAC.
 
313
                // Don't fail if sshd doesn't have the MAC.
314
314
                conf.MACs = append(conf.MACs, macOrder...)
315
315
                if conn, err := server.TryDial(conf); err == nil {
316
316
                        conn.Close()
328
328
                server := newServer(t)
329
329
                defer server.Shutdown()
330
330
                conf := clientConfig()
331
 
                // Don't fail if sshd doesnt have the kex.
 
331
                // Don't fail if sshd doesn't have the kex.
332
332
                conf.KeyExchanges = append([]string{kex}, kexOrder...)
333
333
                conn, err := server.TryDial(conf)
334
334
                if err == nil {
338
338
                }
339
339
        }
340
340
}
 
341
 
 
342
func TestClientAuthAlgorithms(t *testing.T) {
 
343
        for _, key := range []string{
 
344
                "rsa",
 
345
                "dsa",
 
346
                "ecdsa",
 
347
                "ed25519",
 
348
        } {
 
349
                server := newServer(t)
 
350
                conf := clientConfig()
 
351
                conf.SetDefaults()
 
352
                conf.Auth = []ssh.AuthMethod{
 
353
                        ssh.PublicKeys(testSigners[key]),
 
354
                }
 
355
 
 
356
                conn, err := server.TryDial(conf)
 
357
                if err == nil {
 
358
                        conn.Close()
 
359
                } else {
 
360
                        t.Errorf("failed for key %q", key)
 
361
                }
 
362
 
 
363
                server.Shutdown()
 
364
        }
 
365
}