Firewall

Firewall Policies

class cloudpassage.FirewallPolicy(session)

Initializing the FirewallPolicy class:

Parameters:session (HaloSession) – This will define how you interact with the Halo API, including proxy settings and API keys used for authentication.
create(policy_body)

Creates a policy from JSON document.

Returns the ID of the new policy

delete(policy_id)

Delete a policy by ID. Success returns None

describe(policy_id)

Get the detailed configuration of a policy

Parameters:policy_id (str) – ID of the policy to retrieve detailed configuration information for
Returns:dictionary object representing the entire, detailed, policy
Return type:dict
list_all()

Lists all policies of this type.

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

Note

This query is limited to 30 pages.

update(policy_body)

Update a policy. Success returns None

Firewall Rules

class cloudpassage.FirewallRule(session)

Initializing the FirewallRule class:

Parameters:session (cloudpassage.HaloSession) – This will define how you interact with the Halo API, including proxy settings and API keys used for authentication.
create(firewall_policy_id, rule_body)

Creates a rule within a firewall policy.

Parameters:rule_body (dict or str) – string or dict containing the json representation of the firewall policy to be created.
Returns:ID of newly-created firewall rule
Return type:str

Example rule_body:

{
  "firewall_rule" : {
    "chain": "INPUT",
    "active": true,
    "firewall_interface": "7b881ca072b1012ec681404096c01709",
    "firewall_service": "7b6409a072b1012ec681404096c01709",
    "connection_states": "NEW, ESTABLISHED",
    "action": "ACCEPT",
    "log": true,
    "log_prefix": "East-3 input-accept",
    "comment": "All servers in group East-3 must include this rule",
    "position": 4
    }
}
delete(firewall_policy_id, firewall_rule_id)

Delete a firewall policy rule

Parameters:
  • firewall_policy_id (str) – ID of firewall policy containing the rule to be deleted
  • firewall_rule_id (str) – ID of firewall policy rule to delete
Returns:

None if successful. Errors will throw exceptions.

describe(firewall_policy_id, firewall_rule_id)

Get the detailed configuration of a firewall rule

Parameters:
  • firewall_policy_id (str) – ID of the policy to retrieve detailed configuration information for
  • firewall_rule_id (str) – ID of the specific rule to retrieve details for
Returns:

dictionary object representing the entire firewall rule

Return type:

dict

list_all(firewall_policy_id)

List all rules associated with a firewall policy.

Parameters:firewall_policy_id (str) – ID of firewall policy
Returns:Returns a list of rules associated with the firewall policy, each of which are represented by an object of type dict.
Return type:list
update(firewall_policy_id, firewall_rule_id, firewall_rule_body)

Update a firewall policy rule.

Parameters:
  • firewall_policy_id (str) – ID of firewall policy containing the rule to be modified.
  • firewall_rule_id (str) – ID of firewall policy rule to modify.
  • firewall_rule_body (dict or str) – String- or dictionary-type object containing the fields to be updated within the firewall rule.
Returns:

None if successful. Errors will throw exceptions.

Example:

{
  "firewall_rule" : {
    "chain": "INPUT",
    "active": true,
    "firewall_interface": "7b881ca072b1012ec681404096c01709",
    "firewall_service": "7b6409a072b1012ec681404096c01709",
    "connection_states": "NEW, ESTABLISHED",
    "action": "ACCEPT",
    "log": true,
    "log_prefix": "East-3 input-accept",
    "comment": "All servers in group East-3 must include this rule",
    "position": 4
    }
}

Firewall IP Zones

class cloudpassage.FirewallZone(session)

Initializing the FirewallZone class:

Parameters:session (cloudpassage.HaloSession) – This will define how you interact with the Halo API, including proxy settings and API keys used for authentication.
create(policy_body)

Creates a policy from JSON document.

Returns the ID of the new policy

delete(policy_id)

Delete a policy by ID. Success returns None

describe(policy_id)

Get the detailed configuration of a policy

Parameters:policy_id (str) – ID of the policy to retrieve detailed configuration information for
Returns:dictionary object representing the entire, detailed, policy
Return type:dict
list_all()

Lists all policies of this type.

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

Note

This query is limited to 30 pages.

update(policy_body)

Update a policy. Success returns None

Firewall Services

class cloudpassage.FirewallService(session)

Initializing the FirewallService class:

Parameters:session (cloudpassage.HaloSession) – This will define how you interact with the Halo API, including proxy settings and API keys used for authentication.
create(policy_body)

Creates a policy from JSON document.

Returns the ID of the new policy

delete(policy_id)

Delete a policy by ID. Success returns None

describe(policy_id)

Get the detailed configuration of a policy

Parameters:policy_id (str) – ID of the policy to retrieve detailed configuration information for
Returns:dictionary object representing the entire, detailed, policy
Return type:dict
list_all()

Lists all policies of this type.

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

Note

This query is limited to 30 pages.

update(policy_body)

Update a policy. Success returns None

Firewall Interfaces

class cloudpassage.FirewallInterface(session)

Initializing the FirewallInterface class:

Parameters:session (cloudpassage.HaloSession) – This will define how you interact with the Halo API, including proxy settings and API keys used for authentication.
create(policy_body)

Creates a policy from JSON document.

Returns the ID of the new policy

delete(policy_id)

Delete a policy by ID. Success returns None

describe(policy_id)

Get the detailed configuration of a policy

Parameters:policy_id (str) – ID of the policy to retrieve detailed configuration information for
Returns:dictionary object representing the entire, detailed, policy
Return type:dict
list_all()

Lists all policies of this type.

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

Note

This query is limited to 30 pages.

update(policy_body)

Update a policy. Success returns None