Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Update docs for Infisical SSH, fix Infisical SSH project deletion bug

Tuan Dang18c8fc66ee97
diff --git a/backend/src/db/migrations/20250404022310_ssh-ca-key-source.ts b/backend/src/db/migrations/20250404022310_ssh-ca-key-source.ts
index 45955fc127..dc05eb9e53 100644
--- a/backend/src/db/migrations/20250404022310_ssh-ca-key-source.ts
+++ b/backend/src/db/migrations/20250404022310_ssh-ca-key-source.ts
@@ -15,6 +15,12 @@ export async function up(knex: Knex): Promise<void> {
t.string("keySource").notNullable().alter();
});
}
+
+ if (await knex.schema.hasColumn(TableName.SshCertificate, "sshCaId")) {
+ await knex.schema.alterTable(TableName.SshCertificate, (t) => {
+ t.uuid("sshCaId").nullable().alter();
+ });
+ }
}
export async function down(knex: Knex): Promise<void> {
diff --git a/backend/src/db/schemas/ssh-certificates.ts b/backend/src/db/schemas/ssh-certificates.ts
index 6fe5bc2615..351875bbb1 100644
--- a/backend/src/db/schemas/ssh-certificates.ts
+++ b/backend/src/db/schemas/ssh-certificates.ts
@@ -11,7 +11,7 @@ export const SshCertificatesSchema = z.object({
id: z.string().uuid(),
createdAt: z.date(),
updatedAt: z.date(),
- sshCaId: z.string().uuid(),
+ sshCaId: z.string().uuid().nullable().optional(),
sshCertificateTemplateId: z.string().uuid().nullable().optional(),
serialNumber: z.string(),
certType: z.string(),
diff --git a/docs/documentation/platform/ssh.mdx b/docs/documentation/platform/ssh.mdx
index 179fa95903..00f7cf269b 100644
--- a/docs/documentation/platform/ssh.mdx
+++ b/docs/documentation/platform/ssh.mdx
@@ -98,6 +98,7 @@ as part of the SSH operation.
Here's some guidance on each field:
- Friendly Name: A friendly name for the CA; this is only for display.
+ - Key Source: Whether the CA's key pair should be generated internally or supplied from an external source. Select **Internal**.
- Key Algorithm: The type of public key algorithm and size, in bits, of the key pair for the CA. Supported key algorithms are `RSA 2048`, `RSA 4096`, `ECDSA P-256`, and `ECDSA P-384` with the default being `RSA 2048`.
</Step>
@@ -217,6 +218,16 @@ infisical login
In the following steps, we show how to configure host key signing for clients to verify the identity of a remote host before attempting the SSH operation; this is recommended to reduce the probability of a client accessing a malicious machine.
+<Note>
+This guide expects that the remote host already has an existing SSH key pair (typically found in the `/etc/ssh/` folder at `/etc/ssh/ssh_host_<algo>_key` and `.pub`).
+
+In the event that the remote host does not have an existing SSH key pair, you can generate a new key pair using the `ssh-keygen` command: `ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ''`. This will generate:
+
+- A private key: `/etc/ssh/ssh_host_rsa_key`.
+- A public key: `/etc/ssh/ssh_host_rsa_key.pub`.
+
+</Note>
+
<Steps>
<Step title="Configuring a SSH CA for host key signing">
1.1. In the same SSH project, create another SSH CA in the **Certificate Authorities** tab; this CA will be used for host key signing.
@@ -228,7 +239,9 @@ In the following steps, we show how to configure host key signing for clients to
Here's some guidance on each field:
- Friendly Name: A friendly name for the CA; this is only for display.
- - Key Algorithm: The type of public key algorithm and size, in bits, of the key pair for the CA. Supported key algorithms are `RSA 2048`, `RSA 4096`, `ECDSA P-256`, and `ECDSA P-384` with the default being `RSA 2048`.
+ - Key Source: Whether the CA's key pair should be generated internally or supplied from an external source. Select **External**.
+ - Public Key: The public key for the CA (i.e. the host's SSH public key).
+ - Private Key: The private key for the CA (i.e. the host's SSH private key).
</Step>
<Step title="Configuring a certificate template on the CA">
@@ -262,12 +275,12 @@ In the following steps, we show how to configure host key signing for clients to
<Note>
You should select **Sign SSH Key** under the **Operation** field.
- Then input your host's public key under the **SSH Public Key** field and hostname under the **Principal(s)** field; the host's public key is likely in the `/etc/ssh` folder of the host.
+ Then input your host's SSH public key under the **SSH Public Key** field and hostname under the **Principal(s)** field; the host's public key should be in the `/etc/ssh` folder of the host as used in step 1.
</Note>
![ssh host issue certificate 3](/images/platform/ssh/ssh-host-issue-cert-3.png)
- 2.2. Create a file containing the certificate in the SSH folder of the remote host; we'll call it `key-cert.pub`.
+ 2.2. Create a file containing the certificate in the SSH folder of the remote host; we'll call it `ssh_host_key-cert.pub`.
2.2. Set permissions on the certificate to be `0640`:
@@ -278,10 +291,14 @@ In the following steps, we show how to configure host key signing for clients to
2.3. Next, add the following lines to the `/etc/ssh/sshd_config` file on the remote host.
```bash
- HostKey /etc/ssh/ssh_host_key
+ HostKey /etc/ssh/ssh_host_rsa_key
HostCertificate /etc/ssh/ssh_host_key-cert.pub
```
+ <Note>
+ You should adjust the `HostKey` directive to match the path to the host's SSH private key as used in step 1.
+ </Note>
+
2.4. Finally, reload the SSH daemon on the remote host to apply the changes.
```bash
@@ -314,3 +331,33 @@ In the following steps, we show how to configure host key signing for clients to
</Step>
</Steps>
+
+## FAQ
+
+<AccordionGroup>
+ <Accordion title="How can I confirm if the Infisical SSH workflow is working?">
+ After configuring Infisical SSH, you can add the `-vvv` flag as part of the
+ SSH operation to see verbose output from the SSH client.
+
+ ```bash
+ ssh -vvv username@hostname
+ ```
+
+ You should see output from the SSH client that includes the following if both client key signing and host key signing are working:
+
+ Host certificate was verified and trusted:
+
+ ```bash
+ debug1: Host 'example.com' is known and matches the ECDSA-CERT host certificate.
+ debug1: Found CA key in /Users/user/.ssh/known_hosts:1
+ ```
+
+ You authenticated with your user certificate:
+
+ ```bash
+ debug1: Offering public key: Added via Infisical CLI RSA-CERT SHA256:...
+ debug1: Server accepts key: Added via Infisical CLI RSA-CERT SHA256:...
+ ```
+
+ </Accordion>
+</AccordionGroup>
diff --git a/docs/images/platform/ssh/ssh-client-ca-public-key.png b/docs/images/platform/ssh/ssh-client-ca-public-key.png
index 2f09756c4b..058b844fbb 100644
Binary files a/docs/images/platform/ssh/ssh-client-ca-public-key.png and b/docs/images/platform/ssh/ssh-client-ca-public-key.png differ
diff --git a/docs/images/platform/ssh/ssh-client-create-ca-1.png b/docs/images/platform/ssh/ssh-client-create-ca-1.png
index c5a5f70e2d..30658944fa 100644
Binary files a/docs/images/platform/ssh/ssh-client-create-ca-1.png and b/docs/images/platform/ssh/ssh-client-create-ca-1.png differ
diff --git a/docs/images/platform/ssh/ssh-client-create-ca-2.png b/docs/images/platform/ssh/ssh-client-create-ca-2.png
index c6f997221b..3a0bf155c0 100644
Binary files a/docs/images/platform/ssh/ssh-client-create-ca-2.png and b/docs/images/platform/ssh/ssh-client-create-ca-2.png differ
diff --git a/docs/images/platform/ssh/ssh-client-create-template-1.png b/docs/images/platform/ssh/ssh-client-create-template-1.png
index 821d2b42c4..0c0ba97c8f 100644
Binary files a/docs/images/platform/ssh/ssh-client-create-template-1.png and b/docs/images/platform/ssh/ssh-client-create-template-1.png differ
diff --git a/docs/images/platform/ssh/ssh-client-create-template-2.png b/docs/images/platform/ssh/ssh-client-create-template-2.png
index ef78dba8b0..8c64ec62b5 100644
Binary files a/docs/images/platform/ssh/ssh-client-create-template-2.png and b/docs/images/platform/ssh/ssh-client-create-template-2.png differ
diff --git a/docs/images/platform/ssh/ssh-host-ca-public-key.png b/docs/images/platform/ssh/ssh-host-ca-public-key.png
index e470aba4e3..f77034896a 100644
Binary files a/docs/images/platform/ssh/ssh-host-ca-public-key.png and b/docs/images/platform/ssh/ssh-host-ca-public-key.png differ
diff --git a/docs/images/platform/ssh/ssh-host-create-ca-1.png b/docs/images/platform/ssh/ssh-host-create-ca-1.png
index 3cdeaca0b2..f064dec357 100644
Binary files a/docs/images/platform/ssh/ssh-host-create-ca-1.png and b/docs/images/platform/ssh/ssh-host-create-ca-1.png differ
diff --git a/docs/images/platform/ssh/ssh-host-create-ca-2.png b/docs/images/platform/ssh/ssh-host-create-ca-2.png
index bad174c907..75b0fe76c6 100644
Binary files a/docs/images/platform/ssh/ssh-host-create-ca-2.png and b/docs/images/platform/ssh/ssh-host-create-ca-2.png differ
diff --git a/docs/images/platform/ssh/ssh-host-create-template-1.png b/docs/images/platform/ssh/ssh-host-create-template-1.png
index b79f0f47ea..e8ec9ec205 100644
Binary files a/docs/images/platform/ssh/ssh-host-create-template-1.png and b/docs/images/platform/ssh/ssh-host-create-template-1.png differ
diff --git a/docs/images/platform/ssh/ssh-host-create-template-2.png b/docs/images/platform/ssh/ssh-host-create-template-2.png
index ad3f17e58a..95b41be9b3 100644
Binary files a/docs/images/platform/ssh/ssh-host-create-template-2.png and b/docs/images/platform/ssh/ssh-host-create-template-2.png differ
diff --git a/docs/images/platform/ssh/ssh-host-issue-cert-1.png b/docs/images/platform/ssh/ssh-host-issue-cert-1.png
index 3dab450f45..c4483eb836 100644
Binary files a/docs/images/platform/ssh/ssh-host-issue-cert-1.png and b/docs/images/platform/ssh/ssh-host-issue-cert-1.png differ
diff --git a/docs/images/platform/ssh/ssh-host-issue-cert-2.png b/docs/images/platform/ssh/ssh-host-issue-cert-2.png
index eb0ecbcc23..ec5f677bc3 100644
Binary files a/docs/images/platform/ssh/ssh-host-issue-cert-2.png and b/docs/images/platform/ssh/ssh-host-issue-cert-2.png differ
diff --git a/docs/images/platform/ssh/ssh-host-issue-cert-3.png b/docs/images/platform/ssh/ssh-host-issue-cert-3.png
index a5af747fb8..41af0c9f32 100644
Binary files a/docs/images/platform/ssh/ssh-host-issue-cert-3.png and b/docs/images/platform/ssh/ssh-host-issue-cert-3.png differ
diff --git a/docs/images/platform/ssh/ssh-project.png b/docs/images/platform/ssh/ssh-project.png
index 0b57f9245a..9b28f04aba 100644
Binary files a/docs/images/platform/ssh/ssh-project.png and b/docs/images/platform/ssh/ssh-project.png differ