Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose generated DNSKEY/DS records on DNSSEC-signed managed zones #4802

Closed
jhujhiti opened this issue Nov 2, 2019 · 2 comments · Fixed by GoogleCloudPlatform/magic-modules#3117, #5703 or hashicorp/terraform-provider-google-beta#1768

Comments

@jhujhiti
Copy link

jhujhiti commented Nov 2, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

When creating a DNSSEC-signed zone, Google generates DNSKEY records (both a ZSK and a KSK). These records should be exposed as attributes, ideally in both the DNSKEY format and the DS format. Exposing the KSK is especially important as it's necessary to delegate the zone securely from the parent. With this data exposed, the delegation from the registrar could happen entirely within Terraform (assuming a supported registrar provider...).

I see this accomplished with at least two attributes:

  • A list of all KSKs in DNSKEY format (["257 3 13 mdsswUyr3DPW132mOi8V9xESWE8jTo0dxCjjnopKl+GqJxpVXckHAeF+ KkxLbxILfDLUT0rAK9iUzy1L53eKGQ=="])
  • A list of all KSKs in DS format (["2371 13 2 32996839A6D808AFE3EB4A795A0E6A7A39A76FC52FF228B22B76F6D63826F2B9"])
  • (Maybe, although somewhat less useful) A list of all ZSKs in DNSKEY format (["256 3 13 oJMRESz5E4gYzS/q6XDrvU1qMPYIjCWzJaOau8XNEZeqCYKD5ar0IRd8 KqXXFJkqmVfRvMGPmM1x8fGAa2XhSA=="]). This isn't necessary to delegate the zone, but Google's API response does provide it.

A secure delegation at the registrar requires either the KSK DS records or the KSK DNSKEY records (depending on the registry, they will either require the DS or accept a DNSKEY and convert it to DS automatically).

It may also be useful to expose a map of each type of key with the raw values Google's API provides in addition to exposing the strings above. If this is done, I'd want to see at least the following contained in the map:

  • algorithm name
  • algorithm id
  • protocol
  • flags
  • encoded public key
  • key digest algorithm
  • key digest algorithm id
  • key digest

The key of each map item would be the key tag in the API response.

Happy to help elucidate any details on the records themselves if necessary.

New or Affected Resource(s)

  • google_dns_managed_zone

Potential Terraform Configuration

# standard zone creation with dnssec enabled
resource "google_dns_managed_zone" "myzone" {
  name        = "myzone"
  dns_name    = "terraform.io."
  visibility  = "public"

  dnssec_config {
    state         = "on"
    non_existence = "nsec3"

    default_key_specs {
      algorithm  = "ecdsap256sha256"
      key_length = "256"
      key_type   = "keySigning"
    }

    default_key_specs {
      algorithm  = "ecdsap256sha256"
      key_length = "256"
      key_type   = "zoneSigning"
    }
  }
}

# module output to allow consumers to programmatically send the key to the registrar
output "ksks" {
  # i would expect this to be a list since multiple keys are valid
  value = google_dns_managed_zone.myzone.dnskey_ksks
}

References

API documentation is at https://cloud.google.com/dns/docs/reference/v1beta2/dnsKeys/list

Presentation format for the DNSKEY and DS records is described in https://tools.ietf.org/html/rfc4034

DNSKEY algorithm numbers are defined by IANA at https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml#dns-sec-alg-numbers-1

Digest algorithm numbers are also defined by IANA separately at https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml

@chrissng
Copy link
Contributor

chrissng commented Feb 11, 2020

The way magic-module resources are defined seems to suggest that this cannot be a computed property of google_dns_managed_zone as I don't see the means to override the GET request for this property with https://cloud.google.com/dns/docs/reference/v1/dnsKeys/list. It could be defined as a data source instead and I can try to implement this.

@ghost
Copy link

ghost commented Mar 20, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.