cmd/derper: add --acme-email flag for GCP cert mode (#18278)
GCP Certificate Manager requires an email contact on ACME accounts. Add --acme-email flag that is required for --certmode=gcp and optional for --certmode=letsencrypt. Fixes #18277 Signed-off-by: Raj Singh <raj@tailscale.com>
This commit is contained in:
+8
-1
@@ -44,7 +44,7 @@ type certProvider interface {
|
||||
HTTPHandler(fallback http.Handler) http.Handler
|
||||
}
|
||||
|
||||
func certProviderByCertMode(mode, dir, hostname, eabKID, eabKey string) (certProvider, error) {
|
||||
func certProviderByCertMode(mode, dir, hostname, eabKID, eabKey, email string) (certProvider, error) {
|
||||
if dir == "" {
|
||||
return nil, errors.New("missing required --certdir flag")
|
||||
}
|
||||
@@ -59,6 +59,9 @@ func certProviderByCertMode(mode, dir, hostname, eabKID, eabKey string) (certPro
|
||||
if eabKID == "" || eabKey == "" {
|
||||
return nil, errors.New("--certmode=gcp requires --acme-eab-kid and --acme-eab-key flags")
|
||||
}
|
||||
if email == "" {
|
||||
return nil, errors.New("--certmode=gcp requires --acme-email flag")
|
||||
}
|
||||
keyBytes, err := decodeEABKey(eabKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -73,6 +76,10 @@ func certProviderByCertMode(mode, dir, hostname, eabKID, eabKey string) (certPro
|
||||
}
|
||||
if hostname == "derp.tailscale.com" {
|
||||
certManager.HostPolicy = prodAutocertHostPolicy
|
||||
}
|
||||
if email != "" {
|
||||
certManager.Email = email
|
||||
} else if hostname == "derp.tailscale.com" {
|
||||
certManager.Email = "security@tailscale.com"
|
||||
}
|
||||
return certManager, nil
|
||||
|
||||
Reference in New Issue
Block a user