cPanel/KnownHosts
cPanel module

KnownHosts

4 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="KnownHosts", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

create GET#

Create host

This function registers a host in the cPanel account's /home/user/.ssh/known_hosts file.

host_namemixedRequired
The hostname or IP address to add.
portintegerOptional
The SSH port to use, if the system uses a non-standard SSH port.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

hostarray<object>
An array of objects containing information for the host.
hostany
The hostname or IP address.
keystring
The host's key.
linestring
The host's entry in the /home/user/.ssh/known_hosts file, where user is the cPanel account username.
metaobject
An object containing metadata about the host's public key.
algorithmstring
The key's algorithm.
bodystring
The host's public key.
md5string
The key's MD5 fingerprint.
md5-printablestring
A human-readable version of the key's MD5 fingerprint.
sha256string
The key's SHA-256 fingerprint.
sha256-printablestring
A human-readable version of the key's SHA-256 fingerprint.

delete GET#

Delete host

This function removes a host from the cPanel account's /home/user/.ssh/known_hosts file.

host_namemixedRequired
The hostname or IP address of the host to delete.
portintegerOptional
The SSH port to use.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

update GET#

Update host in the known_hosts file

This function updates a host's entry in the cPanel account's /home/user/.ssh/known_hosts file.

host_namemixedRequired
The host to update.
portintegerOptional
The SSH port to use.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

hostarray<object>
An array of objects containing the host's information.
hostany
The updated host and its associated key value.
keystring
The host's key.
linestring
The host's entry in the /home/user/.ssh/known_hosts file, where user is the cPanel account username. A valid entry that includes the hostname or IP address, the key's algorithm, and the public key.
metaobject
An object containing metadata about the host's public key.
algorithmstring
The key's algorithm.
bodystring
The host's public key.
md5string
The key's MD5 fingerprint.
md5-printablestring
A human-readable version of the key's MD5 fingerprint.
sha256string
The key's SHA-256 fingerprint.
sha256-printablestring
human-readable version of the key's SHA-256 fingerprint.

verify GET#

Validate host

This function checks whether a host's public key exists in the cPanel account's /home/user/.ssh/known_hosts file.

host_namemixedRequired
The host to query.
portintegerOptional
The SSH port to use.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

errorsarray<string>
An array of errors that the system generated.
failure_typestring
The reason why the system will register the hostname. new — The host does not already exist. changed — The host's information has changed.
One of: new changed
hostarray<object>
An array of objects that contain information about the host.
hostany
The hostname or IP address.
keystring
The host's key.
linestring
The host's entry in the /home/user/.ssh/known_hosts file, where user is the cPanel account username.
metaobject
An object that contains information about the host's public key.
algorithmstring
The key's algorithm.
bodystring
The host's public key. public key.
md5string
The key's MD5 fingerprint.
md5-printablestring
A human-readable version of the key's MD5 fingerprint.
sha256string
The key's SHA-256 fingerprint.
sha256-printablestring
A human-readable version of the key's SHA-256 fingerprint.
statusinteger
Whether the host already exists in the /home/user/.ssh/known_hosts file, where user is the cPanel account username. 1 — Exists. 0 — The host does not already exist, or the system must re-register the hostname.
One of: 0 1