Onboard Oracle Cloud accounts with a Python script

You can use a custom Python script (onboard.py) to programmatically create and configure Oracle Cloud Infrastructure (OCI) resources required for Rapid7 to collect data from your environment. The script automates IAM user creation, group and policy configuration, and API key generation.

Prerequisites

CLI and software:

  • Python 3.9 or greater
  • OCI CLI installed and configured (oci command available in your terminal)
  • openssl available in your terminal (required for API key generation)

General:

  • Appropriate OCI permissions:
    • IAM admin permissions or equivalent (required to create users, groups, policies, and API keys)
  • Access to one or more OCI tenancies
  • Cloud Security Domain or Organization Admin permissions
  • Cloud Security administrative permissions
Not sure if you have the correct OCI permissions?

You can use the script to check your OCI permissions. Review Common script use cases for details.

Key script terminology

Before you begin, review the core concepts used in OCI onboarding:

  • IAM User: An Oracle Cloud Identity and Access Management (IAM) user is an identity within your tenancy used to represent a non-human principal that needs programmatic access to OCI APIs. The script creates a dedicated IAM user for Rapid7 data collection.
  • IAM Group: OCI users are granted permissions through group membership rather than direct policy assignment. The script creates a CloudSec group and adds the IAM user to it.
  • IAM Policy: OCI policies define what actions a group is allowed to perform. The script creates a policy scoped at the tenancy level and associates it with the CloudSec group.
  • API Key: OCI users authenticate programmatically using an RSA key pair. The script generates a key pair, uploads the public key to OCI, and saves the private key locally. The private key file is required to connect the account in Cloud Security.
  • Permission Level: The script supports two permission levels:
    • Read-Only (default): Enables resource discovery and monitoring
    • Power User: Adds remediation capabilities on top of read-only access
  • Tenancy: The root compartment of your OCI environment. All resources created by the script are scoped at the tenancy level for comprehensive visibility.

Download the script and connect accounts

You can configure and download the script in the Cloud Security Add Cloud Account interface. The interface allows you to toggle Power User permissions on or off before downloading. This setting changes the policy file embedded in the script.

Need to adjust configuration details?

If you need a new configuration (for example, to switch between read-only and power user permissions), Rapid7 recommends using the Add Cloud Account interface to regenerate and download a new script.

Script reference

The onboarding script includes multiple options to customize or validate deployments. Use the help flag for the most up-to-date options:

python onboard.py --help
Many script options are pre-configured

Some options (like --power-user) may be pre-configured using environment variables (CHOSEN_ parameters) when generated from the platform.

Common script use cases

The most common use cases for the script are as follows:

Troubleshooting