Skip to content

Commit c1a18dc

Browse files
authored
Reduce expiration time of certificates (#1146)
Clients that rely on OSX APIs for certificate validation may find an error with the message "certificate is not standards compliant" with certificates that don't comply with Apple rules for certificate validation. When this error happens, the actual reason for each certificate is not exposed, and it seems to happen with certificates that should be valid in the context of the validation. More discussion about this can be found in golang/go#51991. This happens with certificates generated by `elastic-package`, clients sometimes report this error with configurations that otherwise should accept these certificates. According to this post, one of the rules is that certificates cannot be valid for more than 825 days. https://rahulkj.github.io/openssl,/certificates/2022/09/09/self-signed-certificates.html Reduce the expiration time to try to reduce the chances of triggering this error.
1 parent 083d4f1 commit c1a18dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/certs/certs.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ func New(isCA bool, issuer *Issuer, opts ...Option) (*Certificate, error) {
152152
return nil, fmt.Errorf("failed to get a unique serial number: %w", err)
153153
}
154154

155-
const longTime = 100 * 24 * 365 * time.Hour
155+
// Don't use a expiration time longer than 825 days.
156+
// See https://rahulkj.github.io/openssl,/certificates/2022/09/09/self-signed-certificates.html.
157+
const longTime = 800 * 24 * time.Hour
156158
template := x509.Certificate{
157159
NotBefore: time.Now(),
158160
NotAfter: time.Now().Add(longTime),

0 commit comments

Comments
 (0)