ole1986 / wp-ispconfig3

Wordpress ISPConfig plugin with Gutenberg support
https://wordpress.org/plugins/wp-ispconfig3/
28 stars 13 forks source link

Improve global domain check validation using `dig` instead of `whois` #30

Closed ole1986 closed 4 years ago

ole1986 commented 4 years ago

While some TLD providers to not come up with information using whois it may be mre accurate using other tools, like dig to check the availability.

As already mentioned in issue #29 the below command may be helpful

dig +noall +answer <domain> NS

This should be than configurable through settings to either use whois or the other tool(s)

MachineITSvcs commented 4 years ago

Just a suggestion. You may consider using only +short instead of +noall +answer, as it will provide you only with the nameservers. It may also be worth mentioning that if the server is set up as listed nameservers, should we proceed with adding the domain. An example would be if I'm already pointing the domain from the registrar to the server, but it's not yet setup in ISPConfig. Maybe having an option where you can specify "whitelisted" nameservers may be beneficial. So if they are found, one or more, in any order, but without additional nameservers, the operation proceeds.

dig +short \<domain> NS

ole1986 commented 4 years ago

But still, when its registered to a nameserver it would be unavailable. No matter if its your own nameserver or any other, right?

MachineITSvcs commented 4 years ago

Why would it be unavailable if the intention is to check it before adding it as a site or in the DNS settings? It's only unavailable if you're trying to buy it, which unfortunately hasn't been built into this plugin yet.

-- Collin Machine

On Sat, Nov 16, 2019, 3:39 PM ole notifications@github.com wrote:

But still, when its registered to an nameserver it would be unavailable. No matter if its your own nameserver or any other, right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ole1986/wp-ispconfig3/issues/30?email_source=notifications&email_token=AD7WLROBADIYXFQKWOOXU6DQUBK7RA5CNFSM4JNNL7A2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEH2BQY#issuecomment-554672323, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7WLRJ5U2X2R7NKHJQJ4I3QUBK7RANCNFSM4JNNL7AQ .

MachineITSvcs commented 4 years ago

Obviously, you'd still want to make sure it's not already being used for a site by another user, but you already built the function for that

MachineITSvcs commented 4 years ago

What I'm trying to say is, if you own the domain (or it's been purchased before), then this check will always fail, UNLESS you manually delete all the nameservers of the domain in the registrar. Best to just check them for the right nameservers.

ole1986 commented 4 years ago

Ok, I got it. But wouldn't it be still more useful to whitelist domain names instead of name servers?

Imaging you have a NS which contain both. A domain which is already in used by a customer and another domain which is parked only. Then both will available due to the whitelisted name server.

BTW: Buying web domain sounds like a job for the other plugin wc-invoice-pdf. The name might be confusing but it takes the woocommerce orders into account and also comes up with a Webspace product for woocommerce.

If you need an individual product for only buying web domain it can quickly be arranged I think. Just checkout the other plugin page and raise an issue (if needed)

MachineITSvcs commented 4 years ago

If a domain is already used by a customer, should your recent function that you made as an alternative to the domain check not catch those sites? Also, if a domain is parked, there should also be a function to check that as well. Not to mention it should throw an error when trying to create another DNS zone for the same domain.

And it would be pretty straightforward to set up the other plugin to buy domains via the Name.com API. That's what I currently use. Could be an extra stream of revenue for plugin users as well.

-- Collin Machine

On Sat, Nov 16, 2019, 3:59 PM ole notifications@github.com wrote:

Ok, I got it. But wouldn't it be still more useful to whitelist domain names instead of name servers?

Imaging you have a NS which contain both. A domain which is already in used by a customer and another domain which is parked only. Then both will available due to the whitelisted name server.

BTW: Buying web domain sounds like a job for the other plugin wc-invoice-pdf https://github.com/ole1986/wc-invoice-pdf. The name might be confusing but it takes the woocommerce orders into account and also comes up with a Webspace product for woocommerce.

If you need an individual product for only buying web domain it can quickly be arranged I think. Just checkout the other plugin page and raise an issue (if needed)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ole1986/wp-ispconfig3/issues/30?email_source=notifications&email_token=AD7WLRKCQ5W4HIGCBKQDKNLQUBNMHA5CNFSM4JNNL7A2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEH2NZQ#issuecomment-554673894, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7WLRPQMHD55YBZHF37363QUBNMHANCNFSM4JNNL7AQ .

ole1986 commented 4 years ago

ATM it can either validate against the global (using whois and dig command) or against the ISPConfig database if a domain is available. But not both at the same time.

So would you agree to the following future change (quick draw):

File deleted, needs review

ole1986 commented 4 years ago

Regarding the other plugin feature, feel free add an issue there for name.com integration. highly appreciated

MachineITSvcs commented 4 years ago

I feel it would be easier to whitelist nameservers when using the whois check, if enabled, and if available or whitelisted nameservers received, then proceed as if available IF domain also available in ISPConfig3 database.

Construct: Begin Domain Check --> Check ISPConfig3 Database --> IF Database DOES contain domain (End Domain Check Returning as Unavailable), ELSE Check Nameservers using Dig --> IF Nameservers NOT Received (End Domain Check Returning as Available), Else IF Nameservers Received (Check whitelisted nameservers against Nameservers Received, IF whitelisted (End Domain Check, Returning Domain as Available), Else (End Domain Check, Returning Domain as Unavailable))

Forgive my pseudo-code.

The main priority should be to make sure the domain does not already exist in the ISPConfig3 Database, to prevent duplicate sites or DNS zone from being created, or throwing errors. If the domain is not in the database already, you should then check if it's nameservers are set via dig and if those Nameservers are whitelisted before adding them to the database.

MachineITSvcs commented 4 years ago

So just to clarify, are you now checking whether domains being checked are whitelisted or their nameservers?

ole1986 commented 4 years ago

As already mentioned here when using name servers it may result in false positive results

That is why domain names makes more sense and are taken for the whitelist