Skip to content

Commit

Permalink
Merge 75ddc61 into 1af5959
Browse files Browse the repository at this point in the history
  • Loading branch information
cpu committed Nov 26, 2019
2 parents 1af5959 + 75ddc61 commit 77bf4a4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 31 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ type, the labels used to slice the metric, and a description.
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYggOxPnPkzKBIhTacSYoIfnSL2jPugcbUKx83vFMvk5gKAz/AGe87w20riuPwEGn229hKVbEKHFB61NIqNHC3Q==",
"windowStart": "2000-01-01T00:00:00Z",
"windowEnd": "2001-01-01T00:00:00Z",
"start": 10,
"minEntry": 10,
"submitPreCert": false,
"submitCert": true
},
Expand All @@ -241,7 +241,7 @@ type, the labels used to slice the metric, and a description.
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKtnFevaXV/kB8dmhCNZHmxKVLcHX1plaAsY9LrKilhYxdmQZiu36LvAvosTsqMVqRK9a96nC8VaxAdaHUbM8EA==",
"windowStart": "2019-01-01T00:00:00Z",
"windowEnd": "2099-01-01T00:00:00Z",
"start": 1,
"minEntry": 1,
"submitPreCert": false,
"submitCert": true
}
Expand Down Expand Up @@ -307,7 +307,7 @@ type, the labels used to slice the metric, and a description.
* **key** - the log's public key (PEM encoded as a single line without the PEM
header/footer).

* **start** - log index to start inclusion checking from, for monitoring large
* **minEntry** - log index to start inclusion checking from, for monitoring large
pre-existing logs.

* **windowStart** - (optional) for a sharded log the `windowStart` specifies
Expand Down
4 changes: 2 additions & 2 deletions examples/config.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
{
"uri": "https://birch.ct.letsencrypt.org/2018",
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAElgyN7ptarCAX5krBwDwjhHM+b0xJjCKke+Dfr3GWSbLm3eO7muXRo8FDDdpdiRpnG4NJT0bdzq5YEer4C2eZ+g==",
"start": 10,
"minEntry": 10,
"submitPreCert": true,
"submitCert": true
},
{
"uri": "https://spruce.ct.letsencrypt.org/2018",
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFq93Kkw3d9j25WKWHfgix0tNw+fbO3nWy3whKl3KtbkDTqIT2zUCPfM0BNFGoSgK4ikykT5MTyMIVFzULbO+UQ==",
"start": 1,
"minEntry": 1,
"submitPreCert": true,
"submitCert": true
}
Expand Down
4 changes: 2 additions & 2 deletions test/config/ct-woodpecker.docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYggOxPnPkzKBIhTacSYoIfnSL2jPugcbUKx83vFMvk5gKAz/AGe87w20riuPwEGn229hKVbEKHFB61NIqNHC3Q==",
"windowStart": "2000-01-01T00:00:00Z",
"windowEnd": "2001-01-01T00:00:00Z",
"start": 10,
"minEntry": 10,
"submitPreCert": false,
"submitCert": true
},
Expand All @@ -31,7 +31,7 @@
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKtnFevaXV/kB8dmhCNZHmxKVLcHX1plaAsY9LrKilhYxdmQZiu36LvAvosTsqMVqRK9a96nC8VaxAdaHUbM8EA==",
"windowStart": "2019-01-01T00:00:00Z",
"windowEnd": "2099-01-01T00:00:00Z",
"start": 1,
"minEntry": 1,
"submitPreCert": false,
"submitCert": true
}
Expand Down
4 changes: 2 additions & 2 deletions test/config/ct-woodpecker.localdev.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYggOxPnPkzKBIhTacSYoIfnSL2jPugcbUKx83vFMvk5gKAz/AGe87w20riuPwEGn229hKVbEKHFB61NIqNHC3Q==",
"windowStart": "2000-01-01T00:00:00Z",
"windowEnd": "2001-01-01T00:00:00Z",
"start": 10,
"minEntry": 10,
"submitPreCert": false,
"submitCert": true
},
Expand All @@ -32,7 +32,7 @@
"key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKtnFevaXV/kB8dmhCNZHmxKVLcHX1plaAsY9LrKilhYxdmQZiu36LvAvosTsqMVqRK9a96nC8VaxAdaHUbM8EA==",
"windowStart": "2019-01-01T00:00:00Z",
"windowEnd": "2099-01-01T00:00:00Z",
"start": 1,
"minEntry": 1,
"submitPreCert": false,
"submitCert": true
}
Expand Down
14 changes: 0 additions & 14 deletions test/config/ct-woodpecker.maple.nosubmit.json

This file was deleted.

17 changes: 11 additions & 6 deletions woodpecker/woodpecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ type LogConfig struct {
URI string
// Base64 encoded public key for the CT log
Key string
// TreeSize to start at when checking for inclusion
Start int64
// MinEntry indicates the entry index that should be used by ct-woodpecker
// when it first starts checking a log for inclusion. This is a useful option
// to specify when you're bringing ct-woodpecker up for the first time against
// a big log (or if the ct-woodpecker database has been dropped) to avoid
// needing to iterate through all past entries trying to check inclusion for
// newly submittedsubmitted certificates.
MinEntry int64
// Should woodpecker submit certificates to this log every CertSubmitInterval?
SubmitCert bool
// Should woodpecker submit pre-certificates to this log every CertSubmitInterval?
Expand Down Expand Up @@ -135,9 +140,9 @@ func (lc *LogConfig) Valid() error {
if lc.Key == "" {
return errors.New("log Key must not be empty")
}
// If there is a start treesize set, it must be >= 0
if lc.Start < 0 {
return errors.New("log start must be > 0 if set")
// If there is a min entry index set, it must be >= 0
if lc.MinEntry < 0 {
return errors.New("log MinEntry must be > 0 if set")
}
// If there is a WindowStart it must be a valid timestamp
if lc.WindowStart != "" {
Expand Down Expand Up @@ -351,7 +356,7 @@ func New(c Config, stdout, stderr *log.Logger, clk clock.Clock) (*Woodpecker, er
opts.InclusionOpts = &monitor.InclusionOptions{
Interval: inclusionInterval,
MaxGetEntries: c.InclusionConfig.MaxGetEntries,
StartIndex: logConf.Start,
StartIndex: logConf.MinEntry,
}
}
m, err := monitor.New(opts, stdout, stderr, clk)
Expand Down
4 changes: 2 additions & 2 deletions woodpecker/woodpecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func TestLogConfigValid(t *testing.T) {
Config: LogConfig{URI: "http://test.com"},
},
{
Name: "Start less than zero",
Config: LogConfig{URI: "https://test.com", Key: "⚷", Start: -1},
Name: "MinEntry less than zero",
Config: LogConfig{URI: "https://test.com", Key: "⚷", MinEntry: -1},
},
{
Name: "Valid log config",
Expand Down

0 comments on commit 77bf4a4

Please sign in to comment.