MDHMatt Posted August 11, 2021 Report Posted August 11, 2021 Is there a way to force the namecheap module to use ipv4 only? The api does NOT support ipv6 (verified by namecheap support) and it causing errors when trying to purchase domains. Quote
0 Paul Posted August 13, 2021 Report Posted August 13, 2021 On 8/11/2021 at 9:01 AM, MDHMatt said: Is there a way to force the namecheap module to use ipv4 only? The api does NOT support ipv6 (verified by namecheap support) and it causing errors when trying to purchase domains. Use IPv4 in what way? If their API doesn't support IPv6, then they shouldn't have an AAAA record on their DNS for the endpoint, and your server shouldn't try to connect over IPv6. If they do have an AAAA record, and your server has an IPv6 address, removing the IPv6 address should force IPv4. Quote
0 MDHMatt Posted August 14, 2021 Author Report Posted August 14, 2021 16 hours ago, Paul said: Use IPv4 in what way? If their API doesn't support IPv6, then they shouldn't have an AAAA record on their DNS for the endpoint, and your server shouldn't try to connect over IPv6. If they do have an AAAA record, and your server has an IPv6 address, removing the IPv6 address should force IPv4. Unfortunately I can’t remove the v6 address. The logs looks like we could define an ip to use?? Quote
0 pdi Posted March 29, 2022 Report Posted March 29, 2022 Although this is an old question, I worked around like this: In components/modules/namecheap/apis/namecheap_api.php // original code if (!isset($args['ClientIP'])) { $args['ClientIP'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; } // added this line: // I used my own IPv4, but this worked as well (in another panel) $args['ClientIP'] = '127.0.0.1'; And yes, namecheap still does not support IPv6. MDHMatt 1 Quote
0 MDHMatt Posted May 27, 2022 Author Report Posted May 27, 2022 @Paul can we have a way to enter an ip in the module settings that lets us set the ClientIP? this could be auto populated using the existing code but having an option to adjust it would be great as namecheap get you to whitelist ip address to use the api with and only ipv4 Quote
0 Paul Posted May 27, 2022 Report Posted May 27, 2022 6 hours ago, MDHMatt said: @Paul can we have a way to enter an ip in the module settings that lets us set the ClientIP? this could be auto populated using the existing code but having an option to adjust it would be great as namecheap get you to whitelist ip address to use the api with and only ipv4 What is the purpose of the ClientIP? Is this the IP address that API calls should originate from , or is it simply passed as a parameter in the API call? I have not looked into this myself. If $_SERVER['REMOTE_ADDR'] is returning an IPv6 address for your server, I can understand the fix posted above to force another IP. However, what are the implications if you enter an invalid IPv4 address, or one that does not resolve to this server? If the IP is just passed along to the API as a parameter, then I suppose it wouldn't cause any communication issues if the IP that made the request were different. Quote
0 MDHMatt Posted May 28, 2022 Author Report Posted May 28, 2022 8 hours ago, Paul said: What is the purpose of the ClientIP? Is this the IP address that API calls should originate from , or is it simply passed as a parameter in the API call? I have not looked into this myself. If $_SERVER['REMOTE_ADDR'] is returning an IPv6 address for your server, I can understand the fix posted above to force another IP. However, what are the implications if you enter an invalid IPv4 address, or one that does not resolve to this server? If the IP is just passed along to the API as a parameter, then I suppose it wouldn't cause any communication issues if the IP that made the request were different. As per their documentation found here https://www.namecheap.com/support/api/global-parameters/ and described here https://www.namecheap.com/support/api/intro/ they use whitelisted ipv4 address to control access to the api which you enter into your account page. Should you enter a non whitelisted ip it gives an error. this could also be useful for people with multiple IP address who maybe want to limit what ip to use for api calls Quote
0 MDHMatt Posted May 28, 2022 Author Report Posted May 28, 2022 On 3/29/2022 at 1:43 PM, pdi said: Although this is an old question, I worked around like this: In components/modules/namecheap/apis/namecheap_api.php // original code if (!isset($args['ClientIP'])) { $args['ClientIP'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; } // added this line: // I used my own IPv4, but this worked as well (in another panel) $args['ClientIP'] = '127.0.0.1'; And yes, namecheap still does not support IPv6. @pdiThanks! That’s seem to work Does this get overwritten when you upgrade?? Quote
0 Paul Posted May 31, 2022 Report Posted May 31, 2022 On 5/28/2022 at 12:53 AM, MDHMatt said: As per their documentation found here https://www.namecheap.com/support/api/global-parameters/ and described here https://www.namecheap.com/support/api/intro/ they use whitelisted ipv4 address to control access to the api which you enter into your account page. Should you enter a non whitelisted ip it gives an error. this could also be useful for people with multiple IP address who maybe want to limit what ip to use for api calls Ok, this is unusual because an IP restriction on the API would normally mean that the API would restrict the IP for the source of the request. If you can specify any IP and it uses that, it could be spoofed to bypass the check. It doesn't make sense. I think the 1st comment in that documentation you linked sums it up well: Quote Can anybody explain my WHY ClientIp must be included in request? NameCheap API server already knows which IP calls it from, right? It is not only data redundancy, it's error-prone misconception. Client should authenticate itself (username+token), API server should check if remote IP is on the whitelist, configured on NameCheap's side. It seems to me that this is something Namecheap should fix. Adding a field to specify the IP is a pretty hacky-fix. The example in this thread of using an IP address of 127.0.0.1 for ClientIP, does this work universally? If so, the simpler solution may be to just specify 127.0.0.1 for ClientIP in all requests like the example code, rather than requesting it. OR, if the IP address = IPv6, then instead of using that address, send 127.0.0.1. Thoughts? Quote
Question
MDHMatt
Is there a way to force the namecheap module to use ipv4 only? The api does NOT support ipv6 (verified by namecheap support) and it causing errors when trying to purchase domains.
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.