I'm working on a website where users can add a domain name to their project. By doing this the domain is added as domainpointer to my Direct Admin account. I do this using the Direct Admin Api.
This all works great but this new domain is not added to the SSL certificate automatically. And I have to click the renew button by hand to make this happen.
I want to do this renewal programmatically but I'm stuck. I first tried adding a new SSL certificate like this:
$sock->query('/CMD_API_SSL',
array(
'domain' => $domain,
'action' => 'save',
'type' => 'create',
'request' => 'letsencrypt',
'name' => $domain,
'keysize' => 'secp384r1',
'encryption' => 'SHA256',
'le_select0' => $domain,
'le_select1' => 'www.' . $domain,
'submit' => 'save'
));
$result = $sock->fetch_body();
}
But this doesn't seem the right way, looking at the renew
button in Direct Admin I saw that there is a Let's Encrypt Plugin used for renewing the SSL certificate.
I tried to call this by doing:
$sock->set_method('POST');
$sock->query('/CMD_PLUGINS/letsencrypt/renew.html',
array(
'domain' => $domain,
));
But this doesn't work either, the SSL certificate is not renewed. As result I get a page saying 'I cant find an e-mailadress, contact support'.
Does anyone know how I can get this to work? Thanks in advance.