Add ctparsewatch

It watches for certificates which we can't fully parse
This commit is contained in:
Andrew Ayer 2016-03-23 20:19:39 -07:00
parent 786e9e3460
commit 81bfa0bbd8
2 changed files with 41 additions and 0 deletions

1
cmd/ctparsewatch/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/ctparsewatch

40
cmd/ctparsewatch/main.go Normal file
View 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)
}