Child pages
  • WHM API 1 Functions - reset_service_ssl_certificate
Skip to end of metadata
Go to start of metadata

Description

This function regenerates a self-signed SSL certificate and assigns it to a service.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/reset_service_ssl_certificate?api.version=1&service=exim
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/reset_service_ssl_certificate?api.version=1&service=exim
 Command Line
whmapi1 reset_service_ssl_certificate service=exim


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/api/whmapi1

 Output (JSON)
 {  
   "data":{  
      "certificate":"-----BEGIN CERTIFICATE-----\nMIIDWzCCAkOgAwIBAgIFAiil8fgwDQYJKoZIhvcNAQELBQAwRjEcMBoGA1UEAwwT\ndm01LmRvY3MuY3BhbmVsLm5ldDEmMCQGCSqGSIb3DQEJARYXc3NsQHZtNS5kb2Nz\nLmNwYW5lbC5uZXQwHhcNMTQxMTI0MTg0NDE5WhcNMTUxMTI0MTg0NDE5WjBGMRww\nGgYDVQQDDBN2bTUuZG9jcy5jcGFuZWwubmV0MSYwJAYJKoZIhvcNAQkBFhdzc2xA\ndm01LmRvY3MuY3BhbmVsLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC\nggEBAKYsBFQaqfz9ggP2uw+Vm4196hDlgZtx/A7cN7ktDkCzztxpQ1Us6zty0DPB\nKm6aMhi8tvfO1/DU8+L2ybmgXXmAvhMjEdBYtiMd7rUVAo4zuPOzwABJzfTq46Wk\ntQiuT9TZ+051ixFLRyz58ke0jAqqQugeZK1d5q1m82lUow3LU3oPhtYiR31ROU4g\nHt1/p+okMf3T21Bl6lLXQf8EVwUL8c0zrRsLYlhIFGyedaVqoZ47anGFc0U0ZJzw\nBOXnmxbYZY+pExXiNZpxTjUDKgtLvY8CjrHjNgVXSL9S7J8Src4/l7SvKoRjnAit\nKsMh6d/nTC4bukX5FGBph9anoFcCAwEAAaNQME4wHQYDVR0OBBYEFDBzN9RDgdnH\nHx5x7iUeBDX8qQ3yMB8GA1UdIwQYMBaAFDBzN9RDgdnHHx5x7iUeBDX8qQ3yMAwG\nA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBACYT6VSDfRxsGIzzoYMlIN9K\nd1pfDqFVFKZecI9M+fc0iAnYYRm5VUpItw5fAoMbrjCL4XMZKImSmkAWc4m9cCDs\nWT4rSEE/Fhv3dUjI3Hg7CFoxwU+Ke+yORsPNCv/9lDjReh9pU120UIttOa1lu9NN\nkT8QcUN0+NAvhj6MTm87VsQBNEpQhddyPuOmtga/zf8HTOcvtbeoRTueVNa4yNvP\n3UI6FLwNWNebzgm5zunahY7svqrTbKkNbQbIFqHrhSZdY5i7+I7Lgi9hfri7nDDk\nl6Dv+Ntm0LKWJNEKuZ8I+QVuJiFIFqF/8Gsqc/8pDuJF3b7UchyqGCXJhnExBR4=\n-----END CERTIFICATE-----",
      "certificate_info":{  
         "is_self_signed":1,
         "validation_type":"dv",
         "signature_algorithm":"sha256WithRSAEncryption",
         "issuer.organizationName":null,
         "modulus":"a62c04541aa9fcfd8203f6bb0f959b8d7dea10e5819b71fc0edc37b92d0e40b3cedc6943552ceb3b72d033c12a6e9a3218bcb6f7ced7f0d4f3e2f6c9b9a05d7980be132311d058b6231deeb515028e33b8f3b3c00049cdf4eae3a5a4b508ae4fd4d9fb4e758b114b472cf9f247b48c0aaa42e81e64ad5de6ad66f36954a30dcb537a0f86d622477d51394e201edd7fa7ea2431fdd3db5065ea52d741ff0457050bf1cd33ad1b0b625848146c9e75a56aa19e3b6a7185734534649cf004e5e79b16d8658fa91315e2359a714e35032a0b4bbd8f028eb1e336055748bf52ec9f12adce3f97b4af2a84639c08ad2ac321e9dfe74c2e1bba45f914606987d6a7a057",
         "not_before":1416854659,
         "modulus_length":2048,
         "not_after":1448390659,
         "domains":[  
            "hostname.example.com"
         ],
         "issuer.commonName":"hostname.example.com",
         "issuer_text":"commonName\nhostname.example.com\nemailAddress\nssl@hostname.example.com"
      },
      "service":"cpanel"
   },
   "metadata":{  
      "version":1,
      "reason":"OK",
      "result":"1",
      "command":"reset_service_ssl_certificate"
   }
}
 Output (XML)
<result>
    <data>
        <certificate>-----BEGIN CERTIFICATE-----
MIIDWzCCAkOgAwIBAgIFAjhxFK8wDQYJKoZIhvcNAQELBQAwRjEcMBoGA1UEAwwT
dm01LmRvY3MuY3BhbmVsLm5ldDEmMCQGCSqGSIb3DQEJARYXc3NsQHZtNS5kb2Nz
LmNwYW5lbC5uZXQwHhcNMTQxMTI0MTg0NTM5WhcNMTUxMTI0MTg0NTM5WjBGMRww
GgYDVQQDDBN2bTUuZG9jcy5jcGFuZWwubmV0MSYwJAYJKoZIhvcNAQkBFhdzc2xA
dm01LmRvY3MuY3BhbmVsLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAMlPbBG+Jy566VRMfNuSz+S1gZdx7Om7mZK5yOVWWZmj8NDyXGtc7XxEHHi0
7/fu4RkCer2h1vxDim7sOdI71eTQmOGGjYdV+tNsPM85qv5oOmA4W6Vpc3YqfZu+
reDRjRRtZVflxreiuVQWk9ODJ625CRQ2K5XXENP9J4wkaI0gPGthr7ui+qSf0VD+
pY8oD5tOo/ZpvI7adQBaGIj1p7zFJGsHyHIJgXwK9sXan3Hx7vvSYpK3p5f5fS56
8Q8A466rAO7y3ykgaM5SJXrPqxGTdpW1HCW9uzVS4tpKHC9SwZkeJJrItUPs4Vmm
Vaq/fS3L/R51fePC6OmCItK710kCAwEAAaNQME4wHQYDVR0OBBYEFA7X5m8wHFUH
rdw4N5iQWGXrCfIIMB8GA1UdIwQYMBaAFA7X5m8wHFUHrdw4N5iQWGXrCfIIMAwG
A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAAa0ahtqUWifgydpggAFZXB0
1uJnokLpyWJizVrr7kz1CJg3Ogq8sD/EKiL1TaGWvio2vP/DH2rpghVTBVf/cSIc
7hAZkigVVmRTLRr7Vme2bZxk5Y4xzNhzN+w65FcEjBuO7qbVKSreiER+bTqEQDHt
0oMjwTK5tUM0RyFfQE8TGsc/v8SAFJGMvrHPl/0KL4ERzGoYhoKre3wK6ebcO9DM
+INw0xNX3wJc5eX2rZP5F2VyvzRDhb/ij65J+9/6meC/gqY1PS4UFrtasR3d8g1M
6668wcs2PBNHOblwH5aiZdt1Taeql60TiccjPYJfKzlDtIUBXQ1fNmJ3APvKjuo=
-----END CERTIFICATE-----</certificate>
        <certificate_info>
            <is_self_signed>1</is_self_signed>
            <validation_type>dv</validation_type>
            <signature_algorithm>sha256WithRSAEncryption</signature_algorithm>
            <issuer.organizationName/>
            <modulus>c94f6c11be272e7ae9544c7cdb92cfe4b5819771ece9bb9992b9c8e5565999a3f0d0f25c6b5ced7c441c78b4eff7eee119027abda1d6fc438a6eec39d23bd5e4d098e1868d8755fad36c3ccf39aafe683a60385ba56973762a7d9bbeade0d18d146d6557e5c6b7a2b9541693d38327adb90914362b95d710d3fd278c24688d203c6b61afbba2faa49fd150fea58f280f9b4ea3f669bc8eda75005a1888f5a7bcc5246b07c87209817c0af6c5da9f71f1eefbd26292b7a797f97d2e7af10f00e3aeab00eef2df292068ce52257acfab11937695b51c25bdbb3552e2da4a1c2f52c1991e249ac8b543ece159a655aabf7d2dcbfd1e757de3c2e8e98222d2bbd749</modulus>
            <not_before>1416854739</not_before>
            <modulus_length>2048</modulus_length>
            <not_after>1448390739</not_after>
            <domains>hostname.example.com</domains>
            <issuer.commonName>hostname.example.com</issuer.commonName>
            <issuer_text>commonName
hostname.example.com
emailAddress
ssl@hostname.example.com</issuer_text>
        </certificate_info>
        <service>cpanel</service>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>reset_service_ssl_certificate</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

  

Parameters

ParameterTypeDescriptionTypeExample
servicestring

Required

The service.

  • ftp
  • exim
  • dovecot
  • cpanel
  • courier

    Warnings:

    • We removed the Courier mail server in cPanel & WHM version 54. The Courier mail server only exists for cPanel & WHM version 11.52 and earlier.
    • If you pass the courier value to this parameter on a cPanel & WHM version 54 server, the system returns the following message:

      courier is not a known service.
cpanel

 

Returns 

ReturnTypeDescriptionPossible valuesExample
certificatestringThe SSL certificate's contents.A valid certificate file in Base64 PEM format.
 Click to view...

-----BEGIN CERTIFICATE-----\nMIIECjCCAvKgAwIBAgIEW7p6xzANBgkqhkiG9w0BAQUFADCBnTELMAkGA1UEBhMC\n

VVMxEDAOBgNVBAgMB1Vua25vd24xEDAOBgNVBAcMB1Vua25vd24xEDAOBgNVBAoM\n
B1Vua25vd24xEDAOBgNVBAsMB1Vua25vd24xHTAbBgNVBAMMFGphc29uLmRldi5j\n
cGFuZWwubmV0MScwJQYJKoZIhvcNAQkBFhhzc2xAamFzb24uZGV2LmNwYW5lbC5u\n
ZXQwHhcNMTMwNDI5MjEwNDU5WhcNMTQwNDI5MjEwNDU5WjCBnTELMAkGA1UEBhMC\n
VVMxEDAOBgNVBAgMB1Vua25vd24xEDAOBgNVBAcMB1Vua25vd24xEDAOBgNVBAoM\n
B1Vua25vd24xEDAOBgNVBAsMB1Vua25vd24xHTAbBgNVBAMMFGphc29uLmRldi5j\n
cGFuZWwubmV0MScwJQYJKoZIhvcNAQkBFhhzc2xAamFzb24uZGV2LmNwYW5lbC5u\n
ZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmc8Oxc0RmSzX4eR9W\n
LTrqa/TY+qOuP8ClGTgP1FOWSjZnfDTUhnfst/XtA13wJvXw+Pv+IXReUtrx87nl\n
jHPwuu/bcJMg4iAufQUlCwUaWbMP8f7yLYPXFAwcgc6jFKCJDOjSImeZhyGBxYp0\n
AWx6qiz/WscrV1zs3o8wSqVyouoD2LFzq3bG6M2539DageERnO/UuLTb++DkbH8e\n
4v6LX9VQTljMvA0TtPpB7Mnr0Nq+HR/sXHJPdIFn58BVPpl/m3frNqvOcJc/Bt8V\n
F0jUG3WN4+/Xr6byRkoVR/X/FYRp2W4ki+Rk357aDnzoVKiTMqLBJ4sXxCU2ipYE\n
9FTbAgMBAAGjUDBOMB0GA1UdDgQWBBSiMwrIK+JMVx8ufKnfByp3V+ycoTAfBgNV\n
HSMEGDAWgBSiMwrIK+JMVx8ufKnfByp3V+ycoTAMBgNVHRMEBTADAQH/MA0GCSqG\n
SIb3DQEBBQUAA4IBAQAdL/oywZw+EMwNGf/e1JqjXull/fgoNMZHxsBwQb2smZuN\n
KoTlkf2zDO7yTTIUnrBP1TveIlAejDLMMR7yqVgmDrVM/pl4WQjL/APbrWGExsE8\n
JeEu+DjOIEveOVTTXCwaVo8ck2JO3QWZwPeRUZBwifZOfaYa8gwpdcUy8Tu/HX9T\n
xsOLv/vQar8JC4Obh5eFrMBp87Obf1m/2Kmpaj9PGQQiiq+HU3r4dZf24bLGESr/\n
vPXIfInwZ0Fr4G+OzwDqPgI9nCm13myZ+ZBybL64pp741ReRP1dHQGYnwtht/Dh4\n
/vFZEL9Wv/18E4lUCJjMgBIknjWkyt6FtygmB1DS\n-----END CERTIFICATE-----

 

certificate_infohashA hash of certificate information data.This hash contains the is_self_signed, issuer.organizationName, modulus, not_before, modulus_length, not_after, domains, issuer.commonNamesignature_algorithm, validation_type, and issuer_text returns.

 

 

is_self_signed

Boolean

This value indicates whether the certificate is a self-signed certificate.

The function returns this value in the certificate_info hash.

  • 1 — Self-signed.
  • 0 — Not self-signed.
 1

signature_algorithm


 
string

The signature algorithm of the certificate.

Note:

We introduced this return in cPanel & WHM version 56.

The function returns this value in the certificate_info hash.

A valid OID hash algorithm name.
sha256WithRSAEncryption

validation_type

string

The certificate's validation type.

Note:

We introduced this return in cPanel & WHM version 56.

The function returns this value in the certificate_info hash.

  • ev — Extended Validation.
  • ov — Organization Validation.
  • dv — Domain Validation.
  • undef — The system could not parse and determine the certificate's validation type.
dv

issuer.organizationName

string

The organization that generated the certificate.

The function returns this value in the certificate_info hash.

A string value.Writer's Guild of America

modulus

string

The certificate's modulus information.

The function returns this value in the certificate_info hash.

A string value.
 Click to view...

a673c3b17344664b35f8791

f562d3aea6bf4d8faa3ae3fc0a519380fd453964a36677c34d48677ecb7f5ed035df026f5f0f8fbfe21745e52daf1f3b9e58c73f0baefdb709320e2202e7d05250b051a59b30ff1fef22d83d7140c1c81cea314a0890ce8d2226799872181c58a74016c7aaa2cff5ac72b575cecde8f304aa572a2ea03d8b173ab76c6e8cdb9dfd0da81e1119cefd4b8b4dbfbe0e46c7f1ee2fe8b5fd5504e58ccbc0d13b4fa41ecc9ebd0dabe1d1fec5c724f748167e7c0553e997f9b77eb36abce70973f06df151748d41b758de3efd7afa6f2464a1547f5ff158469d96e248be464df9eda0e7ce854a89332a2c1278b17c425368a9604f454db

not_before

integer

The certificate's validation date, in Unix format.

The function returns this value in the certificate_info hash.

A date in Unix time format. 1367269499

modulus_length

integer

The length of the certificate's modulus, in bits.

The function returns this value in the certificate_info hash.

An integer value.2048

not_after

integer

When the certificate expires, in Unix format.

The function returns this value in the certificate_info hash.

A date in Unix time format.1398805499

domains

array

The domains that correspond to the certificate.

The function returns this value in the certificate_info hash.

A list of valid domains on the server.example.com

issuer.commonName

string

The common name of the organization that issued the certificate.

The function returns this value in the certificate_info hash.

A valid domain.example.com

issuer_text

string

Information about the issuer.

The function returns this value in the certificate_info hash.

 A string value.
 Click to view...

countryName\nUS\nstateOrProvinceName\nUnknown\nlocalityName\nUnknown\norganizationName\nUnknown

\norganizationalUnitName\nUnknown\ncommonName\nexample.com\nemailAddress\ntest@example.com

service

stringThe service that the certificate corresponds to.
  • ftp
  • exim
  • dovecot
  • cpanel
  • courier

    Warning:

    We removed the Courier mail server in cPanel & WHM version 54. The Courier mail server only exists for cPanel & WHM version 11.52 and earlier.

ftp