File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 2020 with :
2121 fetch-depth : 0
2222
23+ - name : Running govulncheck
24+ uses : Templum/govulncheck-action@v0.10.1
25+ with :
26+ github-token : ${{ secrets.GH_PAT }}
27+
2328 - name : Set up Go ⚙️
2429 uses : actions/setup-go@v4
2530 with :
Original file line number Diff line number Diff line change 11// Usage:
22//
3- // certcheck https://www.example.com
3+ // go run certcheck.go https://www.example.com
44//
55// Output:
66//
@@ -46,6 +46,14 @@ func main() {
4646 defer resp .Body .Close ()
4747
4848 certs := resp .TLS .PeerCertificates
49+ var validChain bool = true
50+ for i := 0 ; i < len (certs )- 1 ; i ++ {
51+ if certs [i ].Issuer .CommonName != certs [i + 1 ].Subject .CommonName {
52+ validChain = false
53+ break
54+ }
55+ }
56+
4957 for _ , cert := range certs {
5058 fmt .Printf ("Subject: %s\n " , cert .Subject .CommonName )
5159 fmt .Printf ("Issuer: %s\n " , cert .Issuer .CommonName )
@@ -57,4 +65,10 @@ func main() {
5765 fmt .Printf ("Signature algorithm: %s\n " , cert .SignatureAlgorithm .String ())
5866 fmt .Println ("-----" )
5967 }
68+
69+ if validChain {
70+ fmt .Println ("Certificate chain is valid and in the correct order." )
71+ } else {
72+ fmt .Println ("Certificate chain is invalid or not in the correct order." )
73+ }
6074}
You can’t perform that action at this time.
0 commit comments