diff options
author | Dominic Evans <[email protected]> | 2021-08-23 23:58:55 +0100 |
---|---|---|
committer | Dave Anderson <[email protected]> | 2021-08-24 10:14:24 -0700 |
commit | 2825d768aaaef27e854631354415484406b1bc92 (patch) | |
tree | b320c95260816ee5c4fbb49e9a7c03b7aa9ebf16 | |
parent | b6bb9b5b82524122bcf27291ede32d1517a14ab8 (diff) |
fix(test): update travis and e2e selfSignedCert fn
- add go.mod/go.sum
- update .travis.yml to test against supported Go versions
- drop golint from CI checks
To satisfy modern Go crypto in the tlsrouter e2e_test.go:
- bump RSA keysize to minimum 2048 bits
- set NotBefore to valid recent timestamp
- include CommonName in SANs
Signed-off-by: Dominic Evans <[email protected]>
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .travis.yml | 11 | ||||
-rw-r--r-- | cmd/tlsrouter/e2e_test.go | 8 | ||||
-rw-r--r-- | go.mod | 5 | ||||
-rw-r--r-- | go.sum | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ab78466..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tlsrouter -tlsrouter.test diff --git a/.travis.yml b/.travis.yml index 56aafcb..a8d3a50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,19 @@ language: go go: -- "1.12" -- "1.13" +- "1.16.x" +- "1.17.x" - tip os: - linux -install: -- go get github.com/golang/lint/golint -before_script: script: -- go get -t ./... - go build ./... - go test ./... - go vet ./... -- golint -set_exit_status . jobs: include: - stage: deploy - go: "1.13" + go: "1.16" install: - gem install fpm script: diff --git a/cmd/tlsrouter/e2e_test.go b/cmd/tlsrouter/e2e_test.go index c53e8c5..92551e2 100644 --- a/cmd/tlsrouter/e2e_test.go +++ b/cmd/tlsrouter/e2e_test.go @@ -182,7 +182,7 @@ func serveTLS(t *testing.T, value string, understandProxy bool, domains ...strin } func selfSignedCert(domains []string) (tls.Certificate, *x509.CertPool, error) { - pkey, err := rsa.GenerateKey(rand.Reader, 512) + pkey, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { return tls.Certificate{}, nil, err } @@ -192,16 +192,16 @@ func selfSignedCert(domains []string) (tls.Certificate, *x509.CertPool, error) { Organization: []string{"Test Co"}, CommonName: domains[0], }, - NotBefore: time.Time{}, + NotBefore: time.Now().Add(-5 * time.Minute), NotAfter: time.Now().Add(60 * time.Minute), IsCA: true, KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, BasicConstraintsValid: true, - DNSNames: domains[1:], + DNSNames: domains[:], } - derBytes, err := x509.CreateCertificate(rand.Reader, template, template, &pkey.PublicKey, pkey) + derBytes, err := x509.CreateCertificate(rand.Reader, template, template, pkey.Public(), pkey) if err != nil { return tls.Certificate{}, nil, err } @@ -0,0 +1,5 @@ +module inet.af/tcpproxy + +go 1.16 + +require github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a @@ -0,0 +1,2 @@ +github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a h1:AP/vsCIvJZ129pdm9Ek7bH7yutN3hByqsMoNrWAxRQc= +github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a/go.mod h1:QmP9hvJ91BbJmGVGSbutW19IC0Q9phDCLGaomwTJbgU= |