Server

class cloudpassage.Server(session, **kwargs)

Initializing the Server class:

Parameters:session (cloudpassage.HaloSession) – This will define how you interact with the Halo API, including proxy settings and API keys used for authentication.
Keyword Arguments:
 endpoint_version (int) – Endpoint version override.
Supported keyword args for filtering Server.list_all():
state (list or str): A list or comma-separated string containing
any of these: active, missing, deactivated. By default, only active servers will be returned.
platform (list or str): A list or comma-separated string containing
any of these: windows, debian, ubuntu, centos, oracle, rhel.

cve (str): CVE ID. Example: CVE-2015-1234 kb (str): Search for presence of KB. Example: kb=”KB2485376” missing_kb (str): Search for absence of KB. Example:

mising_kb=”KB2485376”
assign_group(server_id, group_id)

Moves server to another group.

Parameters:
  • server_id (str) – Target server’s ID
  • group_id (str) – ID of group to move server to.
Returns:

True if successful, throws exceptions if it fails.

command_details(server_id, command_id)

This method retrieves the details and status of a server command.

Parameters:
  • server_id (str) – ID of server runnung command
  • command_id (str) – ID of command running on server
Returns:

Command status as a dictionary object.

Return type:

dict

Example:

{
  "name": "",
  "status: "",
  "created_at": "",
  "updated_at": "",
  "result": ""
 }

For server account creation and server account password resets, the password will be contained in the result field, as a dictionary:

{
  "name": "",
  "status: "",
  "created_at": "",
  "updated_at": "",
  "result": {
             "password": ""
             }
}
delete(server_id)

Deletes server indicated by server_id.

Remember, deletion causes the removal of accociated security events and scan information.

Parameters:server_id (str) – ID of server to be deleted
Returns:True if successful, throws exceptions otherwise.
describe(server_id)

Get server details by server ID

Parameters:server_id (str) – Server ID
Returns:
Dictionary object describing server. Response fields are
described in detail here: https://api-doc.cloudpassage.com/help#servers
Return type:dict
describe_local_account(server_id, username)

Get deatils on local user account

Parameters:
  • server_id (str) – Server ID
  • username (str) – username of the local user account
Returns:

Dictionary object describing local user account

Return type:

dict

get_firewall_logs(server_id, pages)

This method retrieves the detail of a server firewall log.

Parameters:server_id (str) – ID of server
Returns:firewall log of the server
Return type:list
issues(server_id)

This method retrieves the detail of a server issues.

Parameters:server_id (str) – ID of server
Returns:issues of the server
Return type:list
list_all(**kwargs)

Lists all objects of this type.

Returns:List of objects (represented as dictionary-type objects)
Return type:list

Note

This method supports query parameters via keyword arguments.

list_connections(server_id, **kwargs)

Return all recent connections detected on server_id.

Parameters:server_id (str) – Server ID
Returns:List of all recently detected connections on the server
Return type:list
list_local_accounts(server_id)

Return all local user accounts associated with server_id.

Parameters:server_id (str) – Server ID
Returns:List of dictionary objects describing local user account
Return type:list
list_packages(server_id)

Return a list of packages installed on the server.

Parameters:server_id (str) – Server ID
Returns:
List of dictionaries with keys for package_name and
package_version. This list will be empty if no SVA scans have been completed on the server.
Return type:list
list_processes(server_id)
This method retrieves information about each running process on a
specified Linux or Windows server.
Parameters:server_id (str) – Server ID
Returns:
List of all running processes on the server specified
by server ID.
Note: Historical scan data is not saved;
Only the most recent scan results are available
Return type:list
retire(server_id)

This method retires a server

Parameters:server_id (str) – ID of server to be retired
Returns:True if successful, throws exception on failure