Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
/ pc-toolbox Public archive

Prisma Cloud API tools for convenience and general utility.

License

Notifications You must be signed in to change notification settings

jdrieger/pc-toolbox

Repository files navigation

pc-toolbox

Prisma Cloud API tools for convenience and general utility.


*** PLEASE NOTE: This repository will be archived as I am transitioning to a new role and I will no longer have the ability to test or validate any changes to the Prisma Cloud system. Please see https://github.com/tkishel/pc-toolbox for the ongoing maintenance and enhancement of the Prisma Cloud toolbox. ***


There are multiple tools that can be used (listed below). Everything here is written in Python (2.7, originally, now updated and tested in Python 3.7, but both should still work).

If you need to install python, you can get more information at Python's Page. I also highly recommend you install the PIP package manager for Python if you do not already have it installed.

To set up your python environment, you will need the following packages:

  • requests

To install/check for this:

pip install requests --upgrade

On to the tools themselves (everything requires the pc_api_lib.py and pc_lib_general.py library files - keep them in the same directory as the other tools):

pc-configure.py

  • Use this to set up your Prisma Cloud Access Key, Secret Key, and API/UI Base URL for use in the remaining tools.
  • REQUIRED - -u switch for the Access Key generated by your Prisma Cloud User.
  • REQUIRED - -p switch for the Secret Key generated by your Prisma Cloud User.
  • REQUIRED - -url switch for the Prisma Cloud API/UI Base URL used to access the Prisma Cloud (app.prismacloud.io, app2.prismacloud.io, etc.). This will try to translate from the older redlock.io addresses. You can instead specify the direct api.* link.
  • OPTIONAL - -conf_file switch for the file containing your configuration settings.
  • Also you can run this without any switches to see the configuration file, Access Key, and Base URL is being used.

NOTE: Settings are stored in a cleartext JSON file, by default in the same directory as the tools. Keep that file protected and do not give it out to anyone.

Example:

python pc-configure.py -u "accesskeyidhere" -p "secretkeyhere" -url "app3.prismacloud.io"

pc-policy-status.py

  • Use this to enable/disable policies globally for an account (filtered on policy type or compliance standard).
  • It will enable or disable all policies of a given type (or all) for a customer account (global).

This is used primarily for setting up a new environment that wants to begin with everything enabled out of the gate or to update after a large number of new policies have been released.

Example:

python pc-policy-status.py --policy_type config enable

This can also be used to only enable policies that are associated with a specific standard (or standards).

Example:

python pc-policy-status.py --policy_type all disable
python pc-policy-status.py --compliance_standard "GDPR" enable
python pc-policy-status.py --compliance_standard "SOC 2" enable

pc-user-import.py

  • Use this to import a list of users from a CSV file.
  • It will import the list from CSV then try to check for duplicates before import.

Example:

python pc-user-import.py "some user list.csv" "Prisma Cloud user role name for my new users"

pc-compliance-copy.py

  • NOTE: This has been replaced by built in functionality. Use the built in clone function for this purpose.
  • Use this to copy an existing Compliance Standard (and related requirements and sections) into a new Compliance Standard.
  • It will copy the entire specified standard into the new standard name specified. Please use the -policy switch to also attempt to add the newly copied standard to all of the existing standards attached policies.
  • If you would like to also add a label to a policy object with the new compliance name, use the -label switch. This will add a label to any policy attached (must be used with the -policy switch, otherwise it will be ignored).
  • Note: The policy attachment is currently having some issues with updating certain built-in policies. It will simply skip any policies it has an issue updating and give a list on the command line of the ones it has issues with. This list can then be manually attached to the new standard after the copy completes.

Example:

python pc-compliance-copy.py "SOC 2" "SOC 2 Copy" -policy

pc-compliance-export.py

  • Use this to export an existing Compliance Standard (and related requirements and sections) into a file for import later or in another tenant.

Example:

python pc-compliance-export.py "SOC 2" "soc2.json"

pc-compliance-import.py

  • Use this to import a saved Compliance Standard (and related requirements and sections) into a new Compliance Standard in Prisma Cloud.
  • It will copy the entire specified standard into the new standard name specified.
  • If you also wish to have the same policy mappings, please use the -policy switch. THIS ONLY WORKS WITH DEFAULT BUILT IN POLICIES. Custom policies are not yet supported (they get dropped from the import).

Example:

python pc-compliance-import.py "soc2.json" "SOC 2 Copy" -policy

pc-cloud-account-import-azure.py (in progress)

  • This is the framework for importing a CSV (template in the templates directory) with a list of Azure accounts into Prisma Cloud.
  • Note: This is still a work in progress. Basic import framework is running, but validation of CSV and duplicate name checking has not been implemented yet.

Example:

python pc-cloud-account-import-azure.py prisma_cloud_account_import_azure_template.csv

About

Prisma Cloud API tools for convenience and general utility.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages