Skip to content

Commit f6b8d4a

Browse files
committed
Truncate NotBefore/NotAfter to second precision
Partial seconds are not permitted See caddyserver/caddy#6864
1 parent 8706f54 commit f6b8d4a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

client.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ func (c *Client) ObtainCertificate(ctx context.Context, params OrderParameters)
9595
// create the ACME order
9696
order := acme.Order{Profile: params.Profile, Identifiers: params.Identifiers}
9797
if !params.NotBefore.IsZero() {
98-
order.NotBefore = &params.NotBefore
98+
// partial seconds are not permitted
99+
trunc := params.NotBefore.Truncate(time.Second)
100+
order.NotBefore = &trunc
99101
}
100102
if !params.NotAfter.IsZero() {
101-
order.NotAfter = &params.NotAfter
103+
// partial seconds are not permitted
104+
trunc := params.NotAfter.Truncate(time.Second)
105+
order.NotAfter = &trunc
102106
}
103107
if params.Replaces != nil {
104108
certID, err := acme.ARIUniqueIdentifier(params.Replaces)

0 commit comments

Comments
 (0)