forked from cloudradar/frontman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssl_test.go
95 lines (75 loc) · 1.92 KB
/
ssl_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// +build !quick_tests
package frontman
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestFrontman_runSSLCheck(t *testing.T) {
badSSL := []string{
"expired.badssl.com",
"wrong.host.badssl.com",
"self-signed.badssl.com",
"untrusted-root.badssl.com",
"sha1-intermediate.badssl.com",
// cipher suite
"rc4-md5.badssl.com",
"rc4.badssl.com",
"null.badssl.com",
// key exchange
"dh480.badssl.com",
"dh512.badssl.com",
"dh1024.badssl.com",
"dh2048.badssl.com",
"dh-small-subgroup.badssl.com",
"dh-composite.badssl.com",
// certificate transparency
"invalid-expected-sct.badssl.com",
// upgrade
"subdomain.preloaded-hsts.badssl.com",
// known bad
"Superfish.badssl.com",
"eDellRoot.badssl.com",
"DSDTestProvider.badssl.com",
"preact-cli.badssl.com",
"webpack-dev-server.badssl.com",
// chrome tests
"captive-portal.badssl.com",
"mitm-software.badssl.com",
// defunct
"sha1-2017.badssl.com",
}
goodSSL := []string{
"badssl.com",
"sha256.badssl.com",
"sha384.badssl.com",
"sha512.badssl.com",
"1000-sans.badssl.com",
"ecc256.badssl.com",
"ecc384.badssl.com",
"rsa2048.badssl.com",
"rsa4096.badssl.com",
"extended-validation.badssl.com",
"client.badssl.com",
"mozilla-modern.badssl.com",
"hsts.badssl.com",
"upgrade.badssl.com",
"preloaded-hsts.badssl.com",
"https-everywhere.badssl.com",
"long-extended-subdomain-name-containing-many-letters-and-dashes.badssl.com",
"longextendedsubdomainnamewithoutdashesinordertotestwordwrapping.badssl.com",
}
if testing.Short() {
badSSL = badSSL[:2]
goodSSL = goodSSL[:2]
}
cfg := NewConfig()
fm := helperCreateFrontman(t, cfg)
for _, badSSLHost := range badSSL {
_, err := fm.runSSLCheck(badSSLHost, 443, "https")
assert.Error(t, err, badSSLHost)
}
for _, goodSSLHost := range goodSSL {
_, err := fm.runSSLCheck(goodSSLHost, 443, "https")
assert.NoError(t, err, goodSSLHost)
}
}