Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

default nameserver is not working and will cause registration failure #2

Open
cras4202tw opened this issue Oct 12, 2020 · 5 comments
Open

Comments

@cras4202tw
Copy link

The default nameservers of whmcs will be set to
ns1.yourdomain.com
ns2.yourdomain.com

When purchasing, although it will pop up asking if you want to use custom nameservers
https://imgur.com/NSiIBrT
But under normal circumstances, customers will not have their own nameservers

At this point, Gandi whmcs module will Submit registration with this nameserver
ns1.yourdomain.com
ns2.yourdomain.com
https://imgur.com/XEgcT6c
Will cause problems in the registration process
https://imgur.com/yj7eWK4

And I submit a ticket to the customer service
pro-zh #13042282
Also get
ns1.yourdomain.com
ns2.yourdomain.com
It is not the correct nameserver and can not register normally

Can the nameserver of the whmcs module be modified to the gandi LiveDns preset by gandi?

@grigouze
Copy link
Contributor

Hello.

If you don't specify nameservers, livedns are set automaticaly, maybe it's ok for you ?

You can look at the documentation here : https://api.gandi.net/docs/domains/#post-v5-domain-domains

@cras4202tw
Copy link
Author

Leave the nameserver blank will cause the module to operate incorrectly
https://imgur.com/U7Xm5Ga

So no matter what, you need to fill in a nameserver
But Gandi LiveDNS should be used directly by default

@Themimitoof
Copy link
Member

Hello @cras4202tw,

Unfortunately, WHMCS developers have in mind you have your own DNS infrastructure that you give access to your customers. You can set default nameservers in General domains configuration but if you use a multiple registrars, you also can't define different nameservers of each of them.

If you really want to give the Gandi's LiveDNS platform to your customers, you will need to do some modifications in your instance. Because this is a specific use-case, we can't push anything in the plugin code.

My purpose is to:

  1. Edit the order form to allow the customer to choose his own NS servers or your NS servers. "Your NS servers" I mean, an hidden form that send empty value for the fifth nameservers (or a dummy value). An example is available here: https://requests.whmcs.com/topic/ability-to-remove-the-nameserver-options-on-order-page
  2. Add in the registrars/gandiv5/lib/ApiClient.php file, add a function getGenericLiveDNSServers with the below code:
/*
     *
     * Return a list of generic LiveDNS servers that the given 
     * domain can use
     * 
     * @param string $domain
     * @return array
     *
     */
    public function getGenericLiveDNSServers(string $domain)
    {
        $url = "{$this->endPoint}/livedns/nameservers/{$domain};
        $response = $this->sendRequest($url, "GET");
        logModuleCall('Gandi V5', 'LiveDNS generic servers info', $domain, $response);
        return json_decode($response);
    }
  1. In gandiv5_RegisterDomain and gandiv5_TransferDomain functions in the gandiv5.php file, replace the $nameservers array by a condition to check if $params['ns{1-5}'] are null, fill the $nameservers array by the content of the getGenericLiveDNSServers method, otherwise, returns the values from $params like the plugin currently do.

I haven't tested locally but this should works for you (modulo some corrections of possible typos 😅).

Give me your feedback if my workaround works for you.

@cras4202tw
Copy link
Author

I don’t think that changing the default nameserver to Gandi LiveDNS in the whmcs module is a special use case. 😔

case 1
After the customer finishes registering the domain name, we still need to instruct him how to change the nameserver
case 2
How can I get Gandi LiveDNS when the domain name has not been registered? Which nameservers are there?

Even if you can use Gandi LiveDNS
The user cannot change his record on Gandi LiveDNS on whmcs
So I think we should

  1. Gandi LiveDNS can be used directly when sending domain name registration
  2. Users can edit Gandi LiveDNS records on whmcs

@Themimitoof
Copy link
Member

Themimitoof commented Oct 14, 2020

How can I get Gandi LiveDNS when the domain name has not been registered? Which nameservers are there?

Through the route https://api.gandi.net/v5/livedns/nameservers/{fqdn} (see: https://api.gandi.net/docs/livedns/#get-v5-livedns-nameservers-fqdn)

This is why I purposed you to add a getGenericLiveDNSServers function in my last comment. If in the register/transfert process you don't receive nameservers in the order form, you will retrieve the list of NS servers from the LiveDNS API for the given domain even if it is not registered yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants