This script is designed to aid in the decision-making process for creating policies within Oracle Cloud Infrastructure (OCI).
Author: Leonardo Bombonati Contact: [email protected]
The script provides various functions to assist with policy-related tasks within OCI. It primarily operates on Excel files containing policy and permission data.
-
Search for API Operation
- Search for an API operation within Excel files to find associated permissions and details.
-
Search for Service Type and Verb
- Search for a combination of Service Type and Verb within Excel files to find associated permissions and details.
-
Policy Builder
- Build a policy statement based on the given subject and API operation.
-
Translate Policy to API Operation
- Translate a policy statement into the associated API operation(s).
- Python 3.x
openpyxl
library for working with Excel files.
The script supports command-line arguments for its various functionalities.
Search for an API operation to find related permissions and details.
python policyhelper.py
Choose option A
to search for API operations. Enter the desired API operation (case-sensitive) to get related permissions.
Search for a combination of Service Type and Verb to find related permissions.
python policyhelper.py
Choose option B
to search for Service Type and Verb. Enter the desired Service Type and Verb to get related permissions.
Build a policy statement based on the given subject and API operation.
python policyhelper.py
Choose option C
to build a policy. Enter the subject and API operation to generate a policy statement.
Translate a policy statement into the associated API operation(s).
python policyhelper.py -p "Policy Statement"
Replace "Policy Statement"
with your actual policy statement.
Place Excel files containing policy and permission data in the "Excels" folder within the same directory as the script.
To use the Policy Helper script conveniently, you can build and run it inside a Docker container. Here's how:
-
Build the Docker Image
Before building the image, make sure you have Docker installed on your system. Navigate to the directory containing the
Dockerfile
,build.sh
, and the script files.Run the build script to create the Docker image:
chmod +x build.sh # Make the build script executable ./build.sh
This will build the Docker image tagged as policy_helper:stable
.
- Run the Docker Container
To run the script inside the Docker container, you need to provide a policy string as an argument. Replace <policy_string>
with your actual policy statement.
docker run policy_helper:stable "<policy_string>"
Ensure you have placed your Excel files in the "Excels" folder as mentioned in the Requirements section.
Please note that Docker commands require administrative privileges, so you might need to use
sudo
depending on your system configuration.
- The script uses regular expressions for policy translation and requires correct formatting of policy statements.
- Some features depend on the correct organization of data within the Excel files.
- API operation and permission names are case-sensitive.
This script is provided as-is, without warranty of any kind. Use it responsibly and verify its results.
For any questions or concerns, contact the author: Leonardo Bombonati ([email protected])