Skip to content

Commit 2825d76

Browse files
dnwedanderson
authored andcommitted
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]>
1 parent b6bb9b5 commit 2825d76

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.travis.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
language: go
22
go:
3-
- "1.12"
4-
- "1.13"
3+
- "1.16.x"
4+
- "1.17.x"
55
- tip
66
os:
77
- linux
8-
install:
9-
- go get github.com/golang/lint/golint
10-
before_script:
118
script:
12-
- go get -t ./...
139
- go build ./...
1410
- go test ./...
1511
- go vet ./...
16-
- golint -set_exit_status .
1712

1813
jobs:
1914
include:
2015
- stage: deploy
21-
go: "1.13"
16+
go: "1.16"
2217
install:
2318
- gem install fpm
2419
script:

cmd/tlsrouter/e2e_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func serveTLS(t *testing.T, value string, understandProxy bool, domains ...strin
182182
}
183183

184184
func selfSignedCert(domains []string) (tls.Certificate, *x509.CertPool, error) {
185-
pkey, err := rsa.GenerateKey(rand.Reader, 512)
185+
pkey, err := rsa.GenerateKey(rand.Reader, 2048)
186186
if err != nil {
187187
return tls.Certificate{}, nil, err
188188
}
@@ -192,16 +192,16 @@ func selfSignedCert(domains []string) (tls.Certificate, *x509.CertPool, error) {
192192
Organization: []string{"Test Co"},
193193
CommonName: domains[0],
194194
},
195-
NotBefore: time.Time{},
195+
NotBefore: time.Now().Add(-5 * time.Minute),
196196
NotAfter: time.Now().Add(60 * time.Minute),
197197
IsCA: true,
198198
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
199199
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
200200
BasicConstraintsValid: true,
201-
DNSNames: domains[1:],
201+
DNSNames: domains[:],
202202
}
203203

204-
derBytes, err := x509.CreateCertificate(rand.Reader, template, template, &pkey.PublicKey, pkey)
204+
derBytes, err := x509.CreateCertificate(rand.Reader, template, template, pkey.Public(), pkey)
205205
if err != nil {
206206
return tls.Certificate{}, nil, err
207207
}

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module inet.af/tcpproxy
2+
3+
go 1.16
4+
5+
require github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a h1:AP/vsCIvJZ129pdm9Ek7bH7yutN3hByqsMoNrWAxRQc=
2+
github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a/go.mod h1:QmP9hvJ91BbJmGVGSbutW19IC0Q9phDCLGaomwTJbgU=

0 commit comments

Comments
 (0)