Server

class cloudpassage.Server(session)

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.
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
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)

Returns a list of all servers.

This query is limited to 50 pages of 100 items, totaling 500 servers.

Default filter returns only servers in the ‘active’ state.

Keyword Arguments:
 
  • state (list or str) – A list or comma-separated string containing any of these: active, missing, deactivated
  • 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”
Returns:

List of dictionary objects describing servers

Return type:

list

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_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