Description

This function lists the server's virtual hosts and their installed SSL certificates.

Examples


https://hostname.example.com:2087/cpsess##########/json-api/fetch_ssl_vhosts?api.version=1
https://hostname.example.com:2087/cpsess##########/xml-api/fetch_ssl_vhosts?api.version=1
whmapi1 fetch_ssl_vhosts

{
  "data": {
    "vhosts": [
      {
        "iptype": "dedicated",
        "needs_sni": 0,
        "ip": "192.168.0.20",
        "domains": [
          "example.com"
        ],
        "servername": "example.com",
        "docroot": "/home/example/public_html",
        "user": "example",
        "crt": {
          "owner": {
            "example": null
          },
          "is_self_signed": "1",
          "validation_type":"dv",
          "signature_algorithm":"sha256WithRSAEncryption",
          "issuer.organizationName": "cPanel Inc.",
          "modulus":
 
"e353aa25cc8ad05d3225611e4410c0270c11b2d46f88705d3d179a23102ab24ee167c1a9070b9f554e83bade1b84256e11c5a0cb2ac96b96f28e802b11c721d73fbfe61dd9839974a6fce4e17915c0fbf885056f18656041cf70db460b22cab5fd2502491e4ab9f0d2cb727480e0ebd62e83870acda31bfa2d4625efd82234f9729f351ea02fb162609c1654c11b5dec468539a3bb83073a85f78bcf577cd8b718501145cccd89d7adb0bb18c872e7303a15e2c75a6ab315c7fa099e4351a4f0ff126c2693f71d9f21d9f798b94bb689277083fea8dcc01b6af268d0ad8b7a481f8a179d07639cdf3290c93723937a767c400a8ce4b1ca19f0a7117084d5bc13",
          "subject.commonName": "example.com",
          "not_before": "1376497388",
          "modulus_length": "2048",
          "not_after": "1408033388",
          "created": "1376498495",
          "domains": [
            "example.com"
          ],
          "issuer.commonName": "example.com",
          "id": "example_com_e353a_5bc13_1408033388_9a1d40aff655f98fed7206e5af466065",
          "issuer_text":
 
"commonName\nexample.com\ncountryName\nUS\nemailAddress\nusername@example.com\norganizationName\ncPanel
 Inc.\nstateOrProvinceName\nTexas\nlocalityName\nHouston"
        },
        "is_primary_on_ip": 1
      }
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "fetch_ssl_vhosts"
  }
}
<result>
    <data>
        <vhosts>
            <iptype>dedicated</iptype>
            <needs_sni>0</needs_sni>
            <ip>192.168.0.20</ip>
            <domains>example.com</domains>
            <servername>example.com</servername>
            <docroot>/home/example/public_html</docroot>
            <user>example</user>
            <crt>
                <owner>
                    <example/>
                </owner>
                <is_self_signed>1</is_self_signed>
                <validation_type>dv</validation_type>
                <signature_algorithm>sha256WithRSAEncryption</signature_algorithm>
                <issuer.organizationName>cPanel Inc.</issuer.organizationName>
                <modulus>
                    e353aa25cc8ad05d3225611e4410c0270c11b2d46f88705d3d179a23102ab24ee167c1a9070b9f554e83bade1b84256e11c5a0cb2ac96b96f28e802b11c721d73fbfe61dd9839974a6fce4e17915c0fbf885056f18656041cf70db460b22cab5fd2502491e4ab9f0d2cb727480e0ebd62e83870acda31bfa2d4625efd82234f9729f351ea02fb162609c1654c11b5dec468539a3bb83073a85f78bcf577cd8b718501145cccd89d7adb0bb18c872e7303a15e2c75a6ab315c7fa099e4351a4f0ff126c2693f71d9f21d9f798b94bb689277083fea8dcc01b6af268d0ad8b7a481f8a179d07639cdf3290c93723937a767c400a8ce4b1ca19f0a7117084d5bc13
                </modulus>
                <subject.commonName>example.com</subject.commonName>
                <not_before>1376497388</not_before>
                <modulus_length>2048</modulus_length>
                <not_after>1408033388</not_after>
                <created>1376498495</created>
                <domains>example.com</domains>
                <issuer.commonName>example.com</issuer.commonName>
                <id>
                    example1_com_e353a_5bc13_1408033388_9a1d40aff655f98fed7206e5af466065
                </id>
                <issuer_text>
                    commonName
 example.com countryName US emailAddress username@example.com 
organizationName cPanel Inc. stateOrProvinceName Texas localityName 
Houston
                </issuer_text>
            </crt>
            <is_primary_on_ip>1</is_primary_on_ip>
        </vhosts>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>fetch_ssl_vhosts</command>
    </metadata>
</result>

   

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
vhostshashA hash of the virtual host information.

This hash includes the iptype, needs_sni, ip, servername, docroot, and is_primary_on_ip returns, the domain array, and the crt hash.

 

iptype

string

The type of IP address.

The function returns this value in the vhosts hash.

  • shared
  • dedicated
dedicated

needs_sni

Boolean

Whether the virtual host requires SNI to function properly for SSL certificates.

The function returns this value in the vhosts hash.

  • 1 — Requires SNI.
  • 0 — Does not require SNI.
0

ip

string

The virtual host's IP address.

The function returns this value in the vhosts hash.

A valid IP address.192.168.0.20

domains

array

The virtual host's domains.

The function returns this array in the vhosts hash.

A list of valid domain names.
example.com

servername

string

The virtual host's primary domain.

The function returns this value in the vhosts hash.

A valid domain name.
example.com

docroot

string

The primary domain's document root.

The function returns this value in the vhosts hash.

A valid absolute directory path.
/home/example/public_html

user

string

The virtual host's user.

The function returns this value in the vhosts hash.

A valid username.
example

crt

hash

A hash of the certificate information.

The function returns this hash in the vhosts hash.

This hash includes the is_self_signed, signature_algorithm, validation_type, issuer.organizationNamemodulus, subject.commonName, not_before, modulus_length, not_after, created, issuer.commonName, id, and issuer_text returns, the domains array, and the owner hash. 

owner

hash

A hash of the certificate's owner information.

The function returns this hash in the crt hash.

This hash includes a return with the owner's name. 

is_self_signed

Boolean

Whether the certificate is self-signed.

The function returns this value in the crt hash.

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

signature_algorithm

string

The signature algorithm of the certificate.

We introduced this return in cPanel & WHM version 56.

The function returns this value in the crt hash.

A valid OID hash algorithm name.
sha256WithRSAEncryption

validation_type

string

The certificate's validation type.

We introduced this return in cPanel & WHM version 56.

The function returns this value in the crt 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 issued the certificate.

The function returns this value in the crt hash.

A valid string.
cPanel Inc.

modulus

string

The certificate's modulus.

The function returns this value in the crt hash.

A valid string.

 e353aa25cc8ad05d3225611e4410c0270c11b2d46f88705d3d179a23102ab24ee167c1a9070b9f554e83bade1b84256e11c5a0cb2ac96b96f28e802b11c721d73fbfe61dd9839974a6fce4e17915c0fbf885056f18656041cf70db460b22cab5fd2502491e4ab9f0d2cb727480e0ebd62e83870acda31bfa2d4625efd82234f9729f351ea02fb162609c1654c11b5dec468539a3bb83073a85f78bcf577cd8b718501145cccd89d7adb0bb18c872e7303a15e2c75a6ab315c7fa099e4351a4f0ff126c2693f71d9f21d9f798b94bb689277083fea8dcc01b6af268d0ad8b7a481f8a179d07639cdf3290c93723937a767c400a8ce4b1ca19f0a7117084d5bc13

subject.commonName

string

The certificate's Common Name.

The function returns this value in the crt hash.

A valid string.
example.com

not_before

string

When the certificate became active.

The function returns this value in the crt hash.

A valid date in Unix time format.
1376497388

modulus_length

integer

The certificate's modulus length.

The function returns this value in the crt hash.

A positive integer.2048

not_after

integer

When the certificate expires.

The function returns this value in the crt hash.

A valid date in Unix time format.
1376497388

created

integer

When the certificate was created.

The function returns this value in the crt hash.

A valid date in Unix time format.
1376498495

domains

array

The certificate's associated domains.

The function returns this array in the crt hash.

A valid domain name.
example.com

issuer.commonName

string

The certificate's issuer.

The function returns this value in the crt hash.

A valid string, usually a domain.
example.com

id

string

The certificate's ID.

The function returns this value in the crt hash.

A valid string.

example1_com_e353a_5bc13_1408033388_9a1d40aff655f98fed7206e5af466065

issuer_text

string

The full text of issuer information.

The function returns this value in the crt hash.

A valid string.

 commonName\nexample.com\ncountryName\nUS\nemailAddress\nusername@example.com\norganizationName\ncPanel Inc.\nstateOrProvinceName\nTexas\nlocalityName\nHouston

is_primary_on_ip

Boolean

Whether the certificate's domain is the IP address's primary domain.

The function returns this value in the vhosts hash.

  • 1 — Primary domain.
  • 0Not the primary domain.
1