Lets Encrypt SSL API Error 10

I tried to install letsencrypt ssl via API and I’m getting Error code 10 which is: E_FORBIDEN Object cannot be accessed by this user

I’m I missing something here?

`function hestia_InstallSsl($params)
{

if ($params["server"] == 1) {
    
    $postvars = array(
        'hash' => $params["serveraccesshash"],
        'returncode' => 'yes',
        'cmd' => 'v-add-letsencrypt-domain',
        'arg1' => $params["username"],
        'arg2' => $params["domain"],
        'arg3' => "'",
        'arg4' => 'yes',
    );
    $postdata = http_build_query($postvars);

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, 'https://' . $params["serverhostname"] . ':' . $params["serverport"] . '/api/');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
    $answer = curl_exec($curl);
}

logModuleCall('hestia', 'InstallSSL', 'https://' . $params["serverhostname"] . ':' . $params["serverport"] . '/api/' . $postdata, $answer);

if ($answer == 0) {
    $result = "success";
} else {
    $result = $answer;
}

return $result;

}`

Function v-add-letsencrypt-domain is probally not whitelisted for the user under the access keys

The access keys belongs to admin.
Guess it won’t work?

Is v-add-letsencrypt-domain on the allowed list?

image_2024-06-07_120323232

This is the list of permissions in the account. Is there a way to add more permissions?

Yes, you can add your own permissions set or modify an existing one like billing and edit the file to add the command or commands you need.

The files are here:

/usr/local/hestia/data/api/
1 Like

Worked!
Thanks

2 Likes