Rename project to certspotter

This commit is contained in:
Andrew Ayer 2016-05-04 11:49:07 -07:00
parent ea3db97486
commit 670cddafbc
16 changed files with 52 additions and 52 deletions

View File

@ -1,4 +1,4 @@
package ctwatch
package certspotter
import (
"errors"

View File

@ -1,4 +1,4 @@
package ctwatch
package certspotter
import (
"time"

View File

@ -1,4 +1,4 @@
package ctwatch
package certspotter
import (
"testing"

View File

@ -1,7 +1,7 @@
package ctwatch
package certspotter
import (
"src.agwa.name/ctwatch/ct"
"src.agwa.name/certspotter/ct"
"bytes"
"crypto/sha256"
)

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

@ -0,0 +1 @@
/certspotter

View File

@ -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()

View File

@ -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

View File

@ -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()
}

View File

@ -1 +0,0 @@
/ctwatch

View File

@ -13,7 +13,7 @@ import (
"net/http"
"time"
"src.agwa.name/ctwatch/ct"
"src.agwa.name/certspotter/ct"
"github.com/mreiferson/go-httpclient"
)

View File

@ -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) {

View File

@ -1,4 +1,4 @@
package ctwatch
package certspotter
import (
"bytes"

View File

@ -1,4 +1,4 @@
package ctwatch
package certspotter
import (
"encoding/base64"

View File

@ -1,4 +1,4 @@
package ctwatch
package certspotter
import (
"fmt"

View File

@ -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)

View File

@ -1,4 +1,4 @@
package ctwatch
package certspotter
import (
"fmt"