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

[email protected] [~]# 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,910
2,213
363
[email protected] [~]# 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?

[email protected] [~]# 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,910
2,213
363
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.