File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 40
40
signCA bool
41
41
sign bool
42
42
file string
43
+
44
+ hostportRe = regexp .MustCompile (`([[:alnum:]\-\.]+):([[:digit:]]+)` )
43
45
)
44
46
45
47
func init () {
@@ -209,8 +211,7 @@ func run() error {
209
211
return nil
210
212
}
211
213
212
- re := regexp .MustCompile (`([[:alnum:]\.]+):([[:digit:]]+)` )
213
- matches := re .FindAllStringSubmatch (verify , - 1 )
214
+ matches := hostportRe .FindAllStringSubmatch (verify , - 1 )
214
215
if len (matches ) == 0 {
215
216
return fmt .Errorf ("Issue parsing remote dns to check" )
216
217
}
@@ -222,7 +223,6 @@ func run() error {
222
223
return err
223
224
}
224
225
225
- fmt .Println (host )
226
226
err = certs .Verify (chain [0 ], chain [1 :], host )
227
227
if err != nil {
228
228
err = fmt .Errorf ("Certificate chain invalid %w" , err )
@@ -272,8 +272,7 @@ func run() error {
272
272
return nil
273
273
}
274
274
275
- re := regexp .MustCompile (`([[:alnum:]\.]+):([[:digit:]]+)` )
276
- matches := re .FindAllStringSubmatch (output , - 1 )
275
+ matches := hostportRe .FindAllStringSubmatch (output , - 1 )
277
276
if len (matches ) == 0 {
278
277
return fmt .Errorf ("Issue parsing remote dns to check" )
279
278
}
Original file line number Diff line number Diff line change 5
5
"crypto/x509"
6
6
)
7
7
8
- func GetPeerServerCertificateChain (dns string ) (pscc []* x509.Certificate , err error ) {
8
+ func GetPeerServerCertificateChain (uri string ) (pscc []* x509.Certificate , err error ) {
9
9
// Skip verification because we just want to get the certs to print
10
- conn , err := tls .Dial ("tcp" , dns , & tls.Config {InsecureSkipVerify : true }) // #nosec
10
+ conn , err := tls .Dial ("tcp" , uri , & tls.Config {InsecureSkipVerify : true }) // #nosec
11
11
if err != nil {
12
12
return
13
13
}
You can’t perform that action at this time.
0 commit comments