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

ibmcloud: add support for subdomains #1779

Merged
merged 6 commits into from
Dec 6, 2022
Merged

Conversation

thomasmhofmann
Copy link
Contributor

@thomasmhofmann thomasmhofmann commented Dec 5, 2022

I noticed that requesting wildcard certificates for subdomains does not work for the ibmcloud (softlayer) dns solver.
The problem is that the softlayer API getDomainID is used and the domain name is passed as an argument.
For wildcard certificates for subdomains this argument will be the subdomain. The subdomain is not a separate entity in softlayer DNS so no record and thus no domain ID is found.

This change will try to find the "parent" of the subdomain in case the domain that was used to find the domain ID has more than two parts.
When the parent can be found the correct acme challenge entries will be made and a wildcard certificate for a subdomain will be created successfully.

I did live tests with one of my domains in softlayer and with the change I am able to retrieve the wildcard cert for the subdomain(s). I tried:

  • *.toplevel.domain
  • *.1.toplevel.domain
  • *.1.2.toplevel.domain
  • toplevel.domain
  • 2.toplevel.domain
  • 2.3.toplevel.domain

I am a golang beginner so in case something is wrong with the code please tell me.
Thanks.

thomasmhofmann and others added 4 commits December 6, 2022 14:54
Formatting of comment.

Co-authored-by: Ludovic Fernandez <[email protected]>
I was thinking that this would be the better error message because the value that will be used for %w is actually not the domain ID but a domain name.
If you think this should not be changed it is fine with me.

Co-authored-by: Ludovic Fernandez <[email protected]>
Use a more efficient way to determine the "parent" domain.

Co-authored-by: Ludovic Fernandez <[email protected]>
Remove code no longer needed.

Co-authored-by: Ludovic Fernandez <[email protected]>
@ldez ldez added this to the v4.10 milestone Dec 6, 2022
"Error: providers/dns/ibmcloud/internal/wrapper.go:75:15: S1003: should use !strings.Contains(parent, ".") instead (gosimple)
	if !found || strings.Index(parent, ".") == -1 {"
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@ldez ldez changed the title add support for subdomains for the ibmcloud dns solver. ibmcloud: add support for subdomains Dec 6, 2022
@ldez ldez enabled auto-merge (squash) December 6, 2022 16:11
@thomasmhofmann
Copy link
Contributor Author

Thanks for quick review and working with me on this!

@ldez ldez merged commit c754882 into go-acme:master Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants