Skip to content

Error getting hosted zone name ... for ClusterIssuer without hostedZoneName defined. #2875

@hetii

Description

@hetii

Hello dear.
I use such ClusterIssuer.
Note here that clientID is set to: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
and hostedZoneName is not defined:

apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
  name: letsencrypt-production
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: xxx@xxx.com
    privateKeySecretRef:
      name: letsencrypt
    solvers:
    - dns01:
        azuredns:
          # Service principal client id
          clientID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
          tenantID: ...
          subscriptionID: ...
          # Secret with the password
          clientSecretSecretRef:
            key: password
            name: secret-azuredns-config
          # Name of the DNS Zone
          # https://github.com/jetstack/cert-manager/issues/1459
          # hostedZoneName: example.com
          # Resource group where the DNS Zone is located
          resourceGroupName: aks-cluster-dev

The clientID "xxxxxxxx..." have service principals created by terraform and access only for exactly given set of domains, let say (example.com, foo.com, bar.com etc).

When I apply it I got errors like:

Error getting hosted zone name for: 
 _acme-challenge.example.com., Zone com. not found in AzureDNS for domain
 _acme-challenge.example.com.. Err: dns.ZonesClient#Get: 
Failure responding to request: StatusCode=403 -- Original Error: autorest/azure:
Service returned an error. Status=403 Code="AuthorizationFailed"
Message="The client 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' 
with object id 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' 
does not have authorization to perform action
 'Microsoft.Network/dnsZones/read' over scope 
'/subscriptions/<my subscription here>/resourceGroups/aks-cluster-dev/providers/Microsoft.Network/dnsZones/com' 
or the scope is invalid.

As we can see there is two issue, first no clue why errors talk about client "bbbbbbbb" as I use "xxxxxxxx" and when change clientID to let say fake "yyyyyy" then got proper message, that such principal don't exist in my azure tenatID.

The second issue is that without hostedZoneName defined in ClusterIssuer, the cert-manager trying to read zones one level up, so in this case starting from .com ("Microsoft.Network/dnsZones/com'") and of course raise above errors as I don't manage primary zones :)

On other hand when I set hostedZoneName and clientID back to "xxxxxxxx..." then I see proper acme challenge that are set in my zone.

So lets say that now that I need to manage 100 different zones, do I need to create then 100 ClusterIssuers for them with only different hostedZoneName?

cert-manager version: v0.15.0-alpha.0
Kubernetes: v1.16.7
Best Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/acme/dns01Indicates a PR modifies ACME DNS01 provider codehelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions