Privacera Boto3 Signer¶
This section provides information about the Privacera Boto3 Signer and how to set it up for seamless AWS S3 access with Boto3 applications.
Boto3 Overview¶
Boto3 is the official AWS SDK for Python, enabling developers to build applications that interact with AWS services such as Amazon S3. It offers both a high-level, object-oriented interface for ease of use and low-level APIs for fine-grained control over AWS services.
What is Privacera Boto3 Signer?¶
Privacera Boto3 Signer is a drop-in authentication and request-signing layer for Boto3. It integrates with Privacera DataServer to obtain short-lived AWS STS credentials and sign S3 requests using AWS SigV4.
Privacera Boto3 Signer delivers an enterprise-grade security layer that offers:
-
Policy-Driven Access Control
Enforces Privacera access policies across all Amazon S3 operations. -
Enterprise-Grade Security
Supports audit trails, short-lived credentials, and centralized policy enforcement.
Version Support
This feature is supported in Privacera release version 9.2.9.1 and later.
Pre-requisites¶
- AWS S3 Connector Setup - AWS S3 connector setup and configure Privacera DataServer with AWS S3.
-
Valid JWT Token - Must be configured with DataServer for authentication with Privacera DataServer.
- To configure: See JWT Token Configuration
- To validate: See Test JWT Configuration
-
Python 3.9+ - Required for Boto3 and the signer package.
-
Python Packages - The following Python packages must be installed:
boto3version 1.34.0 or higherbotocoreversion 1.34.0 or higherrequestsversion 2.31.0 or higher
Setup¶
-
Create and Navigate to the Setup Directory:
-
Create download script
privacera_boto3_pkg_download.shin this directory: -
Execute the
privacera_boto3_pkg_download.shscript based on deployment type. This script will download the Privacera Boto3 Signer tar package:Execute the script with your Privacera release version (e.g.
9.2.9.1):To get the API Key and Ranger Admin URL, follow the steps below:
-
Login to PrivaceraCloud Portal
-
Navigate to Settings → API keys
-
Click the i (information icon) next to API key
-
Copy the API Key value
-
Execute the script:
-
-
Install Privacera Boto3 Signer - After running the
privacera_boto3_pkg_download.shscript, complete the installation (the current directory should beprivacera-boto3):-
[Optional] Check if virtual environment already exists and activate it. If it doesn't exist, create a new one:
-
Create
requirements.txtfile:Bash Add the following content:
-
Install dependencies:
Bash -
Install Privacera Boto3 Signer:
Bash -
Verify
privacera_auto_register.pthfile installation - Check and see if the auto-registration file exists in venv site-packages path:Bash
-
-
Configure
privacera-signer.propertiesfile:Bash Add the following content:
Text Only Configure the properties with appropriate values:
a. Determine
privacera.signer.base.url(DataServer Endpoint URL):-
Run the following command in Self Managed Privacera environment to retrieve the DataServer external URL:
Bash -
Locate the
DATASERVERsection in the output and identify theEXTERNALURL: -
Use the
EXTERNALURL value asprivacera.signer.base.url.Example:
If
EXTERNALURL ishttps://dataserver-example.endpoint.com, then:Text Only
-
Use the API Key from step 3 (PrivaceraCloud tab) and construct the URL as follows for
privacera.signer.base.url: -
Then set:
Text Only
b. Configure JWT Token:
-
Set
privacera.jwt.token.strto the JWT token value that is configured with DataServer for authentication.Example:
Text Only
-
-
Configure environment - before executing the use case, set the environment variable:
Bash
Validation Checklist¶
Test Use Case - Create and run a sample test script to validate the integration:¶
-
Create the test script (update
bucket_name,s3_key, andlocal_file_pathwith actual values):-
Create
test_boto3_signer.pyfile:Bash -
Add the following content:
-
-
Execute the test script:
Bash
Verify Console Logs¶
- After running the use case, Privacera logs similar to the following appear in the console:
Verify Audit Logs¶
Check Privacera audit logs to confirm policy enforcement:
-
Privacera Portal: Navigate to Access Management → Audits → ACCESS tab
-
Verify audit entry: A Denied audit record is generated for the JWT-authenticated user, showing the resource path and the attempted operation.
-
Allow access to user on resource (if access was denied):
a. Create user: Navigate to Access Management → Users/Groups/Roles → Create JWT user/group/role here
b. Create policy: Navigate to Access Management → Resource Policies → privacera_s3 → ADD NEW POLICY
Configure the policy with the following values:
For download operation:
- Policy Name:
Boto3 download operation - Bucket Name:
<s3 bucket> - Object Path:
<s3 resource path excluding bucket> - Principal:
<assign user/group/role created in above steps> - Permissions:
Read,Metadata Read
- Policy Name:
-
Re-run and Verify: Execute test script again and verify the use case is successful and verify an Allowed audit is now generated.
Troubleshoot¶
Configure Log Level¶
To enable detailed logging for debugging purposes, configure the signer log level in privacera-signer.properties file:
Add the following property to set the log level:
| Properties | |
|---|---|
Available log levels:
DEBUG- Detailed diagnostic information for debuggingINFO- General informational messages (default)WARN- Warning messages for potential issuesERROR- Error messages only
Note: Set the log level to DEBUG when troubleshooting issues, and revert to INFO or WARN for production environments to reduce log verbosity.
- Prev topic: Connector Guide - AWS S3