mirror of
https://github.com/SSLMate/certspotter.git
synced 2025-06-27 10:15:33 +02:00
Add ctparsewatch
It watches for certificates which we can't fully parse
This commit is contained in:
parent
786e9e3460
commit
81bfa0bbd8
1
cmd/ctparsewatch/.gitignore
vendored
Normal file
1
cmd/ctparsewatch/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/ctparsewatch
|
40
cmd/ctparsewatch/main.go
Normal file
40
cmd/ctparsewatch/main.go
Normal file
@ -0,0 +1,40 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
"src.agwa.name/ctwatch"
|
||||
"src.agwa.name/ctwatch/ct"
|
||||
"src.agwa.name/ctwatch/cmd"
|
||||
)
|
||||
|
||||
func DefaultStateDir () string {
|
||||
if envVar := os.Getenv("CTPARSEWATCH_STATE_DIR"); envVar != "" {
|
||||
return envVar
|
||||
} else {
|
||||
return cmd.DefaultStateDir("ctparsewatch")
|
||||
}
|
||||
}
|
||||
|
||||
var stateDir = flag.String("state_dir", DefaultStateDir(), "Directory for storing state")
|
||||
|
||||
func processEntry (scanner *ctwatch.Scanner, entry *ct.LogEntry) {
|
||||
info := ctwatch.EntryInfo{
|
||||
LogUri: scanner.LogUri,
|
||||
Entry: entry,
|
||||
IsPrecert: ctwatch.IsPrecert(entry),
|
||||
FullChain: ctwatch.GetFullChain(entry),
|
||||
}
|
||||
|
||||
info.CertInfo, info.ParseError = ctwatch.MakeCertInfoFromLogEntry(entry)
|
||||
|
||||
if info.HasParseErrors() {
|
||||
cmd.LogEntry(&info)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
cmd.Main(*stateDir, processEntry)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user