Skip to main content

cloudpassage-halo-python-sdk

Python SDK for CloudPassage Halo API

Branch: master

Code Climate Test Coverage https://travis-ci.org/cloudpassage/cloudpassage-halo-python-sdk.svg?branch=master

Branch: develop

https://travis-ci.org/cloudpassage/cloudpassage-halo-python-sdk.svg?branch=develop

This is a BETA. Please don’t forget to pin your work against the version you’re working with, especially if it’s a beta :-)

Installation

Requirements:

  • requests

  • pyaml

Install from pip with pip install cloudpassage. If you want to make modifications to the SDK you can install it in editable mode by downloading the source from this github repo, navigating to the top directory within the archive and running pip install -e . (note the . at the end).

### Quick Start

Here’s the premise: you store your session configuration information (API credentials, proxy settings, etc) in the cloudpassage.HaloSession object. This object gets passed into the various class methods which allow you to interact with the CloudPassage Halo API.

Practical example: We’ll print a list of all servers in our account:

import cloudpassage

api_key = MY_HALO_API_KEY
api_secret = MY_API_SECRET
session = cloudpassage.HaloSession(api_key, api_secret)
server = cloudpassage.Server(session)

list_of_servers = server.list_all()
for s in list_of_servers:
    print "ID: %s   Name: %s" % (s["id"], s["hostname"])

Docs

Building documentation

1. Clone the repository locally 1. Navigate to cloudpassage-halo-python-sdk/docs 1. run sphinx-build -b pdf source build/pdf 1. Docs will be located at cloudpassage-halo-python-sdk/docs/build/pdf/CloudPassage_Python_SDK_$VERSION.pdf

Testing

Important locations for testing

tests/configs: You’ll find a file here called portal.yaml. Copy it to portal.yaml.local and complete the information inside with your API key and secret. the .gitignore settings will keep you from checking in your creds if you put them in the .local file. This file (portal.yaml.local) is referenced directly by all tests requiring interaction with the API.

tests/policies: These are Halo policies, used primarily for integration tests.

tests/tests: This is where you’ll find the actual tests.

Environmental Requirements

You’ll need to have a CloudPassage Halo account available for running the tests, as many are integration-focused. These are the things you need to have (at the very least) to get a clean testing run:

  • Servers:
    • Have at least one active Linux and active Windows server.

    • One deactivated server of any type.

  • Policies:
    • One firewall policy

    • One alert profile

    • One Linux CSM policy

    • One Linux FIM policy

    • One Windows FIM policy

    • One LIDS policy

  • Scans:
    • CSM (Failed scan)

    • FIM (active baseline and successful scan)

    • One CVE exception

  • Events:
    • One event produced by a Windows server.

  • Server Group:
    • Using the default group is fine.

    • Assign the policies mentioned above to the group.

    • Run FIM baselines against the Linux and Windows servers.

    • Kick off a CSM scan if it doesn’t happen automatically

Running tests

Navigate to tests/ and run py.test ./integration ./unit ./style to run the entire test suite. You can remove any of these if you want to focus on a particular section. For instance, to run only the unit and style tests, you would use py.test ./unit ./style.

If you’ve got the coverage module installed, py.test --cov=cloudpassage ./integration ./unit ./style will show statement test coverage.

Metadata

Release files for cloudpassage 0.101

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudpassage 0.101
File Size Uploaded Provenance Actions
cloudpassage-0.101.tar.gz 20.3 kB Without provenance Details for cloudpassage-0.101.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloudpassage 0.101
File Interpreter ABI Platform Actions
cloudpassage-0.101-py2-none-any.whl Python 2 none any Details for cloudpassage-0.101-py2-none-any.whl

Total release size: 52.6 kB

Release files / cloudpassage-0.101.tar.gz

Download URL cloudpassage-0.101.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1adf6aa30766c9fe9ad0f081226e72bc4601b5db56c207b46c924bca63bdaba0
BLAKE2b-256 checksum
How to use checksums
ebc24562c12c51ce6192dce04945118633792256e3a4db067f7525f1cb70d33f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cloudpassage-0.101-py2-none-any.whl

Download URL cloudpassage-0.101-py2-none-any.whl
Size 32.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
6b393970fe872d17b83bb88cd9a093ef0bb4be96054a9100620e739b378c9f2c
BLAKE2b-256 checksum
How to use checksums
878f3f1b3df4a70bbf65e81acb0885f02aed800119e45ea416812b563fd25834
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cloudpassage 0.101

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.101 This release

2 release files No provenance

0.1.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page