lexicon icon indicating copy to clipboard operation
lexicon copied to clipboard

Cpanel Support for Shared Hosting providers

Open clayshieh opened this issue 7 years ago • 8 comments
trafficstars

I wrote a python library to interact with my shared hosting provider's dns settings which are exposed via cpanel here: https://github.com/clayshieh/PyCpanel

Haven't gotten around to cleaning it up to support WHM and API V1 yet but I think it would be a nice addition as a generic driver to lexicon so that it can support a number of providers that use cPanel (e.g. GoDaddy, Bluehost, HostGator, etc.,)

clayshieh avatar Jun 27 '18 20:06 clayshieh

I think cPanel DNS is a great candidate because their API is actually documented and mostly stable.

One restriction is that the user's feature list must include the "Advanced Zone Editor", otherwise TXT records cannot be added. It might or might not be worth doing a preflight to check if the feature is present.

alexzorin avatar Jul 09 '18 02:07 alexzorin

@alexzorin there's not really a way to check if the zone edit module is enabled on the user's feature list other than just sending the request and seeing if the response is successful. A weaker but reasonable assumption could be to use the fetchzone_records function in the Zoneedit module (refer to the get_records() method in my code) in the init function to check if the user has access to Zoneedit functions.

clayshieh avatar Jul 10 '18 22:07 clayshieh

yeah I'm with @alexzorin , this sounds like a great idea.

I don't personally use CPanel, so I won't be much help with the provider, but I'm more than happy to accept a PR.

Regarding a pre-flight check for this "Advanced Zone Editor" feature, you could use the authentication function to do this.

Should throw an error if authentication fails for any reason, of if the domain does not exist.

Basically if the feature isn't enabled, lexicon will just stop what it's doing and show the an error message. Now the thing to consider is if the CPanel API will return a nice error message stating that "Advanced Zone Editor" is missing, of if we need to explicitly catch the HTTP error and throw our own more explicit error stating the feature is not enabled.

AnalogJ avatar Jul 12 '18 19:07 AnalogJ

Hey @clayshieh Is this something you're still willing to work on? Is there anything I can do to help?

AnalogJ avatar Sep 14 '18 07:09 AnalogJ

@AnalogJ this was on the back burner for a while. But I just took a look at integrating the Cpanel support and I need to make some modifications to my library to make it more compatible with Lexicon. Also, is there a common directory for files or do I need to register my module on pypi for it to be used in Lexicon?

clayshieh avatar Sep 14 '18 21:09 clayshieh

Hey @clayshieh It would need to be registered as a module on pypi.

AnalogJ avatar Sep 16 '18 10:09 AnalogJ

Hey @clayshieh Just wanted to follow up. Hows the CPanel provider work going? If your having issues creating a pypi project, and I walk you though the steps I used for lexicon

AnalogJ avatar Oct 31 '18 16:10 AnalogJ