Manage Service SSL Certificates via Command Line

Loth

Member
Oct 28, 2015
7
0
1
AZ
cPanel Access Level
DataCenter Provider
Hello :)

Yes, you can utilize WHM API 1 to install a service SSL certificate via the command line:

WHM API 1 Functions - install_service_ssl_certificate - Software Development Kit - cPanel Documentation

Thank you.
Hello, I am getting the following error when I try out the CLI API

root@localhost [~]# whmapi1 accountsummary user=root
Undefined subroutine &Encode::define_alias called at /usr/local/cpanel/3rdparty/perl/514/lib64/perl5/cpanel_lib/XML/SAX/PurePerl/UnicodeExt.pm line 15.
Compilation failed in require at /usr/local/cpanel/3rdparty/perl/514/lib64/perl5/cpanel_lib/XML/SAX/PurePerl.pm line 27.
Compilation failed in require at (eval 1) line 1.

I've tried to install it via /scripts/perlinstaller XML::SAX::PurePerl::UnicodeExt however it seems its not found, XML::SAX is installed and updated.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
root@localhost [~]# whmapi1 accountsummary user=root
Undefined subroutine &Encode::define_alias called at /usr/local/cpanel/3rdparty/perl/514/lib64/perl5/cpanel_lib/XML/SAX/PurePerl/UnicodeExt.pm line 15.
Which version of cPanel is installed on this system? Also, are you able to reproduce the issue with a valid username (root is not a cPanel account).

Thank you.
 

Loth

Member
Oct 28, 2015
7
0
1
AZ
cPanel Access Level
DataCenter Provider
Which version of cPanel is installed on this system? Also, are you able to reproduce the issue with a valid username (root is not a cPanel account).

Thank you.
Hello, It seems it works with root after its updated and running, however I am getting an error with my certificate. What format does it need to be input as?

root@cpanel-test [~]# whmapi1 install_service_ssl_certificate service=ftp crt="-----BEGIN CERTIFICATE-----\n MIIFZzCCBE+g...."

metadata:
command: install_service_ssl_certificate
reason: "Invalid certificate passed to verifysslcert (missing BEGIN CERTIFICATE)\n"
result: 0
version: 1

Secondly, can multiple services be input or only one at a time?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Please install the certificate on one service at a time. There's actually a script on the following thread you can utilize:

[How-To] Installing SSL from Let's Encrypt

Note that it's for a different purpose, but the installation script should work after you modify it for a service SSL installation.

Thank you.
 
Jan 14, 2019
6
3
3
Brazil
cPanel Access Level
Root Administrator
Hello!

Maybe this can help you:
Manage AutoSSL

You can execute AutoSSL from command line:


Code:
/usr/local/cpanel/bin/autossl_check
Options:
Option​
Description​
Example​
--user​
Perform an AutoSSL check for a specific user.​
--user=username​
--all​
Perform an AutoSSL check for all users.​
--all​
--help​
Display the script’s help information.​
--help​

Example of use:
Code:
/usr/local/cpanel/bin/autossl_check --all
This will create SSL to your domains.
 
Last edited:
  • Like
Reactions: cPRex