Upgrading security with xmlapi
Heya,
So I've added a feature to my site which allows for automatic creation of user@domain whenever a new employee is added. However, the current system I use is using plain text password to login to cPanel, and I was wondering, can I upgrade this? Since it's a commercial system, I'd have to store password in a table, in plain text, which is something I'd rather not do.
I've attached the api file (too long to list here). Here's an example of code that uses it:
.vB Thank you and have a nice day!
$ip = $_SERVER['SERVER_ADDR">;
$root_pass = $cpp; // Grabbed from database, stored in plain text
$account = $cpu; // Grabbed from database, stored in plain text
$email_user = $username;
$email_password = $rand ;
$email_domain = $domain;
$email_quota = 'Unlimited';
$xmlapi = new xmlapi($ip);
$xmlapi->set_port(2083);/* the ssl port for cpanel */
$xmlapi->password_auth($account,$root_pass);
$xmlapi->set_output('json');
$xmlapi->set_debug(1);
print $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_quota, $email_domain) );
$wm = $username . "@" . $domain;
.vB Thank you and have a nice day!
-
Hello :) You can write your script so that it includes an access hash, or "key," in the HTTP header that it sends to the server when it calls the API function. However, note that this is only available to WHM users. Documentation on this is available at: API Authentication Thank you. 0 -
[quote="cPanelMichael, post: 1463591">Hello :) You can write your script so that it includes an access hash, or "key," in the HTTP header that it sends to the server when it calls the API function. However, note that this is only available to WHM users. Documentation on this is available at: API Authentication Thank you.
Thank you! Just a quick one, if someone is using hosting package such as godaddy or similar, I suppose they don't have WHM access? I'm trying to make this work on widest range of hostings as possible, and from what I understand, goddady hosted sites have their own type of cpanel? Thanks again!0 -
[quote="Loldawg, post: 1463822">Just a quick one, if someone is using hosting package such as godaddy or similar, I suppose they don't have WHM access? I'm trying to make this work on widest range of hostings as possible, and from what I understand, goddady hosted sites have their own type of cpanel?
I presume hosting companies such as GoDaddy offer Web Host Manager if they have plans for resellers, virtual private servers, or dedicated servers with cPanel. Thank you.0
Please sign in to leave a comment.
Comments
3 comments