Skip to content

Commit caf25c3

Browse files
committed
What in the name of git is going on here?
1 parent fc6f602 commit caf25c3

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.github/workflows/release.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ jobs:
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:

certcheck.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
}

0 commit comments

Comments
 (0)