From 670cddafbcd8345f3c048723bf3b663ed14cb725 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Wed, 4 May 2016 11:49:07 -0700 Subject: [PATCH] Rename project to certspotter --- asn1.go | 2 +- asn1time.go | 2 +- asn1time_test.go | 2 +- auditing.go | 4 ++-- cmd/certspotter/.gitignore | 1 + cmd/{ctwatch => certspotter}/main.go | 20 ++++++++-------- cmd/common.go | 36 ++++++++++++++-------------- cmd/ctparsewatch/main.go | 16 ++++++------- cmd/ctwatch/.gitignore | 1 - ct/client/logclient.go | 2 +- helpers.go | 4 ++-- identifiers.go | 2 +- logs.go | 2 +- precerts.go | 2 +- scanner.go | 6 ++--- x509.go | 2 +- 16 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 cmd/certspotter/.gitignore rename cmd/{ctwatch => certspotter}/main.go (88%) delete mode 100644 cmd/ctwatch/.gitignore diff --git a/asn1.go b/asn1.go index be2141b..24c6081 100644 --- a/asn1.go +++ b/asn1.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "errors" diff --git a/asn1time.go b/asn1time.go index 7b66d4f..8466953 100644 --- a/asn1time.go +++ b/asn1time.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "time" diff --git a/asn1time_test.go b/asn1time_test.go index 58ad9f0..ea5848a 100644 --- a/asn1time_test.go +++ b/asn1time_test.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "testing" diff --git a/auditing.go b/auditing.go index 01bbe3e..ab9f9ed 100644 --- a/auditing.go +++ b/auditing.go @@ -1,7 +1,7 @@ -package ctwatch +package certspotter import ( - "src.agwa.name/ctwatch/ct" + "src.agwa.name/certspotter/ct" "bytes" "crypto/sha256" ) diff --git a/cmd/certspotter/.gitignore b/cmd/certspotter/.gitignore new file mode 100644 index 0000000..e4e7c7a --- /dev/null +++ b/cmd/certspotter/.gitignore @@ -0,0 +1 @@ +/certspotter diff --git a/cmd/ctwatch/main.go b/cmd/certspotter/main.go similarity index 88% rename from cmd/ctwatch/main.go rename to cmd/certspotter/main.go index 25c4145..5e0d666 100644 --- a/cmd/ctwatch/main.go +++ b/cmd/certspotter/main.go @@ -9,16 +9,16 @@ import ( "golang.org/x/net/idna" - "src.agwa.name/ctwatch" - "src.agwa.name/ctwatch/ct" - "src.agwa.name/ctwatch/cmd" + "src.agwa.name/certspotter" + "src.agwa.name/certspotter/ct" + "src.agwa.name/certspotter/cmd" ) func DefaultStateDir () string { if envVar := os.Getenv("CTWATCH_STATE_DIR"); envVar != "" { return envVar } else { - return cmd.DefaultStateDir("ctwatch") + return cmd.DefaultStateDir("certspotter") } } @@ -66,7 +66,7 @@ func setWatchDomains (domains []string) error { } addWatchDomain("*" + parentDomain) addWatchDomain("?" + parentDomain) - addWatchDomain(ctwatch.UnparsableDNSLabelPlaceholder + parentDomain) + addWatchDomain(certspotter.UnparsableDNSLabelPlaceholder + parentDomain) } } return nil @@ -95,15 +95,15 @@ func anyDnsNameMatches (dnsNames []string) bool { return false } -func processEntry (scanner *ctwatch.Scanner, entry *ct.LogEntry) { - info := ctwatch.EntryInfo{ +func processEntry (scanner *certspotter.Scanner, entry *ct.LogEntry) { + info := certspotter.EntryInfo{ LogUri: scanner.LogUri, Entry: entry, - IsPrecert: ctwatch.IsPrecert(entry), - FullChain: ctwatch.GetFullChain(entry), + IsPrecert: certspotter.IsPrecert(entry), + FullChain: certspotter.GetFullChain(entry), } - info.CertInfo, info.ParseError = ctwatch.MakeCertInfoFromLogEntry(entry) + info.CertInfo, info.ParseError = certspotter.MakeCertInfoFromLogEntry(entry) if info.CertInfo != nil { info.Identifiers, info.IdentifiersParseError = info.CertInfo.ParseIdentifiers() diff --git a/cmd/common.go b/cmd/common.go index 969ea50..d7ac5e0 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -14,8 +14,8 @@ import ( "time" "strconv" - "src.agwa.name/ctwatch" - "src.agwa.name/ctwatch/ct" + "src.agwa.name/certspotter" + "src.agwa.name/certspotter/ct" ) var batchSize = flag.Int("batch_size", 1000, "Max number of entries to request at per call to get-entries") @@ -55,11 +55,11 @@ func DefaultStateDir (programName string) string { } } -func LogEntry (info *ctwatch.EntryInfo) { +func LogEntry (info *certspotter.EntryInfo) { if !*noSave { var alreadyPresent bool var err error - alreadyPresent, info.Filename, err = ctwatch.WriteCertRepository(filepath.Join(stateDir, "certs"), info.IsPrecert, info.FullChain) + alreadyPresent, info.Filename, err = certspotter.WriteCertRepository(filepath.Join(stateDir, "certs"), info.IsPrecert, info.FullChain) if err != nil { log.Print(err) } @@ -88,27 +88,27 @@ func saveEvidence (logUri string, firstSTH *ct.SignedTreeHead, secondSTH *ct.Sig now := strconv.FormatInt(time.Now().Unix(), 10) firstFilename := filepath.Join(stateDir, "evidence", defangLogUri(logUri) + ".inconsistent." + now + ".first") - if err := ctwatch.WriteSTHFile(firstFilename, firstSTH); err != nil { + if err := certspotter.WriteSTHFile(firstFilename, firstSTH); err != nil { return "", "", "", err } secondFilename := filepath.Join(stateDir, "evidence", defangLogUri(logUri) + ".inconsistent." + now + ".second") - if err := ctwatch.WriteSTHFile(secondFilename, secondSTH); err != nil { + if err := certspotter.WriteSTHFile(secondFilename, secondSTH); err != nil { return "", "", "", err } proofFilename := filepath.Join(stateDir, "evidence", defangLogUri(logUri) + ".inconsistent." + now + ".proof") - if err := ctwatch.WriteProofFile(proofFilename, proof); err != nil { + if err := certspotter.WriteProofFile(proofFilename, proof); err != nil { return "", "", "", err } return firstFilename, secondFilename, proofFilename, nil } -func Main (argStateDir string, processCallback ctwatch.ProcessCallback) { +func Main (argStateDir string, processCallback certspotter.ProcessCallback) { stateDir = argStateDir - var logs []ctwatch.LogInfo + var logs []certspotter.LogInfo if *logsFilename != "" { logFile, err := os.Open(*logsFilename) if err != nil { @@ -116,16 +116,16 @@ func Main (argStateDir string, processCallback ctwatch.ProcessCallback) { os.Exit(1) } defer logFile.Close() - var logFileObj ctwatch.LogInfoFile + var logFileObj certspotter.LogInfoFile if err := json.NewDecoder(logFile).Decode(&logFileObj); err != nil { fmt.Fprintf(os.Stderr, "%s: Error decoding logs file: %s: %s\n", os.Args[0], *logsFilename, err) os.Exit(1) } logs = logFileObj.Logs } else if *underwater { - logs = ctwatch.UnderwaterLogs + logs = certspotter.UnderwaterLogs } else { - logs = ctwatch.DefaultLogs + logs = certspotter.DefaultLogs } if err := os.Mkdir(stateDir, 0777); err != nil && !os.IsExist(err) { @@ -159,20 +159,20 @@ func Main (argStateDir string, processCallback ctwatch.ProcessCallback) { continue } stateFilename := filepath.Join(stateDir, "sths", defangLogUri(logUri)) - prevSTH, err := ctwatch.ReadSTHFile(stateFilename) + prevSTH, err := certspotter.ReadSTHFile(stateFilename) if err != nil { log.Printf("Error reading state file: %s: %s\n", stateFilename, err) exitCode |= 1 continue } - opts := ctwatch.ScannerOptions{ + opts := certspotter.ScannerOptions{ BatchSize: *batchSize, NumWorkers: *numWorkers, ParallelFetch: *parallelFetch, Quiet: !*verbose, } - scanner := ctwatch.NewScanner(logUri, logKey, &opts) + scanner := certspotter.NewScanner(logUri, logKey, &opts) latestSTH, err := scanner.GetSTH() if err != nil { @@ -201,7 +201,7 @@ func Main (argStateDir string, processCallback ctwatch.ProcessCallback) { } if latestSTH.TreeSize > startIndex { - var treeBuilder *ctwatch.MerkleTreeBuilder + var treeBuilder *certspotter.MerkleTreeBuilder if prevSTH != nil { var valid bool var err error @@ -223,7 +223,7 @@ func Main (argStateDir string, processCallback ctwatch.ProcessCallback) { continue } } else { - treeBuilder = &ctwatch.MerkleTreeBuilder{} + treeBuilder = &certspotter.MerkleTreeBuilder{} } if err := scanner.Scan(int64(startIndex), int64(latestSTH.TreeSize), processCallback, treeBuilder); err != nil { @@ -244,7 +244,7 @@ func Main (argStateDir string, processCallback ctwatch.ProcessCallback) { log.Printf("final log size = %d, final root hash = %x", latestSTH.TreeSize, latestSTH.SHA256RootHash) } - if err := ctwatch.WriteSTHFile(stateFilename, latestSTH); err != nil { + if err := certspotter.WriteSTHFile(stateFilename, latestSTH); err != nil { log.Printf("Error writing state file: %s: %s\n", stateFilename, err) exitCode |= 1 continue diff --git a/cmd/ctparsewatch/main.go b/cmd/ctparsewatch/main.go index 82edfa8..dd81d56 100644 --- a/cmd/ctparsewatch/main.go +++ b/cmd/ctparsewatch/main.go @@ -4,9 +4,9 @@ import ( "flag" "os" - "src.agwa.name/ctwatch" - "src.agwa.name/ctwatch/ct" - "src.agwa.name/ctwatch/cmd" + "src.agwa.name/certspotter" + "src.agwa.name/certspotter/ct" + "src.agwa.name/certspotter/cmd" ) func DefaultStateDir () string { @@ -19,15 +19,15 @@ func DefaultStateDir () string { var stateDir = flag.String("state_dir", DefaultStateDir(), "Directory for storing state") -func processEntry (scanner *ctwatch.Scanner, entry *ct.LogEntry) { - info := ctwatch.EntryInfo{ +func processEntry (scanner *certspotter.Scanner, entry *ct.LogEntry) { + info := certspotter.EntryInfo{ LogUri: scanner.LogUri, Entry: entry, - IsPrecert: ctwatch.IsPrecert(entry), - FullChain: ctwatch.GetFullChain(entry), + IsPrecert: certspotter.IsPrecert(entry), + FullChain: certspotter.GetFullChain(entry), } - info.CertInfo, info.ParseError = ctwatch.MakeCertInfoFromLogEntry(entry) + info.CertInfo, info.ParseError = certspotter.MakeCertInfoFromLogEntry(entry) if info.CertInfo != nil { info.Identifiers, info.IdentifiersParseError = info.CertInfo.ParseIdentifiers() } diff --git a/cmd/ctwatch/.gitignore b/cmd/ctwatch/.gitignore deleted file mode 100644 index 16736ed..0000000 --- a/cmd/ctwatch/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/ctwatch diff --git a/ct/client/logclient.go b/ct/client/logclient.go index dc36450..24c2dd7 100644 --- a/ct/client/logclient.go +++ b/ct/client/logclient.go @@ -13,7 +13,7 @@ import ( "net/http" "time" - "src.agwa.name/ctwatch/ct" + "src.agwa.name/certspotter/ct" "github.com/mreiferson/go-httpclient" ) diff --git a/helpers.go b/helpers.go index 6ef08b8..584508d 100644 --- a/helpers.go +++ b/helpers.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "fmt" @@ -17,7 +17,7 @@ import ( "encoding/pem" "encoding/json" - "src.agwa.name/ctwatch/ct" + "src.agwa.name/certspotter/ct" ) func ReadSTHFile (path string) (*ct.SignedTreeHead, error) { diff --git a/identifiers.go b/identifiers.go index 61f58d0..0bd8040 100644 --- a/identifiers.go +++ b/identifiers.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "bytes" diff --git a/logs.go b/logs.go index ff0e355..0c5c269 100644 --- a/logs.go +++ b/logs.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "encoding/base64" diff --git a/precerts.go b/precerts.go index d58df56..929ec0c 100644 --- a/precerts.go +++ b/precerts.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "fmt" diff --git a/scanner.go b/scanner.go index a34ef96..074c1cd 100644 --- a/scanner.go +++ b/scanner.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( // "container/list" @@ -10,8 +10,8 @@ import ( "crypto" "errors" - "src.agwa.name/ctwatch/ct" - "src.agwa.name/ctwatch/ct/client" + "src.agwa.name/certspotter/ct" + "src.agwa.name/certspotter/ct/client" ) type ProcessCallback func(*Scanner, *ct.LogEntry) diff --git a/x509.go b/x509.go index ec1c0a0..1d4cd81 100644 --- a/x509.go +++ b/x509.go @@ -1,4 +1,4 @@ -package ctwatch +package certspotter import ( "fmt"