Skip to content

Commit 13a7a17

Browse files
committed
Merge branch 'main' of github.com:letsencrypt/boulder into drop-tables
2 parents 73ff402 + 1797450 commit 13a7a17

File tree

10 files changed

+708
-1115
lines changed

10 files changed

+708
-1115
lines changed

Makefile

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ VERSION ?= 1.0.0
66
EPOCH ?= 1
77
MAINTAINER ?= "Community"
88

9-
CMDS = $(shell find ./cmd -maxdepth 1 -mindepth 1 -type d | grep -v testdata)
10-
CMD_BASENAMES = $(shell echo $(CMDS) | xargs -n1 basename)
11-
CMD_BINS = $(addprefix bin/, $(CMD_BASENAMES) )
9+
CMDS = admin boulder ceremony ct-test-srv
10+
CMD_BINS = $(addprefix bin/, $(CMDS) )
1211
OBJECTS = $(CMD_BINS)
1312

1413
# Build environment variables (referencing core/util.go)
@@ -25,7 +24,7 @@ BUILD_TIME_VAR = github.com/letsencrypt/boulder/core.BuildTime
2524

2625
GO_BUILD_FLAGS = -ldflags "-X \"$(BUILD_ID_VAR)=$(BUILD_ID)\" -X \"$(BUILD_TIME_VAR)=$(BUILD_TIME)\" -X \"$(BUILD_HOST_VAR)=$(BUILD_HOST)\""
2726

28-
.PHONY: all build build_cmds rpm deb tar
27+
.PHONY: all build build_cmds deb tar
2928
all: build
3029

3130
build: $(OBJECTS)
@@ -38,24 +37,13 @@ $(CMD_BINS): build_cmds
3837
build_cmds: | $(OBJDIR)
3938
echo $(OBJECTS)
4039
GOBIN=$(OBJDIR) GO111MODULE=on go install -mod=vendor $(GO_BUILD_FLAGS) ./...
41-
./link.sh
4240

43-
# Building an RPM requires `fpm` from https://github.com/jordansissel/fpm
41+
# Building a .deb requires `fpm` from https://github.com/jordansissel/fpm
4442
# which you can install with `gem install fpm`.
4543
# It is recommended that maintainers use environment overrides to specify
4644
# Version and Epoch, such as:
4745
#
48-
# VERSION=0.1.9 EPOCH=52 MAINTAINER="$(whoami)" ARCHIVEDIR=/tmp make build rpm
49-
rpm: build
50-
fpm -f -s dir -t rpm --rpm-digest sha256 --name "boulder" \
51-
--license "Mozilla Public License v2.0" --vendor "ISRG" \
52-
--url "https://github.com/letsencrypt/boulder" --prefix=/opt/boulder \
53-
--version "$(VERSION)" --iteration "$(COMMIT_ID)" --epoch "$(EPOCH)" \
54-
--package "$(ARCHIVEDIR)/boulder-$(VERSION)-$(COMMIT_ID).x86_64.rpm" \
55-
--description "Boulder is an ACME-compatible X.509 Certificate Authority" \
56-
--maintainer "$(MAINTAINER)" \
57-
test/config/ sa/db data/ $(OBJECTS)
58-
46+
# VERSION=0.1.9 EPOCH=52 MAINTAINER="$(whoami)" ARCHIVEDIR=/tmp make build deb
5947
deb: build
6048
fpm -f -s dir -t deb --name "boulder" \
6149
--license "Mozilla Public License v2.0" --vendor "ISRG" \
@@ -64,10 +52,10 @@ deb: build
6452
--package "$(ARCHIVEDIR)/boulder-$(VERSION)-$(COMMIT_ID).x86_64.deb" \
6553
--description "Boulder is an ACME-compatible X.509 Certificate Authority" \
6654
--maintainer "$(MAINTAINER)" \
67-
test/config/ sa/db data/ $(OBJECTS) bin/ct-test-srv
55+
test/config/ sa/db data/ $(OBJECTS)
6856

6957
tar: build
7058
fpm -f -s dir -t tar --name "boulder" --prefix=/opt/boulder \
7159
--package "$(ARCHIVEDIR)/boulder-$(VERSION)-$(COMMIT_ID).amd64.tar" \
72-
test/config/ sa/db data/ $(OBJECTS) bin/ct-test-srv
60+
test/config/ sa/db data/ $(OBJECTS)
7361
gzip -f "$(ARCHIVEDIR)/boulder-$(VERSION)-$(COMMIT_ID).amd64.tar"

cmd/boulder/main.go

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,37 +85,31 @@ var boulderUsage = fmt.Sprintf(`Usage: %s <subcommand> [flags]
8585

8686
func main() {
8787
defer cmd.AuditPanic()
88-
var command string
89-
if core.Command() == "boulder" {
90-
// Operator passed the boulder component as a subcommand.
91-
if len(os.Args) <= 1 {
92-
// No arguments passed.
93-
fmt.Fprint(os.Stderr, boulderUsage)
94-
return
95-
}
9688

97-
if os.Args[1] == "--help" || os.Args[1] == "-help" {
98-
// Help flag passed.
99-
fmt.Fprint(os.Stderr, boulderUsage)
100-
return
101-
}
89+
if len(os.Args) <= 1 {
90+
// No arguments passed.
91+
fmt.Fprint(os.Stderr, boulderUsage)
92+
return
93+
}
10294

103-
if os.Args[1] == "--list" || os.Args[1] == "-list" {
104-
// List flag passed.
105-
for _, c := range cmd.AvailableCommands() {
106-
fmt.Println(c)
107-
}
108-
return
109-
}
110-
command = os.Args[1]
95+
if os.Args[1] == "--help" || os.Args[1] == "-help" {
96+
// Help flag passed.
97+
fmt.Fprint(os.Stderr, boulderUsage)
98+
return
99+
}
111100

112-
// Remove the subcommand from the arguments.
113-
os.Args = os.Args[1:]
114-
} else {
115-
// Operator ran a boulder component using a symlink.
116-
command = core.Command()
101+
if os.Args[1] == "--list" || os.Args[1] == "-list" {
102+
// List flag passed.
103+
for _, c := range cmd.AvailableCommands() {
104+
fmt.Println(c)
105+
}
106+
return
117107
}
118108

109+
// Remove the subcommand from the arguments.
110+
command := os.Args[1]
111+
os.Args = os.Args[1:]
112+
119113
config := getConfigPath()
120114
if config != "" {
121115
// Config flag passed.

link.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

sa/proto/sa.pb.go

Lines changed: 602 additions & 592 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sa/proto/sa.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ message CountFQDNSetsRequest {
163163
reserved 1; // Previously windowNS
164164
repeated string dnsNames = 2;
165165
google.protobuf.Duration window = 3;
166+
int64 limit = 4;
166167
}
167168

168169
message FQDNSetExistsRequest {

sa/sa_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,15 @@ func TestFQDNSetTimestampsForWindow(t *testing.T) {
677677
test.AssertNotError(t, err, "Failed to count name sets")
678678
test.AssertEquals(t, len(resp.Timestamps), 2)
679679
test.AssertEquals(t, firstIssued, resp.Timestamps[len(resp.Timestamps)-1].AsTime())
680+
681+
resp, err = sa.FQDNSetTimestampsForWindow(ctx, &sapb.CountFQDNSetsRequest{
682+
DnsNames: names,
683+
Window: durationpb.New(window),
684+
Limit: 1,
685+
})
686+
test.AssertNotError(t, err, "Failed to count name sets")
687+
test.AssertEquals(t, len(resp.Timestamps), 1)
688+
test.AssertEquals(t, firstIssued, resp.Timestamps[len(resp.Timestamps)-1].AsTime())
680689
}
681690

682691
func TestFQDNSetsExists(t *testing.T) {

sa/saro.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"math"
78
"math/big"
89
"net"
910
"regexp"
@@ -334,10 +335,16 @@ func (ssa *SQLStorageAuthorityRO) GetRevocationStatus(ctx context.Context, req *
334335
// FQDNSetTimestampsForWindow returns the issuance timestamps for each
335336
// certificate, issued for a set of domains, during a given window of time,
336337
// starting from the most recent issuance.
338+
//
339+
// If req.Limit is nonzero, it returns only the most recent `Limit` results
337340
func (ssa *SQLStorageAuthorityRO) FQDNSetTimestampsForWindow(ctx context.Context, req *sapb.CountFQDNSetsRequest) (*sapb.Timestamps, error) {
338341
if core.IsAnyNilOrZero(req.Window) || len(req.DnsNames) == 0 {
339342
return nil, errIncompleteRequest
340343
}
344+
limit := req.Limit
345+
if limit == 0 {
346+
limit = math.MaxInt64
347+
}
341348
type row struct {
342349
Issued time.Time
343350
}
@@ -348,9 +355,11 @@ func (ssa *SQLStorageAuthorityRO) FQDNSetTimestampsForWindow(ctx context.Context
348355
`SELECT issued FROM fqdnSets
349356
WHERE setHash = ?
350357
AND issued > ?
351-
ORDER BY issued DESC`,
358+
ORDER BY issued DESC
359+
LIMIT ?`,
352360
core.HashNames(req.DnsNames),
353361
ssa.clk.Now().Add(-req.Window.AsDuration()),
362+
limit,
354363
)
355364
if err != nil {
356365
return nil, err

tools/make-assets.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $(dirname -- "${0}")/fetch-and-verify-go.sh "${GO_VERSION}"
2424
sudo tar -C /usr/local -xzf go.tar.gz
2525
export PATH=/usr/local/go/bin:$PATH
2626

27-
# Install fpm, this is used in our Makefile to package Boulder as a deb or rpm.
27+
# Install fpm, this is used in our Makefile to package Boulder as a deb.
2828
sudo gem install --no-document -v 1.14.0 fpm
2929

3030
#
@@ -38,5 +38,5 @@ export ARCHIVEDIR="${PWD}"
3838
# Set $VERSION to be a simulacrum of what is set in other build environments.
3939
export VERSION="${GO_VERSION}.$(date +%s)"
4040

41-
# Build Boulder and produce an RPM, a .deb, and a tar.gz file in $PWD.
42-
make rpm deb tar
41+
# Build Boulder and produce a .deb and a tar.gz file in $PWD.
42+
make deb tar

0 commit comments

Comments
 (0)