Configuring Databricks Cluster FGAC with JWT¶
JWT Auth Configuration¶
In Databricks by default Privacera uses the user from Databricks session for authorization. In addition, Privacera can also alternate authentication mechanism like JWT (JSON Web Token), which will use the user/group from the JWT payload instead of the user from Databricks session. This is useful when submitting jobs as service users where the temporary JWT token can be used to impersonate the ETL user/group.
Databricks now supports Service Principals which might be alternative to JWT token authentication. For more information, refer to Service Principals.
Pre Read
You should read how Privacera uses JWT for authentication before proceeding with this topic.
Prerequisites:¶
- JWT provider should be configured in Privacera Manager. Refer to the Configuring JWT Providers for more information.
- Make sure the access policies for the users/groups in the JWT token are used in the Ranger policies.
Configuration¶
- Go to the Privacera Manager directory and edit the Databricks configuration file to enable JWT authentication.
| Bash | |
|---|---|
Step 1 - Setup which generates the helm charts. This step usually takes few minutes.
Step 2 - Apply the Privacera Manager helm charts. Step 3 - (Optional) Post-installation step which generates Plugin tar ball, updates Route 53 DNS and so on. This step is not required if you are updating only connector properties.Set the below common properties in the Spark configuration of the Databricks cluster:
Static public key JWT¶
-
Copy JWT Public Keys to Local Cluster File Path
- Upload the JWT Public Key:
- First, upload the
jwttoken.pubfile containing the JWT public key to the DBFS or workspace location. - For example, upload the key to
/dbfs/user/jwt/keys.
- First, upload the
- Update the Init Script:
- To copy the public keys to the local cluster file path, update the init script with the following commands:
- This script sets the paths for the public keys in DBFS and the local cluster, then copies the keys from DBFS to the local path.
- Upload the JWT Public Key:
-
Configure single static public key
- Add below properties in the Spark configuration of the Databricks cluster along with the common properties:
Bash - Save the changes and click on Start or, if the cluster is running, click on Confirm and Restart.
- Add below properties in the Spark configuration of the Databricks cluster along with the common properties:
-
Configure multiple static public keys
- Add below properties in Spark configuration of Databricks cluster along with the common properties:
- Save the changes and click on Start or, if the cluster is running, click on Confirm and Restart.
- Add below properties in Spark configuration of Databricks cluster along with the common properties:
Dynamic public key JWT:¶
-
Configure single dynamic public key
- Add below properties in Spark configuration of Databricks cluster along with common properties:
- Save the changes and click on Start or, if the cluster is running, click on Confirm and Restart.
- Add below properties in Spark configuration of Databricks cluster along with common properties:
-
Configure multiple dynamic public keys
- Add below properties in the Spark configuration of Databricks cluster along with the common properties:
- Save the changes and click on Start or, if the cluster is running, click on Confirm and Restart.
- Add below properties in the Spark configuration of Databricks cluster along with the common properties:
Static and Dynamic public keys JWT:¶
- Configure static and dynamic public keys
- Add below properties in the Spark configuration of Databricks cluster along with the common properties:
- Save the changes and click on Start or, if the cluster is running, click on Confirm and Restart.
- Add below properties in the Spark configuration of Databricks cluster along with the common properties:
JWT is configured on the connector, not in a file. Turn on Enable JWT authentication under Connector Configs, then fill the JWT Authentication section while configuring the connector.
Each provider is configured separately; use Add JWT provider for more than one.
| Field | Definition | Default |
|---|---|---|
| Issuer | The iss claim the token must carry. Required. | - |
| Parser Type | How this provider's tokens are parsed. Ping Identity or Keycloak. | Ping Identity |
| User Claim | The claim holding the user name. | client_id |
| Group Claim | The claim holding the group membership. | scope |
| Public Key | PEM public key used to verify RSA-signed tokens. Leave blank when using a provider URL. | - |
| Public Key Provider URL | Where the signing key is fetched from. Leave blank when pasting a public key instead. | - |
| Provider Auth Type | How the plugin authenticates to the public key provider. Use None for a public JWKS endpoint. | Basic |
| Provider Username, Provider Password | Credentials for the provider URL, when the auth type requires them. | - |
| Provider Response Key | The field in the provider response holding the certificate. | x5c |
| Key ID Claim | The token claim naming which key signed it. | kid |
Any provider setting not listed here can be added with Add property inside that provider, as a key and value - privacera.jwt.<n>.token.secret, the shared secret for HMAC-signed tokens, is set that way.
Validation¶
- Prerequisites:
- A running Databricks cluster secured with the above steps.
- Steps to Validate:
- Login to Databricks.
- Create or open an existing notebook. Associate the Notebook with the running Databricks cluster.
- To use JWT in Privacera Databricks integration, you need to copy the JWT token file or string to the cluster's local file. To do this, use the following commands and replace
<jwt_token>with your actual jwt token value.Python - Use the following PySpark commands to verify S3 CSV file read access.
- On the Privacera portal, go to Access Management -> Audits
- Check for the User that you mentioned in the Payload while Creating the JWT Token, e.g.,
jwt_user. - Check for the success or failure of the resource policy. A successful access is indicated as Allowed and a failure is indicated as Denied.
- Prev topic: Advanced Configuration