Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d375be9b6 | ||
|
|
b4ddeeda5b | ||
|
|
edc325d13a | ||
|
|
eab9315960 | ||
|
|
ddfa82138e | ||
|
|
d08e19beac | ||
|
|
12e1fcd8c0 | ||
|
|
3f8f0645c2 | ||
|
|
5df3b59941 | ||
|
|
2e82bdd171 | ||
|
|
64e0e99383 | ||
|
|
23b1b90df2 | ||
|
|
e98487292d | ||
|
|
183630ada7 | ||
|
|
a9e447dde7 | ||
|
|
64c3993f5c | ||
|
|
5fe8145aca | ||
|
|
043e94c17a | ||
|
|
0d502d7cd6 | ||
|
|
0ff60057bb |
@@ -4,8 +4,8 @@ go 1.17
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
golang.org/x/net v0.10.0 // tagx:ignore
|
golang.org/x/net v0.10.0 // tagx:ignore
|
||||||
golang.org/x/sys v0.9.0
|
golang.org/x/sys v0.12.0
|
||||||
golang.org/x/term v0.9.0
|
golang.org/x/term v0.12.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require golang.org/x/text v0.10.0 // indirect
|
require golang.org/x/text v0.13.0 // indirect
|
||||||
|
|||||||
@@ -19,21 +19,21 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
|
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||||
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||||
golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28=
|
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
|
||||||
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
|
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
|
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||||
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
// Copyright 2023 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package testenv
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"reflect"
|
||||||
|
"strconv"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CommandContext is like exec.CommandContext, but:
|
||||||
|
// - skips t if the platform does not support os/exec,
|
||||||
|
// - sends SIGQUIT (if supported by the platform) instead of SIGKILL
|
||||||
|
// in its Cancel function
|
||||||
|
// - if the test has a deadline, adds a Context timeout and WaitDelay
|
||||||
|
// for an arbitrary grace period before the test's deadline expires,
|
||||||
|
// - fails the test if the command does not complete before the test's deadline, and
|
||||||
|
// - sets a Cleanup function that verifies that the test did not leak a subprocess.
|
||||||
|
func CommandContext(t testing.TB, ctx context.Context, name string, args ...string) *exec.Cmd {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
var (
|
||||||
|
cancelCtx context.CancelFunc
|
||||||
|
gracePeriod time.Duration // unlimited unless the test has a deadline (to allow for interactive debugging)
|
||||||
|
)
|
||||||
|
|
||||||
|
if t, ok := t.(interface {
|
||||||
|
testing.TB
|
||||||
|
Deadline() (time.Time, bool)
|
||||||
|
}); ok {
|
||||||
|
if td, ok := t.Deadline(); ok {
|
||||||
|
// Start with a minimum grace period, just long enough to consume the
|
||||||
|
// output of a reasonable program after it terminates.
|
||||||
|
gracePeriod = 100 * time.Millisecond
|
||||||
|
if s := os.Getenv("GO_TEST_TIMEOUT_SCALE"); s != "" {
|
||||||
|
scale, err := strconv.Atoi(s)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("invalid GO_TEST_TIMEOUT_SCALE: %v", err)
|
||||||
|
}
|
||||||
|
gracePeriod *= time.Duration(scale)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If time allows, increase the termination grace period to 5% of the
|
||||||
|
// test's remaining time.
|
||||||
|
testTimeout := time.Until(td)
|
||||||
|
if gp := testTimeout / 20; gp > gracePeriod {
|
||||||
|
gracePeriod = gp
|
||||||
|
}
|
||||||
|
|
||||||
|
// When we run commands that execute subprocesses, we want to reserve two
|
||||||
|
// grace periods to clean up: one for the delay between the first
|
||||||
|
// termination signal being sent (via the Cancel callback when the Context
|
||||||
|
// expires) and the process being forcibly terminated (via the WaitDelay
|
||||||
|
// field), and a second one for the delay becween the process being
|
||||||
|
// terminated and and the test logging its output for debugging.
|
||||||
|
//
|
||||||
|
// (We want to ensure that the test process itself has enough time to
|
||||||
|
// log the output before it is also terminated.)
|
||||||
|
cmdTimeout := testTimeout - 2*gracePeriod
|
||||||
|
|
||||||
|
if cd, ok := ctx.Deadline(); !ok || time.Until(cd) > cmdTimeout {
|
||||||
|
// Either ctx doesn't have a deadline, or its deadline would expire
|
||||||
|
// after (or too close before) the test has already timed out.
|
||||||
|
// Add a shorter timeout so that the test will produce useful output.
|
||||||
|
ctx, cancelCtx = context.WithTimeout(ctx, cmdTimeout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := exec.CommandContext(ctx, name, args...)
|
||||||
|
// Set the Cancel and WaitDelay fields only if present (go 1.20 and later).
|
||||||
|
// TODO: When Go 1.19 is no longer supported, remove this use of reflection
|
||||||
|
// and instead set the fields directly.
|
||||||
|
if cmdCancel := reflect.ValueOf(cmd).Elem().FieldByName("Cancel"); cmdCancel.IsValid() {
|
||||||
|
cmdCancel.Set(reflect.ValueOf(func() error {
|
||||||
|
if cancelCtx != nil && ctx.Err() == context.DeadlineExceeded {
|
||||||
|
// The command timed out due to running too close to the test's deadline.
|
||||||
|
// There is no way the test did that intentionally — it's too close to the
|
||||||
|
// wire! — so mark it as a test failure. That way, if the test expects the
|
||||||
|
// command to fail for some other reason, it doesn't have to distinguish
|
||||||
|
// between that reason and a timeout.
|
||||||
|
t.Errorf("test timed out while running command: %v", cmd)
|
||||||
|
} else {
|
||||||
|
// The command is being terminated due to ctx being canceled, but
|
||||||
|
// apparently not due to an explicit test deadline that we added.
|
||||||
|
// Log that information in case it is useful for diagnosing a failure,
|
||||||
|
// but don't actually fail the test because of it.
|
||||||
|
t.Logf("%v: terminating command: %v", ctx.Err(), cmd)
|
||||||
|
}
|
||||||
|
return cmd.Process.Signal(Sigquit)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
if cmdWaitDelay := reflect.ValueOf(cmd).Elem().FieldByName("WaitDelay"); cmdWaitDelay.IsValid() {
|
||||||
|
cmdWaitDelay.Set(reflect.ValueOf(gracePeriod))
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Cleanup(func() {
|
||||||
|
if cancelCtx != nil {
|
||||||
|
cancelCtx()
|
||||||
|
}
|
||||||
|
if cmd.Process != nil && cmd.ProcessState == nil {
|
||||||
|
t.Errorf("command was started, but test did not wait for it to complete: %v", cmd)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command is like exec.Command, but applies the same changes as
|
||||||
|
// testenv.CommandContext (with a default Context).
|
||||||
|
func Command(t testing.TB, name string, args ...string) *exec.Cmd {
|
||||||
|
t.Helper()
|
||||||
|
return CommandContext(t, context.Background(), name, args...)
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build windows || plan9 || (js && wasm) || wasip1
|
||||||
|
|
||||||
|
package testenv
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Sigquit is the signal to send to kill a hanging subprocess.
|
||||||
|
// On Unix we send SIGQUIT, but on non-Unix we only have os.Kill.
|
||||||
|
var Sigquit = os.Kill
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build unix
|
||||||
|
|
||||||
|
package testenv
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Sigquit is the signal to send to kill a hanging subprocess.
|
||||||
|
// Send SIGQUIT to get a stack trace.
|
||||||
|
var Sigquit = syscall.SIGQUIT
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@@ -28,6 +29,11 @@ const wycheproofModVer = "v0.0.0-20191219022705-2196000605e4"
|
|||||||
var wycheproofTestVectorsDir string
|
var wycheproofTestVectorsDir string
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
flag.Parse()
|
||||||
|
if flag.Lookup("test.short").Value.(flag.Getter).Get().(bool) {
|
||||||
|
log.Println("skipping test that downloads testdata via 'go mod download' in short mode")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
if _, err := exec.LookPath("go"); err != nil {
|
if _, err := exec.LookPath("go"); err != nil {
|
||||||
log.Printf("skipping test because 'go' command is unavailable: %v", err)
|
log.Printf("skipping test because 'go' command is unavailable: %v", err)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
@@ -42,8 +48,6 @@ func TestMain(m *testing.M) {
|
|||||||
// can be used in the following tests.
|
// can be used in the following tests.
|
||||||
path := "github.com/google/wycheproof@" + wycheproofModVer
|
path := "github.com/google/wycheproof@" + wycheproofModVer
|
||||||
cmd := exec.Command("go", "mod", "download", "-json", path)
|
cmd := exec.Command("go", "mod", "download", "-json", path)
|
||||||
// TODO: enable the sumdb once the Trybots proxy supports it.
|
|
||||||
cmd.Env = append(os.Environ(), "GONOSUMDB=*")
|
|
||||||
output, err := cmd.Output()
|
output, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to run `go mod download -json %s`, output: %s", path, output)
|
log.Fatalf("failed to run `go mod download -json %s`, output: %s", path, output)
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ func startOpenSSHAgent(t *testing.T) (client ExtendedAgent, socket string, clean
|
|||||||
// types supported vary by platform.
|
// types supported vary by platform.
|
||||||
t.Skip("skipping test due to -short")
|
t.Skip("skipping test due to -short")
|
||||||
}
|
}
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip("skipping on windows, we don't support connecting to the ssh-agent via a named pipe")
|
||||||
|
}
|
||||||
|
|
||||||
bin, err := exec.LookPath("ssh-agent")
|
bin, err := exec.LookPath("ssh-agent")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -366,7 +369,8 @@ func TestAuth(t *testing.T) {
|
|||||||
go func() {
|
go func() {
|
||||||
conn, _, _, err := ssh.NewServerConn(a, &serverConf)
|
conn, _, _, err := ssh.NewServerConn(a, &serverConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Server: %v", err)
|
t.Errorf("NewServerConn error: %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -53,10 +53,11 @@ func TestSetupForwardAgent(t *testing.T) {
|
|||||||
incoming := make(chan *ssh.ServerConn, 1)
|
incoming := make(chan *ssh.ServerConn, 1)
|
||||||
go func() {
|
go func() {
|
||||||
conn, _, _, err := ssh.NewServerConn(a, &serverConf)
|
conn, _, _, err := ssh.NewServerConn(a, &serverConf)
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Server: %v", err)
|
|
||||||
}
|
|
||||||
incoming <- conn
|
incoming <- conn
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("NewServerConn error: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
conf := ssh.ClientConfig{
|
conf := ssh.ClientConfig{
|
||||||
@@ -71,8 +72,10 @@ func TestSetupForwardAgent(t *testing.T) {
|
|||||||
if err := ForwardToRemote(client, socket); err != nil {
|
if err := ForwardToRemote(client, socket); err != nil {
|
||||||
t.Fatalf("SetupForwardAgent: %v", err)
|
t.Fatalf("SetupForwardAgent: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
server := <-incoming
|
server := <-incoming
|
||||||
|
if server == nil {
|
||||||
|
t.Fatal("Unable to get server")
|
||||||
|
}
|
||||||
ch, reqs, err := server.OpenChannel(channelType, nil)
|
ch, reqs, err := server.OpenChannel(channelType, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("OpenChannel(%q): %v", channelType, err)
|
t.Fatalf("OpenChannel(%q): %v", channelType, err)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package ssh
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -90,16 +91,16 @@ func BenchmarkEndToEnd(b *testing.B) {
|
|||||||
go func() {
|
go func() {
|
||||||
newCh, err := server.Accept()
|
newCh, err := server.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Client: %v", err)
|
panic(fmt.Sprintf("Client: %v", err))
|
||||||
}
|
}
|
||||||
ch, incoming, err := newCh.Accept()
|
ch, incoming, err := newCh.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Accept: %v", err)
|
panic(fmt.Sprintf("Accept: %v", err))
|
||||||
}
|
}
|
||||||
go DiscardRequests(incoming)
|
go DiscardRequests(incoming)
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
if _, err := io.ReadFull(ch, output); err != nil {
|
if _, err := io.ReadFull(ch, output); err != nil {
|
||||||
b.Fatalf("ReadFull: %v", err)
|
panic(fmt.Sprintf("ReadFull: %v", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ch.Close()
|
ch.Close()
|
||||||
|
|||||||
@@ -955,3 +955,124 @@ func TestAuthMethodGSSAPIWithMIC(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCompatibleAlgoAndSignatures(t *testing.T) {
|
||||||
|
type testcase struct {
|
||||||
|
algo string
|
||||||
|
sigFormat string
|
||||||
|
compatible bool
|
||||||
|
}
|
||||||
|
testcases := []*testcase{
|
||||||
|
{
|
||||||
|
KeyAlgoRSA,
|
||||||
|
KeyAlgoRSA,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoRSA,
|
||||||
|
KeyAlgoRSASHA256,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoRSA,
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoRSASHA256,
|
||||||
|
KeyAlgoRSA,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
KeyAlgoRSA,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
KeyAlgoRSASHA256,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoRSASHA256,
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSAv01,
|
||||||
|
KeyAlgoRSA,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSAv01,
|
||||||
|
KeyAlgoRSASHA256,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSAv01,
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSASHA256v01,
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSASHA512v01,
|
||||||
|
KeyAlgoRSASHA512,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSASHA512v01,
|
||||||
|
KeyAlgoRSASHA256,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSASHA256v01,
|
||||||
|
CertAlgoRSAv01,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CertAlgoRSAv01,
|
||||||
|
CertAlgoRSASHA512v01,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoECDSA256,
|
||||||
|
KeyAlgoRSA,
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoECDSA256,
|
||||||
|
KeyAlgoECDSA521,
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoECDSA256,
|
||||||
|
KeyAlgoECDSA256,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoECDSA256,
|
||||||
|
KeyAlgoED25519,
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KeyAlgoED25519,
|
||||||
|
KeyAlgoED25519,
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, c := range testcases {
|
||||||
|
if isAlgoCompatible(c.algo, c.sigFormat) != c.compatible {
|
||||||
|
t.Errorf("algorithm %q, signature format %q, expected compatible to be %t", c.algo, c.sigFormat, c.compatible)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -254,3 +254,93 @@ func TestNewClientConn(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUnsupportedAlgorithm(t *testing.T) {
|
||||||
|
for _, tt := range []struct {
|
||||||
|
name string
|
||||||
|
config Config
|
||||||
|
wantError string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
"unsupported KEX",
|
||||||
|
Config{
|
||||||
|
KeyExchanges: []string{"unsupported"},
|
||||||
|
},
|
||||||
|
"no common algorithm",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unsupported and supported KEXs",
|
||||||
|
Config{
|
||||||
|
KeyExchanges: []string{"unsupported", kexAlgoCurve25519SHA256},
|
||||||
|
},
|
||||||
|
"",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unsupported cipher",
|
||||||
|
Config{
|
||||||
|
Ciphers: []string{"unsupported"},
|
||||||
|
},
|
||||||
|
"no common algorithm",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unsupported and supported ciphers",
|
||||||
|
Config{
|
||||||
|
Ciphers: []string{"unsupported", chacha20Poly1305ID},
|
||||||
|
},
|
||||||
|
"",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unsupported MAC",
|
||||||
|
Config{
|
||||||
|
MACs: []string{"unsupported"},
|
||||||
|
// MAC is used for non AAED ciphers.
|
||||||
|
Ciphers: []string{"aes256-ctr"},
|
||||||
|
},
|
||||||
|
"no common algorithm",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unsupported and supported MACs",
|
||||||
|
Config{
|
||||||
|
MACs: []string{"unsupported", "hmac-sha2-256-etm@openssh.com"},
|
||||||
|
// MAC is used for non AAED ciphers.
|
||||||
|
Ciphers: []string{"aes256-ctr"},
|
||||||
|
},
|
||||||
|
"",
|
||||||
|
},
|
||||||
|
} {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
c1, c2, err := netPipe()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("netPipe: %v", err)
|
||||||
|
}
|
||||||
|
defer c1.Close()
|
||||||
|
defer c2.Close()
|
||||||
|
|
||||||
|
serverConf := &ServerConfig{
|
||||||
|
Config: tt.config,
|
||||||
|
PasswordCallback: func(conn ConnMetadata, password []byte) (*Permissions, error) {
|
||||||
|
return &Permissions{}, nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
serverConf.AddHostKey(testSigners["rsa"])
|
||||||
|
go NewServerConn(c1, serverConf)
|
||||||
|
|
||||||
|
clientConf := &ClientConfig{
|
||||||
|
User: "testuser",
|
||||||
|
Config: tt.config,
|
||||||
|
Auth: []AuthMethod{
|
||||||
|
Password("testpw"),
|
||||||
|
},
|
||||||
|
HostKeyCallback: InsecureIgnoreHostKey(),
|
||||||
|
}
|
||||||
|
_, _, _, err = NewClientConn(c2, "", clientConf)
|
||||||
|
if err != nil {
|
||||||
|
if tt.wantError == "" || !strings.Contains(err.Error(), tt.wantError) {
|
||||||
|
t.Errorf("%s: got error %q, missing %q", tt.name, err.Error(), tt.wantError)
|
||||||
|
}
|
||||||
|
} else if tt.wantError != "" {
|
||||||
|
t.Errorf("%s: succeeded, but want error string %q", tt.name, tt.wantError)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+38
-13
@@ -49,7 +49,8 @@ var supportedKexAlgos = []string{
|
|||||||
// P384 and P521 are not constant-time yet, but since we don't
|
// P384 and P521 are not constant-time yet, but since we don't
|
||||||
// reuse ephemeral keys, using them for ECDH should be OK.
|
// reuse ephemeral keys, using them for ECDH should be OK.
|
||||||
kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
|
kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
|
||||||
kexAlgoDH14SHA256, kexAlgoDH14SHA1, kexAlgoDH1SHA1,
|
kexAlgoDH14SHA256, kexAlgoDH16SHA512, kexAlgoDH14SHA1,
|
||||||
|
kexAlgoDH1SHA1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// serverForbiddenKexAlgos contains key exchange algorithms, that are forbidden
|
// serverForbiddenKexAlgos contains key exchange algorithms, that are forbidden
|
||||||
@@ -59,8 +60,9 @@ var serverForbiddenKexAlgos = map[string]struct{}{
|
|||||||
kexAlgoDHGEXSHA256: {}, // server half implementation is only minimal to satisfy the automated tests
|
kexAlgoDHGEXSHA256: {}, // server half implementation is only minimal to satisfy the automated tests
|
||||||
}
|
}
|
||||||
|
|
||||||
// preferredKexAlgos specifies the default preference for key-exchange algorithms
|
// preferredKexAlgos specifies the default preference for key-exchange
|
||||||
// in preference order.
|
// algorithms in preference order. The diffie-hellman-group16-sha512 algorithm
|
||||||
|
// is disabled by default because it is a bit slower than the others.
|
||||||
var preferredKexAlgos = []string{
|
var preferredKexAlgos = []string{
|
||||||
kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
|
kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
|
||||||
kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
|
kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
|
||||||
@@ -70,12 +72,12 @@ var preferredKexAlgos = []string{
|
|||||||
// supportedHostKeyAlgos specifies the supported host-key algorithms (i.e. methods
|
// supportedHostKeyAlgos specifies the supported host-key algorithms (i.e. methods
|
||||||
// of authenticating servers) in preference order.
|
// of authenticating servers) in preference order.
|
||||||
var supportedHostKeyAlgos = []string{
|
var supportedHostKeyAlgos = []string{
|
||||||
CertAlgoRSASHA512v01, CertAlgoRSASHA256v01,
|
CertAlgoRSASHA256v01, CertAlgoRSASHA512v01,
|
||||||
CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
|
CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
|
||||||
CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01,
|
CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01,
|
||||||
|
|
||||||
KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
|
KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
|
||||||
KeyAlgoRSASHA512, KeyAlgoRSASHA256,
|
KeyAlgoRSASHA256, KeyAlgoRSASHA512,
|
||||||
KeyAlgoRSA, KeyAlgoDSA,
|
KeyAlgoRSA, KeyAlgoDSA,
|
||||||
|
|
||||||
KeyAlgoED25519,
|
KeyAlgoED25519,
|
||||||
@@ -85,7 +87,7 @@ var supportedHostKeyAlgos = []string{
|
|||||||
// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
|
// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
|
||||||
// because they have reached the end of their useful life.
|
// because they have reached the end of their useful life.
|
||||||
var supportedMACs = []string{
|
var supportedMACs = []string{
|
||||||
"hmac-sha2-512-etm@openssh.com", "hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
|
"hmac-sha2-256-etm@openssh.com", "hmac-sha2-512-etm@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1", "hmac-sha1-96",
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportedCompressions = []string{compressionNone}
|
var supportedCompressions = []string{compressionNone}
|
||||||
@@ -119,6 +121,13 @@ func algorithmsForKeyFormat(keyFormat string) []string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isRSA returns whether algo is a supported RSA algorithm, including certificate
|
||||||
|
// algorithms.
|
||||||
|
func isRSA(algo string) bool {
|
||||||
|
algos := algorithmsForKeyFormat(KeyAlgoRSA)
|
||||||
|
return contains(algos, underlyingAlgo(algo))
|
||||||
|
}
|
||||||
|
|
||||||
// supportedPubKeyAuthAlgos specifies the supported client public key
|
// supportedPubKeyAuthAlgos specifies the supported client public key
|
||||||
// authentication algorithms. Note that this doesn't include certificate types
|
// authentication algorithms. Note that this doesn't include certificate types
|
||||||
// since those use the underlying algorithm. This list is sent to the client if
|
// since those use the underlying algorithm. This list is sent to the client if
|
||||||
@@ -262,16 +271,16 @@ type Config struct {
|
|||||||
// unspecified, a size suitable for the chosen cipher is used.
|
// unspecified, a size suitable for the chosen cipher is used.
|
||||||
RekeyThreshold uint64
|
RekeyThreshold uint64
|
||||||
|
|
||||||
// The allowed key exchanges algorithms. If unspecified then a
|
// The allowed key exchanges algorithms. If unspecified then a default set
|
||||||
// default set of algorithms is used.
|
// of algorithms is used. Unsupported values are silently ignored.
|
||||||
KeyExchanges []string
|
KeyExchanges []string
|
||||||
|
|
||||||
// The allowed cipher algorithms. If unspecified then a sensible
|
// The allowed cipher algorithms. If unspecified then a sensible default is
|
||||||
// default is used.
|
// used. Unsupported values are silently ignored.
|
||||||
Ciphers []string
|
Ciphers []string
|
||||||
|
|
||||||
// The allowed MAC algorithms. If unspecified then a sensible default
|
// The allowed MAC algorithms. If unspecified then a sensible default is
|
||||||
// is used.
|
// used. Unsupported values are silently ignored.
|
||||||
MACs []string
|
MACs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +297,7 @@ func (c *Config) SetDefaults() {
|
|||||||
var ciphers []string
|
var ciphers []string
|
||||||
for _, c := range c.Ciphers {
|
for _, c := range c.Ciphers {
|
||||||
if cipherModes[c] != nil {
|
if cipherModes[c] != nil {
|
||||||
// reject the cipher if we have no cipherModes definition
|
// Ignore the cipher if we have no cipherModes definition.
|
||||||
ciphers = append(ciphers, c)
|
ciphers = append(ciphers, c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,10 +306,26 @@ func (c *Config) SetDefaults() {
|
|||||||
if c.KeyExchanges == nil {
|
if c.KeyExchanges == nil {
|
||||||
c.KeyExchanges = preferredKexAlgos
|
c.KeyExchanges = preferredKexAlgos
|
||||||
}
|
}
|
||||||
|
var kexs []string
|
||||||
|
for _, k := range c.KeyExchanges {
|
||||||
|
if kexAlgoMap[k] != nil {
|
||||||
|
// Ignore the KEX if we have no kexAlgoMap definition.
|
||||||
|
kexs = append(kexs, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.KeyExchanges = kexs
|
||||||
|
|
||||||
if c.MACs == nil {
|
if c.MACs == nil {
|
||||||
c.MACs = supportedMACs
|
c.MACs = supportedMACs
|
||||||
}
|
}
|
||||||
|
var macs []string
|
||||||
|
for _, m := range c.MACs {
|
||||||
|
if macModes[m] != nil {
|
||||||
|
// Ignore the MAC if we have no macModes definition.
|
||||||
|
macs = append(macs, m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.MACs = macs
|
||||||
|
|
||||||
if c.RekeyThreshold == 0 {
|
if c.RekeyThreshold == 0 {
|
||||||
// cipher specific default
|
// cipher specific default
|
||||||
|
|||||||
+5
-5
@@ -82,11 +82,11 @@ func TestFindAgreedAlgorithms(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cases := []testcase{
|
cases := []testcase{
|
||||||
testcase{
|
{
|
||||||
name: "standard",
|
name: "standard",
|
||||||
},
|
},
|
||||||
|
|
||||||
testcase{
|
{
|
||||||
name: "no common hostkey",
|
name: "no common hostkey",
|
||||||
serverIn: kexInitMsg{
|
serverIn: kexInitMsg{
|
||||||
ServerHostKeyAlgos: []string{"hostkey2"},
|
ServerHostKeyAlgos: []string{"hostkey2"},
|
||||||
@@ -94,7 +94,7 @@ func TestFindAgreedAlgorithms(t *testing.T) {
|
|||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
testcase{
|
{
|
||||||
name: "no common kex",
|
name: "no common kex",
|
||||||
serverIn: kexInitMsg{
|
serverIn: kexInitMsg{
|
||||||
KexAlgos: []string{"kex2"},
|
KexAlgos: []string{"kex2"},
|
||||||
@@ -102,7 +102,7 @@ func TestFindAgreedAlgorithms(t *testing.T) {
|
|||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
testcase{
|
{
|
||||||
name: "no common cipher",
|
name: "no common cipher",
|
||||||
serverIn: kexInitMsg{
|
serverIn: kexInitMsg{
|
||||||
CiphersClientServer: []string{"cipher2"},
|
CiphersClientServer: []string{"cipher2"},
|
||||||
@@ -110,7 +110,7 @@ func TestFindAgreedAlgorithms(t *testing.T) {
|
|||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
testcase{
|
{
|
||||||
name: "client decides cipher",
|
name: "client decides cipher",
|
||||||
serverIn: kexInitMsg{
|
serverIn: kexInitMsg{
|
||||||
CiphersClientServer: []string{"cipher1", "cipher2"},
|
CiphersClientServer: []string{"cipher1", "cipher2"},
|
||||||
|
|||||||
+17
-15
@@ -148,6 +148,7 @@ func TestHandshakeBasic(t *testing.T) {
|
|||||||
clientDone := make(chan int, 0)
|
clientDone := make(chan int, 0)
|
||||||
gotHalf := make(chan int, 0)
|
gotHalf := make(chan int, 0)
|
||||||
const N = 20
|
const N = 20
|
||||||
|
errorCh := make(chan error, 1)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer close(clientDone)
|
defer close(clientDone)
|
||||||
@@ -158,7 +159,9 @@ func TestHandshakeBasic(t *testing.T) {
|
|||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
p := []byte{msgRequestSuccess, byte(i)}
|
p := []byte{msgRequestSuccess, byte(i)}
|
||||||
if err := trC.writePacket(p); err != nil {
|
if err := trC.writePacket(p); err != nil {
|
||||||
t.Fatalf("sendPacket: %v", err)
|
errorCh <- err
|
||||||
|
trC.Close()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if (i % 10) == 5 {
|
if (i % 10) == 5 {
|
||||||
<-gotHalf
|
<-gotHalf
|
||||||
@@ -177,16 +180,15 @@ func TestHandshakeBasic(t *testing.T) {
|
|||||||
checker.waitCall <- 1
|
checker.waitCall <- 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
errorCh <- nil
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Server checks that client messages come in cleanly
|
// Server checks that client messages come in cleanly
|
||||||
i := 0
|
i := 0
|
||||||
err = nil
|
|
||||||
for ; i < N; i++ {
|
for ; i < N; i++ {
|
||||||
var p []byte
|
p, err := trS.readPacket()
|
||||||
p, err = trS.readPacket()
|
if err != nil && err != io.EOF {
|
||||||
if err != nil {
|
t.Fatalf("server error: %v", err)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
if (i % 10) == 5 {
|
if (i % 10) == 5 {
|
||||||
gotHalf <- 1
|
gotHalf <- 1
|
||||||
@@ -198,8 +200,8 @@ func TestHandshakeBasic(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
<-clientDone
|
<-clientDone
|
||||||
if err != nil && err != io.EOF {
|
if err := <-errorCh; err != nil {
|
||||||
t.Fatalf("server error: %v", err)
|
t.Fatalf("sendPacket: %v", err)
|
||||||
}
|
}
|
||||||
if i != N {
|
if i != N {
|
||||||
t.Errorf("received %d messages, want 10.", i)
|
t.Errorf("received %d messages, want 10.", i)
|
||||||
@@ -345,16 +347,16 @@ func TestHandshakeAutoRekeyRead(t *testing.T) {
|
|||||||
|
|
||||||
// While we read out the packet, a key change will be
|
// While we read out the packet, a key change will be
|
||||||
// initiated.
|
// initiated.
|
||||||
done := make(chan int, 1)
|
errorCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
defer close(done)
|
_, err := trC.readPacket()
|
||||||
if _, err := trC.readPacket(); err != nil {
|
errorCh <- err
|
||||||
t.Fatalf("readPacket(client): %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
<-done
|
if err := <-errorCh; err != nil {
|
||||||
|
t.Fatalf("readPacket(client): %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
<-sync.called
|
<-sync.called
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
@@ -23,6 +23,7 @@ const (
|
|||||||
kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
|
kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
|
||||||
kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
|
kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
|
||||||
kexAlgoDH14SHA256 = "diffie-hellman-group14-sha256"
|
kexAlgoDH14SHA256 = "diffie-hellman-group14-sha256"
|
||||||
|
kexAlgoDH16SHA512 = "diffie-hellman-group16-sha512"
|
||||||
kexAlgoECDH256 = "ecdh-sha2-nistp256"
|
kexAlgoECDH256 = "ecdh-sha2-nistp256"
|
||||||
kexAlgoECDH384 = "ecdh-sha2-nistp384"
|
kexAlgoECDH384 = "ecdh-sha2-nistp384"
|
||||||
kexAlgoECDH521 = "ecdh-sha2-nistp521"
|
kexAlgoECDH521 = "ecdh-sha2-nistp521"
|
||||||
@@ -430,6 +431,17 @@ func init() {
|
|||||||
hashFunc: crypto.SHA256,
|
hashFunc: crypto.SHA256,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is the group called diffie-hellman-group16-sha512 in RFC
|
||||||
|
// 8268 and Oakley Group 16 in RFC 3526.
|
||||||
|
p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF", 16)
|
||||||
|
|
||||||
|
kexAlgoMap[kexAlgoDH16SHA512] = &dhGroup{
|
||||||
|
g: new(big.Int).SetInt64(2),
|
||||||
|
p: p,
|
||||||
|
pMinus1: new(big.Int).Sub(p, bigOne),
|
||||||
|
hashFunc: crypto.SHA512,
|
||||||
|
}
|
||||||
|
|
||||||
kexAlgoMap[kexAlgoECDH521] = &ecdh{elliptic.P521()}
|
kexAlgoMap[kexAlgoECDH521] = &ecdh{elliptic.P521()}
|
||||||
kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()}
|
kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()}
|
||||||
kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()}
|
kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package ssh
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -63,3 +64,43 @@ func TestKexes(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkKexes(b *testing.B) {
|
||||||
|
type kexResultErr struct {
|
||||||
|
result *kexResult
|
||||||
|
err error
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, kex := range kexAlgoMap {
|
||||||
|
b.Run(name, func(b *testing.B) {
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
t1, t2 := memPipe()
|
||||||
|
|
||||||
|
s := make(chan kexResultErr, 1)
|
||||||
|
c := make(chan kexResultErr, 1)
|
||||||
|
var magics handshakeMagics
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
r, e := kex.Client(t1, rand.Reader, &magics)
|
||||||
|
t1.Close()
|
||||||
|
c <- kexResultErr{r, e}
|
||||||
|
}()
|
||||||
|
go func() {
|
||||||
|
r, e := kex.Server(t2, rand.Reader, &magics, testSigners["ecdsa"].(AlgorithmSigner), testSigners["ecdsa"].PublicKey().Type())
|
||||||
|
t2.Close()
|
||||||
|
s <- kexResultErr{r, e}
|
||||||
|
}()
|
||||||
|
|
||||||
|
clientRes := <-c
|
||||||
|
serverRes := <-s
|
||||||
|
|
||||||
|
if clientRes.err != nil {
|
||||||
|
panic(fmt.Sprintf("client: %v", clientRes.err))
|
||||||
|
}
|
||||||
|
if serverRes.err != nil {
|
||||||
|
panic(fmt.Sprintf("server: %v", serverRes.err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ var macModes = map[string]*macMode{
|
|||||||
"hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
|
"hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
|
||||||
return hmac.New(sha256.New, key)
|
return hmac.New(sha256.New, key)
|
||||||
}},
|
}},
|
||||||
|
"hmac-sha2-512": {64, false, func(key []byte) hash.Hash {
|
||||||
|
return hmac.New(sha512.New, key)
|
||||||
|
}},
|
||||||
"hmac-sha2-256": {32, false, func(key []byte) hash.Hash {
|
"hmac-sha2-256": {32, false, func(key []byte) hash.Hash {
|
||||||
return hmac.New(sha256.New, key)
|
return hmac.New(sha256.New, key)
|
||||||
}},
|
}},
|
||||||
|
|||||||
+85
-38
@@ -5,6 +5,8 @@
|
|||||||
package ssh
|
package ssh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -29,14 +31,21 @@ func channelPair(t *testing.T) (*channel, *channel, *mux) {
|
|||||||
go func() {
|
go func() {
|
||||||
newCh, ok := <-s.incomingChannels
|
newCh, ok := <-s.incomingChannels
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatalf("No incoming channel")
|
t.Error("no incoming channel")
|
||||||
|
close(res)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if newCh.ChannelType() != "chan" {
|
if newCh.ChannelType() != "chan" {
|
||||||
t.Fatalf("got type %q want chan", newCh.ChannelType())
|
t.Errorf("got type %q want chan", newCh.ChannelType())
|
||||||
|
newCh.Reject(Prohibited, fmt.Sprintf("got type %q want chan", newCh.ChannelType()))
|
||||||
|
close(res)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
ch, _, err := newCh.Accept()
|
ch, _, err := newCh.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Accept %v", err)
|
t.Errorf("accept: %v", err)
|
||||||
|
close(res)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
res <- ch.(*channel)
|
res <- ch.(*channel)
|
||||||
}()
|
}()
|
||||||
@@ -45,8 +54,12 @@ func channelPair(t *testing.T) (*channel, *channel, *mux) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("OpenChannel: %v", err)
|
t.Fatalf("OpenChannel: %v", err)
|
||||||
}
|
}
|
||||||
|
w := <-res
|
||||||
|
if w == nil {
|
||||||
|
t.Fatal("unable to get write channel")
|
||||||
|
}
|
||||||
|
|
||||||
return <-res, ch, c
|
return w, ch, c
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that stderr and stdout can be addressed from different
|
// Test that stderr and stdout can be addressed from different
|
||||||
@@ -74,14 +87,14 @@ func TestMuxChannelExtendedThreadSafety(t *testing.T) {
|
|||||||
go func() {
|
go func() {
|
||||||
c, err := io.ReadAll(reader)
|
c, err := io.ReadAll(reader)
|
||||||
if string(c) != magic {
|
if string(c) != magic {
|
||||||
t.Fatalf("stdout read got %q, want %q (error %s)", c, magic, err)
|
t.Errorf("stdout read got %q, want %q (error %s)", c, magic, err)
|
||||||
}
|
}
|
||||||
rd.Done()
|
rd.Done()
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
c, err := io.ReadAll(reader.Stderr())
|
c, err := io.ReadAll(reader.Stderr())
|
||||||
if string(c) != magic {
|
if string(c) != magic {
|
||||||
t.Fatalf("stderr read got %q, want %q (error %s)", c, magic, err)
|
t.Errorf("stderr read got %q, want %q (error %s)", c, magic, err)
|
||||||
}
|
}
|
||||||
rd.Done()
|
rd.Done()
|
||||||
}()
|
}()
|
||||||
@@ -102,11 +115,13 @@ func TestMuxReadWrite(t *testing.T) {
|
|||||||
go func() {
|
go func() {
|
||||||
_, err := s.Write([]byte(magic))
|
_, err := s.Write([]byte(magic))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Write: %v", err)
|
t.Errorf("Write: %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
_, err = s.Extended(1).Write([]byte(magicExt))
|
_, err = s.Extended(1).Write([]byte(magicExt))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Write: %v", err)
|
t.Errorf("Write: %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -215,10 +230,13 @@ func TestMuxReject(t *testing.T) {
|
|||||||
go func() {
|
go func() {
|
||||||
ch, ok := <-server.incomingChannels
|
ch, ok := <-server.incomingChannels
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatalf("Accept")
|
t.Error("cannot accept channel")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if ch.ChannelType() != "ch" || string(ch.ExtraData()) != "extra" {
|
if ch.ChannelType() != "ch" || string(ch.ExtraData()) != "extra" {
|
||||||
t.Fatalf("unexpected channel: %q, %q", ch.ChannelType(), ch.ExtraData())
|
t.Errorf("unexpected channel: %q, %q", ch.ChannelType(), ch.ExtraData())
|
||||||
|
ch.Reject(RejectionReason(UnknownChannelType), UnknownChannelType.String())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
ch.Reject(RejectionReason(42), "message")
|
ch.Reject(RejectionReason(42), "message")
|
||||||
}()
|
}()
|
||||||
@@ -294,7 +312,7 @@ func TestMuxUnknownChannelRequests(t *testing.T) {
|
|||||||
defer serverPipe.Close()
|
defer serverPipe.Close()
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
|
|
||||||
kDone := make(chan struct{})
|
kDone := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
// Ignore unknown channel messages that don't want a reply.
|
// Ignore unknown channel messages that don't want a reply.
|
||||||
err := serverPipe.writePacket(Marshal(channelRequestMsg{
|
err := serverPipe.writePacket(Marshal(channelRequestMsg{
|
||||||
@@ -304,7 +322,8 @@ func TestMuxUnknownChannelRequests(t *testing.T) {
|
|||||||
RequestSpecificData: []byte{},
|
RequestSpecificData: []byte{},
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("send: %v", err)
|
kDone <- fmt.Errorf("send: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a keepalive, which should get a channel failure message
|
// Send a keepalive, which should get a channel failure message
|
||||||
@@ -316,44 +335,53 @@ func TestMuxUnknownChannelRequests(t *testing.T) {
|
|||||||
RequestSpecificData: []byte{},
|
RequestSpecificData: []byte{},
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("send: %v", err)
|
kDone <- fmt.Errorf("send: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
packet, err := serverPipe.readPacket()
|
packet, err := serverPipe.readPacket()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read packet: %v", err)
|
kDone <- fmt.Errorf("read packet: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
decoded, err := decode(packet)
|
decoded, err := decode(packet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("decode failed: %v", err)
|
kDone <- fmt.Errorf("decode failed: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch msg := decoded.(type) {
|
switch msg := decoded.(type) {
|
||||||
case *channelRequestFailureMsg:
|
case *channelRequestFailureMsg:
|
||||||
if msg.PeersID != 2 {
|
if msg.PeersID != 2 {
|
||||||
t.Fatalf("received response to wrong message: %v", msg)
|
kDone <- fmt.Errorf("received response to wrong message: %v", msg)
|
||||||
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
t.Fatalf("unexpected channel message: %v", msg)
|
kDone <- fmt.Errorf("unexpected channel message: %v", msg)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
kDone <- struct{}{}
|
kDone <- nil
|
||||||
|
|
||||||
// Receive and respond to the keepalive to confirm the mux is
|
// Receive and respond to the keepalive to confirm the mux is
|
||||||
// still processing requests.
|
// still processing requests.
|
||||||
packet, err = serverPipe.readPacket()
|
packet, err = serverPipe.readPacket()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read packet: %v", err)
|
kDone <- fmt.Errorf("read packet: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if packet[0] != msgGlobalRequest {
|
if packet[0] != msgGlobalRequest {
|
||||||
t.Fatalf("expected global request")
|
kDone <- errors.New("expected global request")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = serverPipe.writePacket(Marshal(globalRequestFailureMsg{
|
err = serverPipe.writePacket(Marshal(globalRequestFailureMsg{
|
||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to send failure msg: %v", err)
|
kDone <- fmt.Errorf("failed to send failure msg: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
close(kDone)
|
close(kDone)
|
||||||
@@ -362,7 +390,10 @@ func TestMuxUnknownChannelRequests(t *testing.T) {
|
|||||||
// Wait for the server to send the keepalive message and receive back a
|
// Wait for the server to send the keepalive message and receive back a
|
||||||
// response.
|
// response.
|
||||||
select {
|
select {
|
||||||
case <-kDone:
|
case err := <-kDone:
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(10 * time.Second):
|
||||||
t.Fatalf("server never received ack")
|
t.Fatalf("server never received ack")
|
||||||
}
|
}
|
||||||
@@ -373,7 +404,10 @@ func TestMuxUnknownChannelRequests(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-kDone:
|
case err := <-kDone:
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(10 * time.Second):
|
||||||
t.Fatalf("server never shut down")
|
t.Fatalf("server never shut down")
|
||||||
}
|
}
|
||||||
@@ -385,20 +419,23 @@ func TestMuxClosedChannel(t *testing.T) {
|
|||||||
defer serverPipe.Close()
|
defer serverPipe.Close()
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
|
|
||||||
kDone := make(chan struct{})
|
kDone := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
// Open the channel.
|
// Open the channel.
|
||||||
packet, err := serverPipe.readPacket()
|
packet, err := serverPipe.readPacket()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read packet: %v", err)
|
kDone <- fmt.Errorf("read packet: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if packet[0] != msgChannelOpen {
|
if packet[0] != msgChannelOpen {
|
||||||
t.Fatalf("expected chan open")
|
kDone <- errors.New("expected chan open")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var openMsg channelOpenMsg
|
var openMsg channelOpenMsg
|
||||||
if err := Unmarshal(packet, &openMsg); err != nil {
|
if err := Unmarshal(packet, &openMsg); err != nil {
|
||||||
t.Fatalf("unmarshal: %v", err)
|
kDone <- fmt.Errorf("unmarshal: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send back the opened channel confirmation.
|
// Send back the opened channel confirmation.
|
||||||
@@ -409,7 +446,8 @@ func TestMuxClosedChannel(t *testing.T) {
|
|||||||
MaxPacketSize: channelMaxPacket,
|
MaxPacketSize: channelMaxPacket,
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("send: %v", err)
|
kDone <- fmt.Errorf("send: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the channel.
|
// Close the channel.
|
||||||
@@ -417,7 +455,8 @@ func TestMuxClosedChannel(t *testing.T) {
|
|||||||
PeersID: openMsg.PeersID,
|
PeersID: openMsg.PeersID,
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("send: %v", err)
|
kDone <- fmt.Errorf("send: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a keepalive message on the channel we just closed.
|
// Send a keepalive message on the channel we just closed.
|
||||||
@@ -428,43 +467,51 @@ func TestMuxClosedChannel(t *testing.T) {
|
|||||||
RequestSpecificData: []byte{},
|
RequestSpecificData: []byte{},
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("send: %v", err)
|
kDone <- fmt.Errorf("send: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive the channel closed response.
|
// Receive the channel closed response.
|
||||||
packet, err = serverPipe.readPacket()
|
packet, err = serverPipe.readPacket()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read packet: %v", err)
|
kDone <- fmt.Errorf("read packet: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if packet[0] != msgChannelClose {
|
if packet[0] != msgChannelClose {
|
||||||
t.Fatalf("expected channel close")
|
kDone <- errors.New("expected channel close")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive the keepalive response failure.
|
// Receive the keepalive response failure.
|
||||||
packet, err = serverPipe.readPacket()
|
packet, err = serverPipe.readPacket()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read packet: %v", err)
|
kDone <- fmt.Errorf("read packet: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if packet[0] != msgChannelFailure {
|
if packet[0] != msgChannelFailure {
|
||||||
t.Fatalf("expected channel close")
|
kDone <- errors.New("expected channel failure")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
kDone <- struct{}{}
|
kDone <- nil
|
||||||
|
|
||||||
// Receive and respond to the keepalive to confirm the mux is
|
// Receive and respond to the keepalive to confirm the mux is
|
||||||
// still processing requests.
|
// still processing requests.
|
||||||
packet, err = serverPipe.readPacket()
|
packet, err = serverPipe.readPacket()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("read packet: %v", err)
|
kDone <- fmt.Errorf("read packet: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if packet[0] != msgGlobalRequest {
|
if packet[0] != msgGlobalRequest {
|
||||||
t.Fatalf("expected global request")
|
kDone <- errors.New("expected global request")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = serverPipe.writePacket(Marshal(globalRequestFailureMsg{
|
err = serverPipe.writePacket(Marshal(globalRequestFailureMsg{
|
||||||
Data: []byte{},
|
Data: []byte{},
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to send failure msg: %v", err)
|
kDone <- fmt.Errorf("failed to send failure msg: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
close(kDone)
|
close(kDone)
|
||||||
|
|||||||
+20
-1
@@ -370,6 +370,25 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c
|
|||||||
return authErr, perms, nil
|
return authErr, perms, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isAlgoCompatible checks if the signature format is compatible with the
|
||||||
|
// selected algorithm taking into account edge cases that occur with old
|
||||||
|
// clients.
|
||||||
|
func isAlgoCompatible(algo, sigFormat string) bool {
|
||||||
|
// Compatibility for old clients.
|
||||||
|
//
|
||||||
|
// For certificate authentication with OpenSSH 7.2-7.7 signature format can
|
||||||
|
// be rsa-sha2-256 or rsa-sha2-512 for the algorithm
|
||||||
|
// ssh-rsa-cert-v01@openssh.com.
|
||||||
|
//
|
||||||
|
// With gpg-agent < 2.2.6 the algorithm can be rsa-sha2-256 or rsa-sha2-512
|
||||||
|
// for signature format ssh-rsa.
|
||||||
|
if isRSA(algo) && isRSA(sigFormat) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// Standard case: the underlying algorithm must match the signature format.
|
||||||
|
return underlyingAlgo(algo) == sigFormat
|
||||||
|
}
|
||||||
|
|
||||||
// ServerAuthError represents server authentication errors and is
|
// ServerAuthError represents server authentication errors and is
|
||||||
// sometimes returned by NewServerConn. It appends any authentication
|
// sometimes returned by NewServerConn. It appends any authentication
|
||||||
// errors that may occur, and is returned if all of the authentication
|
// errors that may occur, and is returned if all of the authentication
|
||||||
@@ -567,7 +586,7 @@ userAuthLoop:
|
|||||||
authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format)
|
authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if underlyingAlgo(algo) != sig.Format {
|
if !isAlgoCompatible(algo, sig.Format) {
|
||||||
authErr = fmt.Errorf("ssh: signature %q not compatible with selected algorithm %q", sig.Format, algo)
|
authErr = fmt.Errorf("ssh: signature %q not compatible with selected algorithm %q", sig.Format, algo)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-3
@@ -36,7 +36,8 @@ func dial(handler serverType, t *testing.T) *Client {
|
|||||||
|
|
||||||
conn, chans, reqs, err := NewServerConn(c1, &conf)
|
conn, chans, reqs, err := NewServerConn(c1, &conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to handshake: %v", err)
|
t.Errorf("Unable to handshake: %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
go DiscardRequests(reqs)
|
go DiscardRequests(reqs)
|
||||||
|
|
||||||
@@ -647,10 +648,12 @@ func TestSessionID(t *testing.T) {
|
|||||||
User: "user",
|
User: "user",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srvErrCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
conn, chans, reqs, err := NewServerConn(c1, serverConf)
|
conn, chans, reqs, err := NewServerConn(c1, serverConf)
|
||||||
|
srvErrCh <- err
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("server handshake: %v", err)
|
return
|
||||||
}
|
}
|
||||||
serverID <- conn.SessionID()
|
serverID <- conn.SessionID()
|
||||||
go DiscardRequests(reqs)
|
go DiscardRequests(reqs)
|
||||||
@@ -659,10 +662,12 @@ func TestSessionID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
cliErrCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
conn, chans, reqs, err := NewClientConn(c2, "", clientConf)
|
conn, chans, reqs, err := NewClientConn(c2, "", clientConf)
|
||||||
|
cliErrCh <- err
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("client handshake: %v", err)
|
return
|
||||||
}
|
}
|
||||||
clientID <- conn.SessionID()
|
clientID <- conn.SessionID()
|
||||||
go DiscardRequests(reqs)
|
go DiscardRequests(reqs)
|
||||||
@@ -671,6 +676,14 @@ func TestSessionID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if err := <-srvErrCh; err != nil {
|
||||||
|
t.Fatalf("server handshake: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := <-cliErrCh; err != nil {
|
||||||
|
t.Fatalf("client handshake: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
s := <-serverID
|
s := <-serverID
|
||||||
c := <-clientID
|
c := <-clientID
|
||||||
if bytes.Compare(s, c) != 0 {
|
if bytes.Compare(s, c) != 0 {
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import (
|
|||||||
|
|
||||||
func TestAgentForward(t *testing.T) {
|
func TestAgentForward(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import (
|
|||||||
|
|
||||||
func TestBannerCallbackAgainstOpenSSH(t *testing.T) {
|
func TestBannerCallbackAgainstOpenSSH(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
|
|
||||||
clientConf := clientConfig()
|
clientConf := clientConfig()
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import (
|
|||||||
// Test both logging in with a cert, and also that the certificate presented by an OpenSSH host can be validated correctly
|
// Test both logging in with a cert, and also that the certificate presented by an OpenSSH host can be validated correctly
|
||||||
func TestCertLogin(t *testing.T) {
|
func TestCertLogin(t *testing.T) {
|
||||||
s := newServer(t)
|
s := newServer(t)
|
||||||
defer s.Shutdown()
|
|
||||||
|
|
||||||
// Use a key different from the default.
|
// Use a key different from the default.
|
||||||
clientKey := testSigners["dsa"]
|
clientKey := testSigners["dsa"]
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ type dialTester interface {
|
|||||||
|
|
||||||
func testDial(t *testing.T, n, listenAddr string, x dialTester) {
|
func testDial(t *testing.T, n, listenAddr string, x dialTester) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
sshConn := server.Dial(clientConfig())
|
sshConn := server.Dial(clientConfig())
|
||||||
defer sshConn.Close()
|
defer sshConn.Close()
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ type closeWriter interface {
|
|||||||
|
|
||||||
func testPortForward(t *testing.T, n, listenAddr string) {
|
func testPortForward(t *testing.T, n, listenAddr string) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -120,7 +119,6 @@ func TestPortForwardUnix(t *testing.T) {
|
|||||||
|
|
||||||
func testAcceptClose(t *testing.T, n, listenAddr string) {
|
func testAcceptClose(t *testing.T, n, listenAddr string) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
|
|
||||||
sshListener, err := conn.Listen(n, listenAddr)
|
sshListener, err := conn.Listen(n, listenAddr)
|
||||||
@@ -162,10 +160,9 @@ func TestAcceptCloseUnix(t *testing.T) {
|
|||||||
// Check that listeners exit if the underlying client transport dies.
|
// Check that listeners exit if the underlying client transport dies.
|
||||||
func testPortForwardConnectionClose(t *testing.T, n, listenAddr string) {
|
func testPortForwardConnectionClose(t *testing.T, n, listenAddr string) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
client := server.Dial(clientConfig())
|
||||||
conn := server.Dial(clientConfig())
|
|
||||||
|
|
||||||
sshListener, err := conn.Listen(n, listenAddr)
|
sshListener, err := client.Listen(n, listenAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -184,14 +181,10 @@ func testPortForwardConnectionClose(t *testing.T, n, listenAddr string) {
|
|||||||
|
|
||||||
// It would be even nicer if we closed the server side, but it
|
// It would be even nicer if we closed the server side, but it
|
||||||
// is more involved as the fd for that side is dup()ed.
|
// is more involved as the fd for that side is dup()ed.
|
||||||
server.clientConn.Close()
|
server.lastDialConn.Close()
|
||||||
|
|
||||||
select {
|
err = <-quit
|
||||||
case <-time.After(1 * time.Second):
|
t.Logf("quit as expected (error %v)", err)
|
||||||
t.Errorf("timeout: listener did not close.")
|
|
||||||
case err := <-quit:
|
|
||||||
t.Logf("quit as expected (error %v)", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPortForwardConnectionCloseTCP(t *testing.T) {
|
func TestPortForwardConnectionCloseTCP(t *testing.T) {
|
||||||
|
|||||||
@@ -77,27 +77,27 @@ func (ctx *multiAuthTestCtx) kbdIntCb(user, instruction string, questions []stri
|
|||||||
func TestMultiAuth(t *testing.T) {
|
func TestMultiAuth(t *testing.T) {
|
||||||
testCases := []multiAuthTestCase{
|
testCases := []multiAuthTestCase{
|
||||||
// Test password,publickey authentication, assert that password callback is called 1 time
|
// Test password,publickey authentication, assert that password callback is called 1 time
|
||||||
multiAuthTestCase{
|
{
|
||||||
authMethods: []string{"password", "publickey"},
|
authMethods: []string{"password", "publickey"},
|
||||||
expectedPasswordCbs: 1,
|
expectedPasswordCbs: 1,
|
||||||
},
|
},
|
||||||
// Test keyboard-interactive,publickey authentication, assert that keyboard-interactive callback is called 1 time
|
// Test keyboard-interactive,publickey authentication, assert that keyboard-interactive callback is called 1 time
|
||||||
multiAuthTestCase{
|
{
|
||||||
authMethods: []string{"keyboard-interactive", "publickey"},
|
authMethods: []string{"keyboard-interactive", "publickey"},
|
||||||
expectedKbdIntCbs: 1,
|
expectedKbdIntCbs: 1,
|
||||||
},
|
},
|
||||||
// Test publickey,password authentication, assert that password callback is called 1 time
|
// Test publickey,password authentication, assert that password callback is called 1 time
|
||||||
multiAuthTestCase{
|
{
|
||||||
authMethods: []string{"publickey", "password"},
|
authMethods: []string{"publickey", "password"},
|
||||||
expectedPasswordCbs: 1,
|
expectedPasswordCbs: 1,
|
||||||
},
|
},
|
||||||
// Test publickey,keyboard-interactive authentication, assert that keyboard-interactive callback is called 1 time
|
// Test publickey,keyboard-interactive authentication, assert that keyboard-interactive callback is called 1 time
|
||||||
multiAuthTestCase{
|
{
|
||||||
authMethods: []string{"publickey", "keyboard-interactive"},
|
authMethods: []string{"publickey", "keyboard-interactive"},
|
||||||
expectedKbdIntCbs: 1,
|
expectedKbdIntCbs: 1,
|
||||||
},
|
},
|
||||||
// Test password,password authentication, assert that password callback is called 2 times
|
// Test password,password authentication, assert that password callback is called 2 times
|
||||||
multiAuthTestCase{
|
{
|
||||||
authMethods: []string{"password", "password"},
|
authMethods: []string{"password", "password"},
|
||||||
expectedPasswordCbs: 2,
|
expectedPasswordCbs: 2,
|
||||||
},
|
},
|
||||||
@@ -108,7 +108,6 @@ func TestMultiAuth(t *testing.T) {
|
|||||||
ctx := newMultiAuthTestCtx(t)
|
ctx := newMultiAuthTestCtx(t)
|
||||||
|
|
||||||
server := newServerForConfig(t, "MultiAuth", map[string]string{"AuthMethods": strings.Join(testCase.authMethods, ",")})
|
server := newServerForConfig(t, "MultiAuth", map[string]string{"AuthMethods": strings.Join(testCase.authMethods, ",")})
|
||||||
defer server.Shutdown()
|
|
||||||
|
|
||||||
clientConfig := clientConfig()
|
clientConfig := clientConfig()
|
||||||
server.setTestPassword(clientConfig.User, ctx.password)
|
server.setTestPassword(clientConfig.User, ctx.password)
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import (
|
|||||||
|
|
||||||
func TestRunCommandSuccess(t *testing.T) {
|
func TestRunCommandSuccess(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -42,7 +41,6 @@ func TestRunCommandSuccess(t *testing.T) {
|
|||||||
|
|
||||||
func TestHostKeyCheck(t *testing.T) {
|
func TestHostKeyCheck(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
|
|
||||||
conf := clientConfig()
|
conf := clientConfig()
|
||||||
hostDB := hostKeyDB()
|
hostDB := hostKeyDB()
|
||||||
@@ -64,7 +62,6 @@ func TestHostKeyCheck(t *testing.T) {
|
|||||||
|
|
||||||
func TestRunCommandStdin(t *testing.T) {
|
func TestRunCommandStdin(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -87,7 +84,6 @@ func TestRunCommandStdin(t *testing.T) {
|
|||||||
|
|
||||||
func TestRunCommandStdinError(t *testing.T) {
|
func TestRunCommandStdinError(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -111,7 +107,6 @@ func TestRunCommandStdinError(t *testing.T) {
|
|||||||
|
|
||||||
func TestRunCommandFailed(t *testing.T) {
|
func TestRunCommandFailed(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -128,7 +123,6 @@ func TestRunCommandFailed(t *testing.T) {
|
|||||||
|
|
||||||
func TestRunCommandWeClosed(t *testing.T) {
|
func TestRunCommandWeClosed(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -148,7 +142,6 @@ func TestRunCommandWeClosed(t *testing.T) {
|
|||||||
|
|
||||||
func TestFuncLargeRead(t *testing.T) {
|
func TestFuncLargeRead(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -180,7 +173,6 @@ func TestFuncLargeRead(t *testing.T) {
|
|||||||
|
|
||||||
func TestKeyChange(t *testing.T) {
|
func TestKeyChange(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conf := clientConfig()
|
conf := clientConfig()
|
||||||
hostDB := hostKeyDB()
|
hostDB := hostKeyDB()
|
||||||
conf.HostKeyCallback = hostDB.Check
|
conf.HostKeyCallback = hostDB.Check
|
||||||
@@ -227,7 +219,6 @@ func TestValidTerminalMode(t *testing.T) {
|
|||||||
t.Skipf("skipping on %s", runtime.GOOS)
|
t.Skipf("skipping on %s", runtime.GOOS)
|
||||||
}
|
}
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -257,7 +248,7 @@ func TestValidTerminalMode(t *testing.T) {
|
|||||||
t.Fatalf("session failed: %s", err)
|
t.Fatalf("session failed: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := io.WriteString(stdin, "echo SHELL $SHELL && stty -a && exit\n"); err != nil {
|
if _, err := io.WriteString(stdin, "echo && echo SHELL $SHELL && stty -a && exit\n"); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +258,7 @@ func TestValidTerminalMode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if testing.Verbose() {
|
if testing.Verbose() {
|
||||||
t.Logf("echo SHELL $SHELL && stty -a && exit:\n%s", buf)
|
t.Logf("echo && echo SHELL $SHELL && stty -a && exit:\n%s", buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
shellLine := regexp.MustCompile("(?m)^SHELL (.*)$").FindStringSubmatch(buf.String())
|
shellLine := regexp.MustCompile("(?m)^SHELL (.*)$").FindStringSubmatch(buf.String())
|
||||||
@@ -292,7 +283,6 @@ func TestWindowChange(t *testing.T) {
|
|||||||
t.Skipf("skipping on %s", runtime.GOOS)
|
t.Skipf("skipping on %s", runtime.GOOS)
|
||||||
}
|
}
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conn := server.Dial(clientConfig())
|
conn := server.Dial(clientConfig())
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
@@ -340,7 +330,6 @@ func TestWindowChange(t *testing.T) {
|
|||||||
|
|
||||||
func testOneCipher(t *testing.T, cipher string, cipherOrder []string) {
|
func testOneCipher(t *testing.T, cipher string, cipherOrder []string) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conf := clientConfig()
|
conf := clientConfig()
|
||||||
conf.Ciphers = []string{cipher}
|
conf.Ciphers = []string{cipher}
|
||||||
// Don't fail if sshd doesn't have the cipher.
|
// Don't fail if sshd doesn't have the cipher.
|
||||||
@@ -399,7 +388,6 @@ func TestMACs(t *testing.T) {
|
|||||||
for _, mac := range macOrder {
|
for _, mac := range macOrder {
|
||||||
t.Run(mac, func(t *testing.T) {
|
t.Run(mac, func(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conf := clientConfig()
|
conf := clientConfig()
|
||||||
conf.MACs = []string{mac}
|
conf.MACs = []string{mac}
|
||||||
// Don't fail if sshd doesn't have the MAC.
|
// Don't fail if sshd doesn't have the MAC.
|
||||||
@@ -422,10 +410,12 @@ func TestKeyExchanges(t *testing.T) {
|
|||||||
// are not included in the default list of supported kex so we have to add them
|
// are not included in the default list of supported kex so we have to add them
|
||||||
// here manually.
|
// here manually.
|
||||||
kexOrder = append(kexOrder, "diffie-hellman-group-exchange-sha1", "diffie-hellman-group-exchange-sha256")
|
kexOrder = append(kexOrder, "diffie-hellman-group-exchange-sha1", "diffie-hellman-group-exchange-sha256")
|
||||||
|
// The key exchange algorithms diffie-hellman-group16-sha512 is disabled by
|
||||||
|
// default so we add it here manually.
|
||||||
|
kexOrder = append(kexOrder, "diffie-hellman-group16-sha512")
|
||||||
for _, kex := range kexOrder {
|
for _, kex := range kexOrder {
|
||||||
t.Run(kex, func(t *testing.T) {
|
t.Run(kex, func(t *testing.T) {
|
||||||
server := newServer(t)
|
server := newServer(t)
|
||||||
defer server.Shutdown()
|
|
||||||
conf := clientConfig()
|
conf := clientConfig()
|
||||||
// Don't fail if sshd doesn't have the kex.
|
// Don't fail if sshd doesn't have the kex.
|
||||||
conf.KeyExchanges = append([]string{kex}, kexOrder...)
|
conf.KeyExchanges = append([]string{kex}, kexOrder...)
|
||||||
@@ -460,8 +450,6 @@ func TestClientAuthAlgorithms(t *testing.T) {
|
|||||||
} else {
|
} else {
|
||||||
t.Errorf("failed for key %q", key)
|
t.Errorf("failed for key %q", key)
|
||||||
}
|
}
|
||||||
|
|
||||||
server.Shutdown()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-37
@@ -23,6 +23,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"golang.org/x/crypto/internal/testenv"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
"golang.org/x/crypto/ssh/testdata"
|
"golang.org/x/crypto/ssh/testdata"
|
||||||
)
|
)
|
||||||
@@ -67,17 +68,13 @@ var configTmpl = map[string]*template.Template{
|
|||||||
|
|
||||||
type server struct {
|
type server struct {
|
||||||
t *testing.T
|
t *testing.T
|
||||||
cleanup func() // executed during Shutdown
|
|
||||||
configfile string
|
configfile string
|
||||||
cmd *exec.Cmd
|
|
||||||
output bytes.Buffer // holds stderr from sshd process
|
|
||||||
|
|
||||||
testUser string // test username for sshd
|
testUser string // test username for sshd
|
||||||
testPasswd string // test password for sshd
|
testPasswd string // test password for sshd
|
||||||
sshdTestPwSo string // dynamic library to inject a custom password into sshd
|
sshdTestPwSo string // dynamic library to inject a custom password into sshd
|
||||||
|
|
||||||
// Client half of the network connection.
|
lastDialConn net.Conn
|
||||||
clientConn net.Conn
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func username() string {
|
func username() string {
|
||||||
@@ -193,15 +190,15 @@ func (s *server) TryDialWithAddr(config *ssh.ClientConfig, addr string) (*ssh.Cl
|
|||||||
s.t.Fatalf("unixConnection: %v", err)
|
s.t.Fatalf("unixConnection: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.cmd = exec.Command(sshd, "-f", s.configfile, "-i", "-e")
|
cmd := testenv.Command(s.t, sshd, "-f", s.configfile, "-i", "-e")
|
||||||
f, err := c2.File()
|
f, err := c2.File()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.t.Fatalf("UnixConn.File: %v", err)
|
s.t.Fatalf("UnixConn.File: %v", err)
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
s.cmd.Stdin = f
|
cmd.Stdin = f
|
||||||
s.cmd.Stdout = f
|
cmd.Stdout = f
|
||||||
s.cmd.Stderr = &s.output
|
cmd.Stderr = new(bytes.Buffer)
|
||||||
|
|
||||||
if s.sshdTestPwSo != "" {
|
if s.sshdTestPwSo != "" {
|
||||||
if s.testUser == "" {
|
if s.testUser == "" {
|
||||||
@@ -210,18 +207,29 @@ func (s *server) TryDialWithAddr(config *ssh.ClientConfig, addr string) (*ssh.Cl
|
|||||||
if s.testPasswd == "" {
|
if s.testPasswd == "" {
|
||||||
s.t.Fatal("password missing from sshd_test_pw.so config")
|
s.t.Fatal("password missing from sshd_test_pw.so config")
|
||||||
}
|
}
|
||||||
s.cmd.Env = append(os.Environ(),
|
cmd.Env = append(os.Environ(),
|
||||||
fmt.Sprintf("LD_PRELOAD=%s", s.sshdTestPwSo),
|
fmt.Sprintf("LD_PRELOAD=%s", s.sshdTestPwSo),
|
||||||
fmt.Sprintf("TEST_USER=%s", s.testUser),
|
fmt.Sprintf("TEST_USER=%s", s.testUser),
|
||||||
fmt.Sprintf("TEST_PASSWD=%s", s.testPasswd))
|
fmt.Sprintf("TEST_PASSWD=%s", s.testPasswd))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
s.t.Fail()
|
|
||||||
s.Shutdown()
|
|
||||||
s.t.Fatalf("s.cmd.Start: %v", err)
|
s.t.Fatalf("s.cmd.Start: %v", err)
|
||||||
}
|
}
|
||||||
s.clientConn = c1
|
s.lastDialConn = c1
|
||||||
|
s.t.Cleanup(func() {
|
||||||
|
// Don't check for errors; if it fails it's most
|
||||||
|
// likely "os: process already finished", and we don't
|
||||||
|
// care about that. Use os.Interrupt, so child
|
||||||
|
// processes are killed too.
|
||||||
|
cmd.Process.Signal(os.Interrupt)
|
||||||
|
cmd.Wait()
|
||||||
|
if s.t.Failed() {
|
||||||
|
// log any output from sshd process
|
||||||
|
s.t.Logf("sshd:\n%s", cmd.Stderr)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
conn, chans, reqs, err := ssh.NewClientConn(c1, addr, config)
|
conn, chans, reqs, err := ssh.NewClientConn(c1, addr, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -232,29 +240,11 @@ func (s *server) TryDialWithAddr(config *ssh.ClientConfig, addr string) (*ssh.Cl
|
|||||||
func (s *server) Dial(config *ssh.ClientConfig) *ssh.Client {
|
func (s *server) Dial(config *ssh.ClientConfig) *ssh.Client {
|
||||||
conn, err := s.TryDial(config)
|
conn, err := s.TryDial(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.t.Fail()
|
|
||||||
s.Shutdown()
|
|
||||||
s.t.Fatalf("ssh.Client: %v", err)
|
s.t.Fatalf("ssh.Client: %v", err)
|
||||||
}
|
}
|
||||||
return conn
|
return conn
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) Shutdown() {
|
|
||||||
if s.cmd != nil && s.cmd.Process != nil {
|
|
||||||
// Don't check for errors; if it fails it's most
|
|
||||||
// likely "os: process already finished", and we don't
|
|
||||||
// care about that. Use os.Interrupt, so child
|
|
||||||
// processes are killed too.
|
|
||||||
s.cmd.Process.Signal(os.Interrupt)
|
|
||||||
s.cmd.Wait()
|
|
||||||
}
|
|
||||||
if s.t.Failed() {
|
|
||||||
// log any output from sshd process
|
|
||||||
s.t.Logf("sshd: %s", s.output.String())
|
|
||||||
}
|
|
||||||
s.cleanup()
|
|
||||||
}
|
|
||||||
|
|
||||||
func writeFile(path string, contents []byte) {
|
func writeFile(path string, contents []byte) {
|
||||||
f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0600)
|
f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -351,15 +341,15 @@ func newServerForConfig(t *testing.T, config string, configVars map[string]strin
|
|||||||
authkeys.Write(ssh.MarshalAuthorizedKey(testPublicKeys[k]))
|
authkeys.Write(ssh.MarshalAuthorizedKey(testPublicKeys[k]))
|
||||||
}
|
}
|
||||||
writeFile(filepath.Join(dir, "authorized_keys"), authkeys.Bytes())
|
writeFile(filepath.Join(dir, "authorized_keys"), authkeys.Bytes())
|
||||||
|
t.Cleanup(func() {
|
||||||
|
if err := os.RemoveAll(dir); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return &server{
|
return &server{
|
||||||
t: t,
|
t: t,
|
||||||
configfile: f.Name(),
|
configfile: f.Name(),
|
||||||
cleanup: func() {
|
|
||||||
if err := os.RemoveAll(dir); err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+202
-117
@@ -1,5 +1,6 @@
|
|||||||
// Code generated by gen.go at Mon, 17 Apr 2023 10:17:20 PDT; DO NOT EDIT.
|
// Code generated by gen_fallback_bundle.go; DO NOT EDIT.
|
||||||
// list hash: ceaec72125bf99ab9f1a05b7883679481c07d23388cc10d40ca102f87f4e39a2
|
|
||||||
|
//go:build go1.20
|
||||||
|
|
||||||
package fallback
|
package fallback
|
||||||
|
|
||||||
@@ -359,6 +360,55 @@ maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D
|
|||||||
lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv
|
lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv
|
||||||
KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
|
KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
|
# CN=Atos TrustedRoot Root CA ECC TLS 2021,O=Atos,C=DE
|
||||||
|
# b2fae53e14ccd7ab9212064701ae279c1d8988facb775fa8a008914e663988a8
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4w
|
||||||
|
LAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0w
|
||||||
|
CwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0
|
||||||
|
MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBF
|
||||||
|
Q0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMHYwEAYHKoZI
|
||||||
|
zj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6KDP/X
|
||||||
|
tXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4
|
||||||
|
AjJn8ZQSb+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2
|
||||||
|
KCXWfeBmmnoJsmo7jjPXNtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMD
|
||||||
|
aAAwZQIwW5kp85wxtolrbNa9d+F851F+uDrNozZffPc8dz7kUK2o59JZDCaOMDtu
|
||||||
|
CCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGYa3cpetskz2VAv9LcjBHo
|
||||||
|
9H1/IISpQuQo
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
# CN=Atos TrustedRoot Root CA RSA TLS 2021,O=Atos,C=DE
|
||||||
|
# 81a9088ea59fb364c548a6f85559099b6f0405efbf18e5324ec9f457ba00112f
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBM
|
||||||
|
MS4wLAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIx
|
||||||
|
MQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00
|
||||||
|
MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBD
|
||||||
|
QSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMIICIjAN
|
||||||
|
BgkqhkiG9w0BAQEFAAOCAg8AM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
|
o0UvFJ/1TCplQ3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJ
|
||||||
|
qM7F78PRreBrAwA0JrRUITWXAdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuyw
|
||||||
|
xfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9GslA9hGCZcbUztVdF5kJHdWoOsAgM
|
||||||
|
rr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2VktafcxBPTy+av5EzH4
|
||||||
|
AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9qTFsR
|
||||||
|
0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuY
|
||||||
|
o7Ey7Nmj1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5
|
||||||
|
dDTedk+SKlOxJTnbPP/lPqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcE
|
||||||
|
oji2jbDwN/zIIX8/syQbPYtuzE2wFg2WHYMfRsCbvUOZ58SWLs5fyQ==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
# CN=Autoridad de Certificacion Firmaprofesional CIF A62634068,C=ES
|
# CN=Autoridad de Certificacion Firmaprofesional CIF A62634068,C=ES
|
||||||
# 57de0583efd2b26e0361da99da9df4648def7ee8441c3b728afa9bcde0f9b26a
|
# 57de0583efd2b26e0361da99da9df4648def7ee8441c3b728afa9bcde0f9b26a
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
@@ -433,6 +483,56 @@ StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz
|
|||||||
Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB
|
Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB
|
||||||
jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
|
jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
|
# CN=BJCA Global Root CA1,O=BEIJING CERTIFICATE AUTHORITY,C=CN
|
||||||
|
# f3896f88fe7c0a882766a7fa6ad2749fb57a7f3e98fb769c1fa7b09c2c44d5ae
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBU
|
||||||
|
MQswCQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRI
|
||||||
|
T1JJVFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAz
|
||||||
|
MTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJF
|
||||||
|
SUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2Jh
|
||||||
|
bCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFmCL3Z
|
||||||
|
xRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZ
|
||||||
|
spDyRhySsTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O5
|
||||||
|
58dnJCNPYwpj9mZ9S1WnP3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgR
|
||||||
|
at7GGPZHOiJBhyL8xIkoVNiMpTAK+BcWyqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll
|
||||||
|
5+M7sSKGjwZteAf9kRJ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I
|
||||||
|
+pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRz
|
||||||
|
znfSxqxx4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9
|
||||||
|
eVzYH6Eze9mCUAyTF6ps3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2
|
||||||
|
YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4SSPfSKcOYKMryMguTjClPPGAyzQWWYezy
|
||||||
|
r/6zcCwupvI=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
# CN=BJCA Global Root CA2,O=BEIJING CERTIFICATE AUTHORITY,C=CN
|
||||||
|
# 574df6931e278039667b720afdc1600fc27eb66dd3092979fb73856487212882
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQsw
|
||||||
|
CQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJ
|
||||||
|
VFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgy
|
||||||
|
MVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJ
|
||||||
|
TkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2JhbCBS
|
||||||
|
b290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jlSR9B
|
||||||
|
IgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK+
|
||||||
|
+kpRuDCK/eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJK
|
||||||
|
sVF/BvDRgh9Obl+rg/xI1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD
|
||||||
|
AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA
|
||||||
|
94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8gUXOQwKhbYdDFUDn9hf7B
|
||||||
|
43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
# CN=Baltimore CyberTrust Root,OU=CyberTrust,O=Baltimore,C=IE
|
# CN=Baltimore CyberTrust Root,OU=CyberTrust,O=Baltimore,C=IE
|
||||||
# 16af57a9f676b0ab126095aa5ebadef22ab31119d644ac95cd4b93dbf3f26aeb
|
# 16af57a9f676b0ab126095aa5ebadef22ab31119d644ac95cd4b93dbf3f26aeb
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
@@ -1224,99 +1324,6 @@ r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1
|
|||||||
/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm
|
/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm
|
||||||
gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+
|
gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
# CN=E-Tugra Certification Authority,OU=E-Tugra Sertifikasyon Merkezi,O=E-Tuğra EBG Bilişim Teknolojileri ve Hizmetleri A.Ş.,L=Ankara,C=TR
|
|
||||||
# b0bfd52bb0d7d9bd92bf5d4dc13da255c02c542f378365ea893911f55e55f23c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DujjByTd//SffGqWfZbawCEeI6
|
|
||||||
FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEVKV0jq9BgoRJP3vQXzTLl
|
|
||||||
yb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gTDx4JnW2P
|
|
||||||
AJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpD
|
|
||||||
y4Q08ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8d
|
|
||||||
NL/+I5c30jn6PQ0GC7TbO6Orb1wdtn7os4I07QZcJA==
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
# CN=E-Tugra Global Root CA ECC v3,OU=E-Tugra Trust Center,O=E-Tugra EBG A.S.,L=Ankara,C=TR
|
|
||||||
# 873f4685fa7f563625252e6d36bcd7f16fc24951f264e47e1b954f4908cdca13
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICpTCCAiqgAwIBAgIUJkYZdzHhT28oNt45UYbm1JeIIsEwCgYIKoZIzj0EAwMw
|
|
||||||
gYAxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUtVHVn
|
|
||||||
cmEgRUJHIEEuUy4xHTAbBgNVBAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYwJAYD
|
|
||||||
VQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290IENBIEVDQyB2MzAeFw0yMDAzMTgwOTQ2
|
|
||||||
NThaFw00NTAzMTIwOTQ2NThaMIGAMQswCQYDVQQGEwJUUjEPMA0GA1UEBxMGQW5r
|
|
||||||
YXJhMRkwFwYDVQQKExBFLVR1Z3JhIEVCRyBBLlMuMR0wGwYDVQQLExRFLVR1Z3Jh
|
|
||||||
IFRydXN0IENlbnRlcjEmMCQGA1UEAxMdRS1UdWdyYSBHbG9iYWwgUm9vdCBDQSBF
|
|
||||||
Q0MgdjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASOmCm/xxAeJ9urA8woLNheSBkQ
|
|
||||||
KczLWYHMjLiSF4mDKpL2w6QdTGLVn9agRtwcvHbB40fQWxPa56WzZkjnIZpKT4YK
|
|
||||||
fWzqTTKACrJ6CZtpS5iB4i7sAnCWH/31Rs7K3IKjYzBhMA8GA1UdEwEB/wQFMAMB
|
|
||||||
Af8wHwYDVR0jBBgwFoAU/4Ixcj75xGZsrTie0bBRiKWQzPUwHQYDVR0OBBYEFP+C
|
|
||||||
MXI++cRmbK04ntGwUYilkMz1MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNp
|
|
||||||
ADBmAjEA5gVYaWHlLcoNy/EZCL3W/VGSGn5jVASQkZo1kTmZ+gepZpO6yGjUij/6
|
|
||||||
7W4WAie3AjEA3VoXK3YdZUKWpqxdinlW2Iob35reX8dQj7FbcQwm32pAAOwzkSFx
|
|
||||||
vmjkI6TZraE3
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
# CN=E-Tugra Global Root CA RSA v3,OU=E-Tugra Trust Center,O=E-Tugra EBG A.S.,L=Ankara,C=TR
|
|
||||||
# ef66b0b10a3cdb9f2e3648c76bd2af18ead2bfe6f117655e28c4060da1a3f4c2
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIF8zCCA9ugAwIBAgIUDU3FzRYilZYIfrgLfxUGNPt5EDQwDQYJKoZIhvcNAQEL
|
|
||||||
BQAwgYAxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUt
|
|
||||||
VHVncmEgRUJHIEEuUy4xHTAbBgNVBAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYw
|
|
||||||
JAYDVQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290IENBIFJTQSB2MzAeFw0yMDAzMTgw
|
|
||||||
OTA3MTdaFw00NTAzMTIwOTA3MTdaMIG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||||||
AQH/MB8GA1UdIwQYMBaAFLK0ruYt9ybVqnUtdkvAG1Mh0EjvMB0GA1UdDgQWBBSy
|
|
||||||
tK7mLfcm1ap1LXZLwBtTIdBI7zAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEL
|
|
||||||
BQADggIBAImocn+M684uGMQQgC0QDP/7FM0E4BQ8Tpr7nym/Ip5XuYJzEmMmtcyQ
|
|
||||||
6dIqKe6cLcwsmb5FJ+Sxce3kOJUxQfJ9emN438o2Fi+CiJ+8EUdPdk3ILY7r3y18
|
|
||||||
Tjvarvbj2l0Upq7ohUSdBm6O++96SmotKygY/r+QLHUWnw/qln0F7psTpURs+APQ
|
|
||||||
3SPh/QMSEgj0GDSz4DcLdxEBSL9htLX4GdnLTeqjjO/98Aa1bZL0SmFQhO3sSdPk
|
|
||||||
vmjmLuMxC1QLGpLWgti2omU8ZgT5Vdps+9u1FGZNlIM7zR6mK7L+d0CGq+ffCsn9
|
|
||||||
9t2HVhjYsCxVYJb6CH5SkPVLpi6HfMsg2wY+oF0Dd32iPBMbKaITVaA9FCKvb7jQ
|
|
||||||
mhty3QUBjYZgv6Rn7rWlDdF/5horYmbDB7rnoEgcOMPpRfunf/ztAmgayncSd6YA
|
|
||||||
VSgU7NbHEqIbZULpkejLPoeJVF3Zr52XnGnnCv8PWniLYypMfUeUP95L6VPQMPHF
|
|
||||||
9p5J3zugkaOj/s1YzOrfr28oO6Bpm4/srK4rVJ2bBLFHIK+WEj5jlB0E5y67hscM
|
|
||||||
moi/dkfv97ALl2bSRM9gUgfh1SxKOidhd8rXj+eHDjD/DLsE4mHDosiXYY60MGo8
|
|
||||||
bcIHX0pzLz/5FooBZu+6kcpSV3uu1OYP3Qt6f4ueJiDPO++BcYNZ
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
# CN=Entrust Root Certification Authority - EC1,OU=See www.entrust.net/legal-terms+OU=(c) 2012 Entrust\, Inc. - for authorized use only,O=Entrust\, Inc.,C=US
|
# CN=Entrust Root Certification Authority - EC1,OU=See www.entrust.net/legal-terms+OU=(c) 2012 Entrust\, Inc. - for authorized use only,O=Entrust\, Inc.,C=US
|
||||||
# 02ed0eb28c14da45165c566791700d6451d7fb56f0b2ab1d3b8eb070e56edff5
|
# 02ed0eb28c14da45165c566791700d6451d7fb56f0b2ab1d3b8eb070e56edff5
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
@@ -1946,28 +1953,6 @@ kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+
|
|||||||
vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU
|
vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU
|
||||||
YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ==
|
YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
# CN=Hongkong Post Root CA 1,O=Hongkong Post,C=HK
|
|
||||||
# f9e67d336c51002ac054c632022d66dda2e7e3fff10ad061ed31d8bbb410cfb2
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsx
|
|
||||||
FjAUBgNVBAoTDUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3Qg
|
|
||||||
Um9vdCBDQSAxMB4XDTAzMDUxNTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkG
|
|
||||||
A1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdr
|
|
||||||
b25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
|
|
||||||
AQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1ApzQ
|
|
||||||
jVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEn
|
|
||||||
PzlTCeqrauh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjh
|
|
||||||
ZY4bXSNmO7ilMlHIhqqhqZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9
|
|
||||||
nnV0ttgCXjqQesBCNnLsak3c78QA3xMYV18meMjWCnl3v/evt3a5pQuEF10Q6m/h
|
|
||||||
q5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNVHRMBAf8ECDAGAQH/AgED
|
|
||||||
MA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7ih9legYsC
|
|
||||||
mEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI3
|
|
||||||
7piol7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clB
|
|
||||||
oiMBdDhViw+5LmeiIAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJs
|
|
||||||
EhTkYY2sEJCehFC78JZvRZ+K88psT/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpO
|
|
||||||
fMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilTc4afU9hDDl3WY4JxHYB0yvbi
|
|
||||||
AmvZWg==
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
# CN=Hongkong Post Root CA 3,O=Hongkong Post,L=Hong Kong,ST=Hong Kong,C=HK
|
# CN=Hongkong Post Root CA 3,O=Hongkong Post,L=Hong Kong,ST=Hong Kong,C=HK
|
||||||
# 5a2fc03f0c83b090bbfa40604b0988446c7636183df9846e17101a447fb8efd6
|
# 5a2fc03f0c83b090bbfa40604b0988446c7636183df9846e17101a447fb8efd6
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
@@ -2617,6 +2602,56 @@ nLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktuf
|
|||||||
oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY
|
oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY
|
||||||
Ic2wBlX7Jz9TkHCpBB5XJ7k=
|
Ic2wBlX7Jz9TkHCpBB5XJ7k=
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
|
# CN=SSL.com TLS ECC Root CA 2022,O=SSL Corporation,C=US
|
||||||
|
# c32ffd9f46f936d16c3673990959434b9ad60aafbb9e7cf33654f144cc1ba143
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw
|
||||||
|
CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT
|
||||||
|
U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2
|
||||||
|
MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh
|
||||||
|
dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG
|
||||||
|
ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm
|
||||||
|
acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN
|
||||||
|
SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME
|
||||||
|
GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW
|
||||||
|
uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp
|
||||||
|
15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN
|
||||||
|
b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
# CN=SSL.com TLS RSA Root CA 2022,O=SSL Corporation,C=US
|
||||||
|
# 8faf7d2e2cb4709bb8e0b33666bf75a5dd45b5de480f8ea8d4bfe6bebc17f2ed
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBO
|
||||||
|
MQswCQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQD
|
||||||
|
DBxTU0wuY29tIFRMUyBSU0EgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloX
|
||||||
|
DTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jw
|
||||||
|
b3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJvb3QgQ0EgMjAyMjCC
|
||||||
|
AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u9nTP
|
||||||
|
L3tYPc48DRAokC+X94xI2KDYJbF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iyrT7gJ4eLSYwfqUdYe5byiB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJ
|
||||||
|
DPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjUo3KUQyxi4U5cMj29TH0ZR6LDSeeW
|
||||||
|
P4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqoENjwuSfr98t67wVy
|
||||||
|
lrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7EgkaibMOlq
|
||||||
|
bLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2w
|
||||||
|
AgDHbICivRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3q
|
||||||
|
r5nsLFR+jM4uElZI7xc7P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sji
|
||||||
|
Mho6/4UIyYOf8kpIEFR3N+2ivEC+5BB09+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU
|
||||||
|
98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
# CN=SZAFIR ROOT CA2,O=Krajowa Izba Rozliczeniowa S.A.,C=PL
|
# CN=SZAFIR ROOT CA2,O=Krajowa Izba Rozliczeniowa S.A.,C=PL
|
||||||
# a1339d33281a0b56e557d3d32b1ce7f9367eb094bd5fa72a7e5004c8ded7cafe
|
# a1339d33281a0b56e557d3d32b1ce7f9367eb094bd5fa72a7e5004c8ded7cafe
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
@@ -2640,6 +2675,56 @@ oky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul4+vJhaAlIDf7js4MNIThPIGy
|
|||||||
d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg
|
d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg
|
||||||
LvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
|
LvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
|
# CN=Sectigo Public Server Authentication Root E46,O=Sectigo Limited,C=GB
|
||||||
|
# c90f26f0fb1b4018b22227519b5ca2b53e2ca5b3be5cf18efe1bef47380c5383
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQsw
|
||||||
|
CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T
|
||||||
|
ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcN
|
||||||
|
MjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYG
|
||||||
|
A1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT
|
||||||
|
ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA
|
||||||
|
IgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccC
|
||||||
|
WvkEN/U0NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+
|
||||||
|
6xnOQ6OjQjBAMB0GA1UdDgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8B
|
||||||
|
Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjAn7qRa
|
||||||
|
qCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RHlAFWovgzJQxC36oCMB3q
|
||||||
|
4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21USAGKcw==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
# CN=Sectigo Public Server Authentication Root R46,O=Sectigo Limited,C=GB
|
||||||
|
# 7bb647a62aeeac88bf257aa522d01ffea395e0ab45c73f93f65654ec38f25a06
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBf
|
||||||
|
MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQD
|
||||||
|
Ey1TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYw
|
||||||
|
HhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEY
|
||||||
|
MBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1Ymxp
|
||||||
|
YyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB
|
||||||
|
AQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDa
|
||||||
|
ef0rty2k1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnz
|
||||||
|
SDBh+oF8HqcIStw+KxwfGExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xf
|
||||||
|
iOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMPFF1bFOdLvt30yNoDN9HWOaEhUTCDsG3X
|
||||||
|
ME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vuZDCQOc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V+ioratF4yUQvNs+ZUH7G6aXD+u5
|
||||||
|
dHn5HrwdVw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65
|
||||||
|
LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp
|
||||||
|
0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmmJ1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAY
|
||||||
|
QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL
|
||||||
|
-----END CERTIFICATE-----
|
||||||
# CN=Secure Global CA,O=SecureTrust Corporation,C=US
|
# CN=Secure Global CA,O=SecureTrust Corporation,C=US
|
||||||
# 4200f5043ac8590ebb527d209ed1503029fbcbd41ca1b506ec27f15ade7dac69
|
# 4200f5043ac8590ebb527d209ed1503029fbcbd41ca1b506ec27f15ade7dac69
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.20
|
//go:build go1.20
|
||||||
// +build go1.20
|
|
||||||
|
|
||||||
// Package fallback embeds a set of fallback X.509 trusted roots in the
|
// Package fallback embeds a set of fallback X.509 trusted roots in the
|
||||||
// application by automatically invoking [x509.SetFallbackRoots]. This allows
|
// application by automatically invoking [x509.SetFallbackRoots]. This allows
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// Copyright 2023 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package goissue52287 is an empty internal package.
|
||||||
|
// It exists only to work around go.dev/issue/52287 and
|
||||||
|
// can be removed after Go 1.19 stops being supported.
|
||||||
|
package goissue52287
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gen
|
//go:build generate
|
||||||
// +build gen
|
// +build generate
|
||||||
|
|
||||||
//go:generate go run gen_fallback_bundle.go
|
//go:generate go run gen_fallback_bundle.go
|
||||||
|
|
||||||
@@ -21,13 +21,13 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
|
||||||
|
|
||||||
"golang.org/x/crypto/x509roots/nss"
|
"golang.org/x/crypto/x509roots/nss"
|
||||||
)
|
)
|
||||||
|
|
||||||
const tmpl = `// Code generated by gen.go at %s; DO NOT EDIT.
|
const tmpl = `// Code generated by gen_fallback_bundle.go; DO NOT EDIT.
|
||||||
// list hash: %x
|
|
||||||
|
//go:build go1.20
|
||||||
|
|
||||||
package fallback
|
package fallback
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ func mustParse(b []byte) []*x509.Certificate {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if block.Type != "CERTIFICATE" {
|
if block.Type != "CERTIFICATE" {
|
||||||
panic("unexpected PEM block type: "+block.Type)
|
panic("unexpected PEM block type: " + block.Type)
|
||||||
}
|
}
|
||||||
cert, err := x509.ParseCertificate(block.Bytes)
|
cert, err := x509.ParseCertificate(block.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -64,18 +64,14 @@ var bundle = mustParse([]byte(pemRoots))
|
|||||||
`
|
`
|
||||||
|
|
||||||
var (
|
var (
|
||||||
certDataURL = flag.String("certdata-url", "https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt", "URL to the raw certdata.txt file to parse (only one of certdata-url and certdata-path may be specified)")
|
certDataURL = flag.String("certdata-url", "https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt", "URL to the raw certdata.txt file to parse (certdata-path overrides this, if provided)")
|
||||||
certDataPath = flag.String("certdata-path", "", "Path to the NSS certdata.txt file to parse (only one of certdata-url and certdata-path may be specified)")
|
certDataPath = flag.String("certdata-path", "", "Path to the NSS certdata.txt file to parse (this overrides certdata-url, if provided)")
|
||||||
output = flag.String("output", "fallback/bundle.go", "Path to file to write output to")
|
output = flag.String("output", "fallback/bundle.go", "Path to file to write output to")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *certDataPath != "" && *certDataURL != "" {
|
|
||||||
log.Fatal("Only one of --certdata-url and --certdata-path may be supplied")
|
|
||||||
}
|
|
||||||
|
|
||||||
var certdata io.Reader
|
var certdata io.Reader
|
||||||
|
|
||||||
if *certDataPath != "" {
|
if *certDataPath != "" {
|
||||||
@@ -100,18 +96,21 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(certs, func(i, j int) bool {
|
sort.Slice(certs, func(i, j int) bool {
|
||||||
return certs[i].X509.Subject.String() < certs[j].X509.Subject.String()
|
// Sort based on the stringified subject (which may not be unique), and
|
||||||
|
// break any ties by just sorting on the raw DER (which will be unique,
|
||||||
|
// but is expensive). This should produce a stable sorting, which should
|
||||||
|
// be mostly readable by a human looking for a specific root or set of
|
||||||
|
// roots.
|
||||||
|
subjI, subjJ := certs[i].X509.Subject.String(), certs[j].X509.Subject.String()
|
||||||
|
if subjI == subjJ {
|
||||||
|
return string(certs[i].X509.Raw) < string(certs[j].X509.Raw)
|
||||||
|
}
|
||||||
|
return subjI < subjJ
|
||||||
})
|
})
|
||||||
|
|
||||||
h := sha256.New()
|
b := new(bytes.Buffer)
|
||||||
for _, c := range certs {
|
b.WriteString(tmpl)
|
||||||
h.Write(c.X509.Raw)
|
fmt.Fprintln(b, "const pemRoots = `")
|
||||||
}
|
|
||||||
listHash := h.Sum(nil)
|
|
||||||
|
|
||||||
b := bytes.NewBuffer(nil)
|
|
||||||
b.Write([]byte(fmt.Sprintf(tmpl, time.Now().Format(time.RFC1123), listHash)))
|
|
||||||
b.Write([]byte("const pemRoots = `\n"))
|
|
||||||
for _, c := range certs {
|
for _, c := range certs {
|
||||||
if len(c.Constraints) > 0 {
|
if len(c.Constraints) > 0 {
|
||||||
// Until the constrained roots API lands, skip anything that has any
|
// Until the constrained roots API lands, skip anything that has any
|
||||||
@@ -120,10 +119,10 @@ func main() {
|
|||||||
// new version.
|
// new version.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
b.Write([]byte(fmt.Sprintf("# %s\n# %x\n", c.X509.Subject.String(), sha256.Sum256(c.X509.Raw))))
|
fmt.Fprintf(b, "# %s\n# %x\n", c.X509.Subject.String(), sha256.Sum256(c.X509.Raw))
|
||||||
pem.Encode(b, &pem.Block{Type: "CERTIFICATE", Bytes: c.X509.Raw})
|
pem.Encode(b, &pem.Block{Type: "CERTIFICATE", Bytes: c.X509.Raw})
|
||||||
}
|
}
|
||||||
b.Write([]byte("`\n"))
|
fmt.Fprintln(b, "`")
|
||||||
|
|
||||||
formatted, err := format.Source(b.Bytes())
|
formatted, err := format.Source(b.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user