Merge branch 'main' of https://github.com/Infisical/infisical into feat/suborg-scope-support
@@ -130,6 +130,7 @@
|
||||
"integrations/app-connections/laravel-forge",
|
||||
"integrations/app-connections/ldap",
|
||||
"integrations/app-connections/mssql",
|
||||
"integrations/app-connections/mongodb",
|
||||
"integrations/app-connections/mysql",
|
||||
"integrations/app-connections/netlify",
|
||||
"integrations/app-connections/northflank",
|
||||
@@ -444,6 +445,7 @@
|
||||
"documentation/platform/secret-rotation/aws-iam-user-secret",
|
||||
"documentation/platform/secret-rotation/azure-client-secret",
|
||||
"documentation/platform/secret-rotation/ldap-password",
|
||||
"documentation/platform/secret-rotation/mongodb-credentials",
|
||||
"documentation/platform/secret-rotation/mssql-credentials",
|
||||
"documentation/platform/secret-rotation/mysql-credentials",
|
||||
"documentation/platform/secret-rotation/okta-client-secret",
|
||||
@@ -1393,6 +1395,18 @@
|
||||
"api-reference/endpoints/app-connections/mssql/delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "MongoDB",
|
||||
"pages": [
|
||||
"api-reference/endpoints/app-connections/mongodb/list",
|
||||
"api-reference/endpoints/app-connections/mongodb/available",
|
||||
"api-reference/endpoints/app-connections/mongodb/get-by-id",
|
||||
"api-reference/endpoints/app-connections/mongodb/get-by-name",
|
||||
"api-reference/endpoints/app-connections/mongodb/create",
|
||||
"api-reference/endpoints/app-connections/mongodb/update",
|
||||
"api-reference/endpoints/app-connections/mongodb/delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "MySQL",
|
||||
"pages": [
|
||||
@@ -1929,6 +1943,19 @@
|
||||
"api-reference/endpoints/secret-rotations/mssql-credentials/update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "MongoDB Credentials",
|
||||
"pages": [
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/create",
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/delete",
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/get-by-id",
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/get-by-name",
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/get-generated-credentials-by-id",
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/list",
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/rotate-secrets",
|
||||
"api-reference/endpoints/secret-rotations/mongodb-credentials/update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "MySQL Credentials",
|
||||
"pages": [
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
title: "MongoDB Credentials Rotation"
|
||||
description: "Learn how to automatically rotate MongoDB credentials."
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Create a [MongoDB Connection](/integrations/app-connections/mongodb) with the required **Secret Rotation** permissions
|
||||
2. Create two designated database users for Infisical to rotate the credentials for. Be sure to grant each user login permissions for the desired database with the necessary privileges their use case will require.
|
||||
|
||||
An example creation statement might look like:
|
||||
```bash
|
||||
// Switch to the target database
|
||||
use my_database
|
||||
|
||||
// Create first user
|
||||
db.createUser({
|
||||
user: "infisical_user_1",
|
||||
pwd: "temporary_password",
|
||||
roles: []
|
||||
})
|
||||
|
||||
// Create second user
|
||||
db.createUser({
|
||||
user: "infisical_user_2",
|
||||
pwd: "temporary_password",
|
||||
roles: []
|
||||
})
|
||||
|
||||
// Grant necessary permissions to both users
|
||||
db.grantRolesToUser("infisical_user_1", [
|
||||
{ role: "readWrite", db: "my_database" }
|
||||
])
|
||||
|
||||
db.grantRolesToUser("infisical_user_2", [
|
||||
{ role: "readWrite", db: "my_database" }
|
||||
])
|
||||
```
|
||||
|
||||
<Tip>
|
||||
To learn more about MongoDB's permission system, please visit their [documentation](https://www.mongodb.com/docs/manual/core/security-built-in-roles/).
|
||||
</Tip>
|
||||
|
||||
3. Ensure your network security policies allow incoming requests from Infisical to this rotation provider, if network restrictions apply.
|
||||
|
||||
## Create a MongoDB Credentials Rotation in Infisical
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Infisical UI">
|
||||
1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.
|
||||

|
||||
|
||||
2. Select the **MongoDB Credentials** option.
|
||||

|
||||
|
||||
3. Select the **MongoDB Connection** to use and configure the rotation behavior. Then click **Next**.
|
||||

|
||||
|
||||
- **MongoDB Connection** - the connection that will perform the rotation of the configured database user credentials.
|
||||
- **Rotation Interval** - the interval, in days, that once elapsed will trigger a rotation.
|
||||
- **Rotate At** - the local time of day when rotation should occur once the interval has elapsed.
|
||||
- **Auto-Rotation Enabled** - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.
|
||||
|
||||
4. Input the usernames of the database users created above that will be used for rotation. Then click **Next**.
|
||||

|
||||
|
||||
- **Database Username 1** - the username of the first user that will be used for rotation.
|
||||
- **Database Username 2** - the username of the second user that will be used for rotation.
|
||||
|
||||
5. Specify the secret names that the active credentials should be mapped to. Then click **Next**.
|
||||

|
||||
|
||||
- **Username** - the name of the secret that the active username will be mapped to.
|
||||
- **Password** - the name of the secret that the active password will be mapped to.
|
||||
|
||||
6. Give your rotation a name and description (optional). Then click **Next**.
|
||||

|
||||
|
||||
- **Name** - the name of the secret rotation configuration. Must be slug-friendly.
|
||||
- **Description** (optional) - a description of this rotation configuration.
|
||||
|
||||
7. Review your configuration, then click **Create Secret Rotation**.
|
||||

|
||||
|
||||
8. Your **MongoDB Credentials** are now available for use via the mapped secrets.
|
||||

|
||||
</Tab>
|
||||
<Tab title="API">
|
||||
To create a MongoDB Credentials Rotation, make an API request to the [Create MongoDB
|
||||
Credentials Rotation](/api-reference/endpoints/secret-rotations/mongodb-credentials/create) API endpoint.
|
||||
|
||||
### Sample request
|
||||
|
||||
```bash Request
|
||||
curl --request POST \
|
||||
--url https://us.infisical.com/api/v2/secret-rotations/mongodb-credentials \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"name": "my-mongodb-rotation",
|
||||
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||
"description": "my database credentials rotation",
|
||||
"connectionId": "11c76f38-cd13-4137-b1a3-ecd6a429952c",
|
||||
"environment": "dev",
|
||||
"secretPath": "/",
|
||||
"isAutoRotationEnabled": true,
|
||||
"rotationInterval": 30,
|
||||
"rotateAtUtc": {
|
||||
"hours": 0,
|
||||
"minutes": 0
|
||||
},
|
||||
"parameters": {
|
||||
"username1": "infisical_user_1",
|
||||
"username2": "infisical_user_2"
|
||||
},
|
||||
"secretsMapping": {
|
||||
"username": "MONGODB_DB_USERNAME",
|
||||
"password": "MONGODB_DB_PASSWORD"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Sample response
|
||||
|
||||
```bash Response
|
||||
{
|
||||
"secretRotation": {
|
||||
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||
"name": "my-mongodb-rotation",
|
||||
"description": "my database credentials rotation",
|
||||
"secretsMapping": {
|
||||
"username": "MONGODB_DB_USERNAME",
|
||||
"password": "MONGODB_DB_PASSWORD"
|
||||
},
|
||||
"isAutoRotationEnabled": true,
|
||||
"activeIndex": 0,
|
||||
"folderId": "b3257e1f-8d32-4e86-8bfd-b1f1bc1bf2c3",
|
||||
"connectionId": "11c76f38-cd13-4137-b1a3-ecd6a429952c",
|
||||
"createdAt": "2023-11-07T05:31:56Z",
|
||||
"updatedAt": "2023-11-07T05:31:56Z",
|
||||
"rotationInterval": 30,
|
||||
"rotationStatus": "success",
|
||||
"lastRotationAttemptedAt": "2023-11-07T05:31:56Z",
|
||||
"lastRotatedAt": "2023-11-07T05:31:56Z",
|
||||
"lastRotationJobId": null,
|
||||
"nextRotationAt": "2023-11-07T05:31:56Z",
|
||||
"isLastRotationManual": true,
|
||||
"connection": {
|
||||
"app": "mongodb",
|
||||
"name": "my-mongodb-connection",
|
||||
"id": "11c76f38-cd13-4137-b1a3-ecd6a429952c"
|
||||
},
|
||||
"environment": {
|
||||
"slug": "dev",
|
||||
"name": "Development",
|
||||
"id": "170a40f1-1b48-4cc7-addf-e563aa9fbe37"
|
||||
},
|
||||
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||
"folder": {
|
||||
"id": "b3257e1f-8d32-4e86-8bfd-b1f1bc1bf2c3",
|
||||
"path": "/"
|
||||
},
|
||||
"rotateAtUtc": {
|
||||
"hours": 0,
|
||||
"minutes": 0
|
||||
},
|
||||
"lastRotationMessage": null,
|
||||
"type": "mongodb-credentials",
|
||||
"parameters": {
|
||||
"username1": "infisical_user_1",
|
||||
"username2": "infisical_user_2"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
|
Before Width: | Height: | Size: 930 KiB After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 161 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 142 KiB |
141
docs/integrations/app-connections/mongodb.mdx
Normal file
@@ -0,0 +1,141 @@
|
||||
---
|
||||
title: "MongoDB Connection"
|
||||
description: "Learn how to configure a MongoDB Connection for Infisical."
|
||||
---
|
||||
|
||||
Infisical supports the use of Username & Password authentication to connect with MongoDB databases.
|
||||
|
||||
## Configure a MongoDB user for Infisical
|
||||
|
||||
<Steps>
|
||||
<Step title="Create a MongoDB user">
|
||||
Infisical recommends creating a designated user in your MongoDB database for your connection.
|
||||
|
||||
```bash
|
||||
use [TARGET-DATABASE]
|
||||
db.createUser({
|
||||
user: "infisical_manager",
|
||||
pwd: "[ENTER-YOUR-USER-PASSWORD]",
|
||||
roles: []
|
||||
})
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Grant Relevant Permissions">
|
||||
Depending on how you intend to use your MongoDB connection, you'll need to grant one or more of the following permissions.
|
||||
|
||||
<Tip>
|
||||
To learn more about MongoDB's permission system, please visit their [documentation](https://www.mongodb.com/docs/manual/core/security-built-in-roles/).
|
||||
</Tip>
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Secret Rotation">
|
||||
For Secret Rotations, your Infisical user will require the ability to create, update, and delete users in the target database:
|
||||
|
||||
```bash
|
||||
use [TARGET-DATABASE]
|
||||
db.grantRolesToUser("infisical_manager", [
|
||||
{ role: "userAdmin", db: "[TARGET-DATABASE]" }
|
||||
])
|
||||
```
|
||||
|
||||
<Note>
|
||||
The `userAdmin` role allows managing users (create, update passwords, delete) within the specified database.
|
||||
</Note>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</Step>
|
||||
|
||||
</Steps>
|
||||
|
||||
## Create MongoDB Connection in Infisical
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Infisical UI">
|
||||
<Steps>
|
||||
<Step title="Navigate to App Connections">
|
||||
In your Infisical dashboard, navigate to the **App Connections** page in the desired project.
|
||||
|
||||

|
||||
</Step>
|
||||
<Step title="Select MongoDB Connection">
|
||||
Click the **+ Add Connection** button and select the **MongoDB Connection** option from the available integrations.
|
||||
|
||||

|
||||
</Step>
|
||||
<Step title="Fill out the MongoDB Connection Modal">
|
||||
Complete the MongoDB Connection form by entering:
|
||||
- A descriptive name for the connection
|
||||
- An optional description for future reference
|
||||
- The MongoDB host URL for your database
|
||||
- The MongoDB port for your database
|
||||
- The MongoDB username for your database
|
||||
- The MongoDB password for your database
|
||||
- The MongoDB database name to connect to
|
||||
|
||||
You can optionally configure SSL/TLS for your MongoDB connection in the **SSL** section.
|
||||
|
||||

|
||||
</Step>
|
||||
<Step title="Connection Created">
|
||||
After clicking Create, your **MongoDB Connection** is established and ready to use with your Infisical project.
|
||||
|
||||

|
||||
</Step>
|
||||
</Steps>
|
||||
</Tab>
|
||||
<Tab title="API">
|
||||
To create a MongoDB Connection, make an API request to the [Create MongoDB Connection](/api-reference/endpoints/app-connections/mongodb/create) API endpoint.
|
||||
|
||||
### Sample request
|
||||
|
||||
```bash Request
|
||||
curl --request POST \
|
||||
--url https://app.infisical.com/api/v1/app-connections/mongodb \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"name": "my-mongodb-connection",
|
||||
"method": "username-and-password",
|
||||
"projectId": "7ffbb072-2575-495a-b5b0-127f88caef78",
|
||||
"credentials": {
|
||||
"host": "[MONGODB HOST]",
|
||||
"port": 27017,
|
||||
"username": "[MONGODB USERNAME]",
|
||||
"password": "[MONGODB PASSWORD]",
|
||||
"database": "[MONGODB DATABASE]"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Sample response
|
||||
|
||||
```bash Response
|
||||
{
|
||||
"appConnection": {
|
||||
"id": "e5d18aca-86f7-4026-a95e-efb8aeb0d8e6",
|
||||
"name": "my-mongodb-connection",
|
||||
"projectId": "7ffbb072-2575-495a-b5b0-127f88caef78",
|
||||
"description": null,
|
||||
"version": 1,
|
||||
"orgId": "6f03caa1-a5de-43ce-b127-95a145d3464c",
|
||||
"createdAt": "2025-04-23T19:46:34.831Z",
|
||||
"updatedAt": "2025-04-23T19:46:34.831Z",
|
||||
"isPlatformManagedCredentials": false,
|
||||
"credentialsHash": "d41d8cd98f00b204e9800998ecf8427e",
|
||||
"app": "mongodb",
|
||||
"method": "username-and-password",
|
||||
"credentials": {
|
||||
"host": "[MONGODB HOST]",
|
||||
"port": 27017,
|
||||
"username": "[MONGODB USERNAME]",
|
||||
"database": "[MONGODB DATABASE]",
|
||||
"sslEnabled": false,
|
||||
"sslRejectUnauthorized": false,
|
||||
"sslCertificate": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
|
||||
</Tabs>
|
||||
@@ -362,6 +362,13 @@ export const AppConnectionsBrowser = () => {
|
||||
"Learn how to connect your Northflank projects to pull secrets from Infisical.",
|
||||
category: "Hosting",
|
||||
},
|
||||
{
|
||||
name: "MongoDB",
|
||||
slug: "mongodb",
|
||||
path: "/integrations/app-connections/mongodb",
|
||||
description: "Learn how to connect your MongoDB to pull secrets from Infisical.",
|
||||
category: "Databases"
|
||||
}
|
||||
].sort(function (a, b) {
|
||||
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||
});
|
||||
|
||||
@@ -16,7 +16,8 @@ export const RotationsBrowser = () => {
|
||||
{"name": "PostgreSQL", "slug": "postgres-credentials", "path": "/documentation/platform/secret-rotation/postgres-credentials", "description": "Learn how to automatically rotate PostgreSQL database credentials.", "category": "Databases"},
|
||||
{"name": "Redis", "slug": "redis-credentials", "path": "/documentation/platform/secret-rotation/redis-credentials", "description": "Learn how to automatically rotate Redis database credentials.", "category": "Databases"},
|
||||
{"name": "Microsoft SQL Server", "slug": "mssql-credentials", "path": "/documentation/platform/secret-rotation/mssql-credentials", "description": "Learn how to automatically rotate Microsoft SQL Server credentials.", "category": "Databases"},
|
||||
{"name": "Oracle Database", "slug": "oracledb-credentials", "path": "/documentation/platform/secret-rotation/oracledb-credentials", "description": "Learn how to automatically rotate Oracle Database credentials.", "category": "Databases"}
|
||||
{"name": "Oracle Database", "slug": "oracledb-credentials", "path": "/documentation/platform/secret-rotation/oracledb-credentials", "description": "Learn how to automatically rotate Oracle Database credentials.", "category": "Databases"},
|
||||
{"name": "MongoDB Credentials", "slug": "mongodb-credentials", "path": "/documentation/platform/secret-rotation/mongodb-credentials", "description": "Learn how to automatically rotate MongoDB credentials.", "category": "Databases"}
|
||||
].sort(function(a, b) {
|
||||
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||
});
|
||||
|
||||