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

Fix verification for namecheap domains not *owned* by the calling user #2106

Merged
merged 1 commit into from
Feb 25, 2019

Conversation

EverPresent
Copy link
Contributor

The NameCheap DNS plugin is using NameCheap's domains.getList api call to try and verify that the user has access to the requested domain. That works great as long as the user is the primary owner of the domain. If the user is just a user who has been granted administrative DNS rights to the domain, then the domains.getList api will not include that domain in the response. See http://disq.us/p/1q6v9x9 for NameCheap's official comment (short story, getList only returns domains the user owns, not ones they've been granted admin rights for).

I changed the code so that it will first attempt to verify that the user has permissions to the domain by calling the original domains.getList api endpoint. If that verification fails, then it falls back to calling the domains.dns.getHosts api endpoint directly.

@@ -94,6 +110,10 @@ _get_root() {
#not valid
return 1
fi
if ! _contains "$h" "\\."; then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this small guard branch because $h was being set to the TLD, which obviously can not be the only part of the domain name. However, since my domain was not being returned in the response from the getList api call, the if statement a few lines down was finding that $response does contain the string "com" (unsurprisingly). It was then setting the _sub_domain and _domain variables both to "com" (obviously wrong) and returning success.

With my update, this method will correctly return false for domains which are not returned in $response. The _get_root method will then fall back to trying another method of verifying that this user has access to the requested domain.

@Neilpang
Copy link
Member

Good.

Would you like to create an issue for namecheap dns api? so that users can report bugs to it.

https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide#10-please-create-a-new-issue-for-future-bugs

Thanks.

@EverPresent
Copy link
Contributor Author

Sure. I just created the issue at #2107

@Neilpang Neilpang merged commit ec54074 into acmesh-official:dev Feb 25, 2019
Neilpang pushed a commit that referenced this pull request Feb 27, 2019
* Support for MyDevil.net (#2076)

support mydevil

* Fix verification for namecheap domains not *owned* by the calling user (#2106)

* Peb (#2126)

* support pebble
* support async finalize order

* add Pebble
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants