Create SSL Certificate via API failed

imohsen

Verified User
Joined
Oct 30, 2011
Messages
7
Hi
i'v been trying to create ssl cert via API but it's trigger error in directadmin error log
i tried all default values in creating certificate form but it's failed .
here is error :

Code:
2022:02:19-16:13:02: Ssl::getKeyBit: Error checking for key bit size:
2022:02:19-16:21:46: Ssl::getKeyBit: Error checking for key bit size:
2022:02:19-16:22:10: Ssl::getKeyBit: Error checking for key bit size:
2022:02:19-16:22:43: Ssl::getKeyBit: Error checking for key bit size:

here is the php code :

PHP:
$ssl_opts = array(
            'action' => 'save',
            'domain' => $newdomain,
            'type' => 'create',
            'request' => 'letsencrypt',
            'name' => 'www.' . $newdomain,
            'email' => '[email protected]',
            'keysize' => '4096',
            'encryption' => 'sha256',
            'le_select0' => $newdomain,
            'le_select1' => 'www.' . $newdomain
            );


        $ssl_result = $da->query("CMD_API_SSL", $ssl_opts );
        var_dump($ssl_result);
return this :

PHP:
array(5) {
  ["certificate"]=>
  string(0) ""
  ["force_ssl"]=>
  string(2) "no"
  ["key"]=>
  string(0) ""
  ["server"]=>
  string(3) "yes"
  ["ssl_on"]=>
  string(3) "yes"
}
 
did anyone face this issue when using API to create SSL Certificates ?
 
I'v been deep down to Directadmin and tried to run debug code 20000 to see any details .
found out that CMD_API_SSL tried to read user key file in /data/users/username/domain/mydomain.com.key but there is no key file in there because i tried to create with letsencrypt and the request mode will create key file automatically but API does not create that .

is there any action to create key file of user before issue certificate ?


Code:
Program Sub Location: getlock(./data/admin/ips/x.x.x.x, 'ConfigFile::readFile') : start
Program Sub Location: getlock(./data/admin/ips/x.x.x.x, 'ConfigFile::readFile') : finished
Program Sub Location: getlock(./data/admin/ips/x.x.x.x, 'ConfigFile::readFile') : start
Program Sub Location: getlock(./data/admin/ips/x.x.x.x, 'ConfigFile::readFile') : finished
InternalText::load:ssl: reload=0 reload_index=-1
InternalText::load:ssl:: reading in ./data/skins/enhanced/lang/en/internal/ssl.txt
InternalText::init(ssl)
executeAsUser('/usr/bin/openssl rsa -noout -text < /usr/local/directadmin/data/users/[USERNAME]/domains/[MYDOMAIN].key 2>&1', 112, diradmin, 1, '(null)', int *child_pid, *snd, group=(null)) uid=114 gid=122
Ssl::getKeyBit: Error checking for key bit size:
 
Back
Top