Skip to main content

Secrets Manager

Resource configuration in DronaHQ involves managing critical information like database passwords or API keys. At DronaHQ, prioritizing data security is fundamental, ensuring the safeguarding of sensitive information. However, some users prefer storing such data externally for added security layers.

DronaHQ's Secret Manager feature, accessible through - Account Settings -> General & Security -> Secret Manager, empowers users to manage and retrieve sensitive data from external sources like HashiCorp Vault.

Adding a new vault

This feature offers increased flexibility, enabling users to maintain control over their sensitive information while utilizing DronaHQ's cloud platform.

The primary purpose of the Secret Manager is to offer users a centralized and secure space within DronaHQ, allowing seamless integration with external secret management systems. This integration ensures that users can tailor their security measures according to their preferences, enhancing protection for their crucial data.

Add Secret Manager: Vault

Click on + Vault and you'll be prompted to input a name and choose the vault type from the provided dropdown menu labeled 'Select Vault`.

Adding a new vault
Adding a new vault

Hashicorp vault

HashiCorp Vault is a powerful tool for safeguarding sensitive data, managing secrets, and ensuring secure access control across diverse environments. To configure your Vault, essential details and authentication credentials need to be provided, ensuring a secure setup tailored to your organization's needs.

Configuring Hashicorp Vault for Secrets Manager
Configuring Hashicorp Vault for Secrets Manager
FieldDescriptionExample
Vault URL & PortURL and port of your Vault serverhttps://vault.dronahq.com:8200
Approle MountProvide the mount point for authentication methods and secrets engines to be enabled from, the default mount point for the AppRole authentication method is approle.auth/approle
Role IdEnter Role ID from the Vault40481de9-8281-cf4d-2056-tyt5c738e789
Secret IdEnter Secret ID from the Vault56789d5a-ead6-5f9f-c683-a571ad716668
Wrapped Secret Id locationEnter wrapped Secret Id location from the self hosted instance (only for self hosted)/app/vault_wrapped_token.json
NamespaceEnter Namespacemy-namespace
Engine nameEnter Engine Namedhqkv
Engine typeKV (version 2) or Database (MySQL/MariaDB, PostgreSQL, MongoDB) KV (version 2)
Path to secretPath to Secret within Vaultsecret/data/example
Database roleProvide role required for the database.readOnlyData
Connection NameEnter Connection Nameshibam_postgres

Hashicorp sample policy

# Following paths are require for Dronahq to read secrets

# Below two paths require for kv engine:
path "<YOUR-ENGINE-NAME>/data/*" {
capabilities = ["read"]
}
path "<YOUR-ENGINE-NAME>/subkeys/*" {
capabilities = ["read"]
}

# Below two paths require for database engine:
path "<YOUR-ENGINE-NAME>/config/*" {
capabilities = ["read"]
}
path "<YOUR-ENGINE-NAME>/creds/*" {
capabilities = ["read"]
}
How to add wrapped secret id in self hosted instance
docker-compose.yml file
docker-compose.yml file

You will need to add volume mapping in the docker-compose.yaml file. The underlined path represents the path inside the container that you need to add to the secret manager's configuration. The path on the left side of the ':' is the path on your host machine where your file is located. After making these changes, run the following command to restart the web application:

sudo docker-compose restart webapp

sample vault_wrapped_token.json

# /app/vault_wrapped_token.json
{
"request_id": "",
"lease_id": "",
"lease_duration": 0,
"renewable": false,
"data": null,
"warnings": null,
"wrap_info": {
"token": "hvs.CAESIPESvKmm00MDzT********************",
"accessor": "********************",
"ttl": 21600,
"creation_time": "2024-07-10T09:30:21.328855679Z",
"creation_path": "auth/products/role/developer/secret-id",
"wrapped_accessor": "*******-****-****-****-***********"
}
}

Advance

Hashicorp Vault's Advance section
Hashicorp Vault's Advance section
  • Cache TTL (Time To Live): determines the duration data remains valid in the cache before expiration. This reduces API calls to your secrets manager, which keeps queries fast and reduces costs. You can toggle on TLS (Transport Layer Security) for securing connections between the client and the server.

    Ideal for improving performance, set a suitable Cache TTL to balance data freshness and system load.

  • Use TLS to Connect: To connect to your HashiCorp Vault over HTTPS, you need TLS certificates. Ensure you have added the required certificates such as the CA certificate, client key, and client certificate.

    Configuring TLS for Hashicorp Vault
    Configuring TLS for Hashicorp Vault

Click on Test and Save

Hashicorp Vault Added
Hashicorp Vault Added

AWS Secrets Manager

AWS Secrets Manager is a powerful tool for safeguarding sensitive data, managing secrets, and ensuring secure access control across diverse environments. To configure AWS Secrets Manager, essential details and authentication credentials need to be provided, ensuring a secure setup tailored to your organization's needs.

Configuring AWS Secrets Manager for Secrets Manager
Configuring AWS Secrets Manager for Secrets Manager
FieldDescriptionExample
Authentication TypeAccess Key and Secret Access Key or IAM Access RoleAccess Key and Secret Access Key
AWS RegionRegion where your Secrets exists.us-east-1
Access Key IdEnter Access Key IdAKIAIOSFODNN7EXAMPLE
Secret Access KeyEnter Secret Access KeywJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Secret NameEnter Secret Namemy-secret
Engine typeKey Value Pair or DatabaseDatabase
Database TypeMySQL, MariaDB, PostreSQL, SQL Server and OracleMySQL

Advance

  • Cache TTL (Time To Live) determines the duration data remains valid in the cache before expiration. This reduces API calls to your secrets manager, which keeps queries fast and reduces costs.

    Ideal for improving performance, set a suitable Cache TTL to balance data freshness and system load.

Click on Test and Save

AWS Secrets Manager Added
AWS Secrets Manager Added

Connecting using IAM Role Access

1. Create IAM policy for DronaHQ

In AWS, create an IAM policy to grant DronaHQ access to your secrets. The following is an example policy you might use.

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue",
"secretsmanager:DescribeSecret"
],
"Resource": ["arn:aws:secretsmanager:Region:AccountId:secretname:*"]
},
{
"Effect": "Allow",
"Action": ["secretsmanager:ListSecrets"],
"Resource": "*"
}
]
}

2. Attach IAM policy to your principal

Next, attach the policy to the principal associated with your DronaHQ workload. For example, if you deploy DronaHQ on EC2, attach this policy to the instance profile for the DronaHQ instance.

Update & Delete Vaults

To update a Vault configuration, locate and select the pencil icon adjacent to the target Vault.

Vault edit

This action initiates the Update section, enabling the implementation of necessary adjustments. It is crucial to conduct thorough testing to validate changes for accuracy before confirming and saving the modifications.

To delete a Vault, simply locate and select the trash icon positioned alongside the specific Vault you intend to remove. This action triggers the deletion process, allowing you to remove the Vault from the system.

Vault delete

Secret Manager for Connector Configuration

We can use our vault from secret manager, while configuring a database as well as an API connector.

For configuring a database connector, there is an option of Secrets Manager from where we have to select the right vault for the configuration.

The available options in the Secret Manager dropdown consist of vaults categorized as KV Engines or specific database engines.

List of Database Engine Types which supports secrets manager:

DatabaseHashicorp VaultAWS Secrets Manager
MySQL
MariaDB
Postgres
MongoDB
Oracle
SQL Server
DB Secret vault

Likewise, for configuring an API connector using the secret manager, we can navigate to the designated section. The dropdown menu will display various options exclusively consisting of KV engine selections.

Vault edit
NOTE

You can access JSON keys with {{secrets.name.key}}. You can access arbitrary levels of nested keys in your secrets. This ensures the correct configuration of your vault settings.