diff --git a/Cargo.lock b/Cargo.lock index 242c5e7..179c210 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3015,7 +3015,7 @@ dependencies = [ [[package]] name = "rustguac" -version = "0.6.0" +version = "0.6.1" dependencies = [ "aes", "axum", diff --git a/Cargo.toml b/Cargo.toml index 35be8ea..c1fbc3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustguac" -version = "0.6.0" +version = "0.6.1" edition = "2021" description = "Lightweight Rust replacement for Apache Guacamole client" diff --git a/docs/configuration.md b/docs/configuration.md index 1ca536d..c279df8 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -95,6 +95,10 @@ Enables the Vault-backed address book. Requires `VAULT_SECRET_ID` environment va | `base_path` | `rustguac` | Base path under the mount | | `namespace` | — | Vault Enterprise / OpenBao namespace | | `instance_name` | — | Instance name for instance-scoped entries | +| `tls_skip_verify` | `false` | Skip TLS certificate verification (dev only) | +| `ca_cert` | — | Path to custom CA certificate (PEM) for verifying the Vault server | +| `client_cert` | — | Path to client certificate (PEM) for mTLS | +| `client_key` | — | Path to client private key (PEM) for mTLS (required if `client_cert` is set) | ## `[drive]` section diff --git a/docs/integrations.md b/docs/integrations.md index b515f21..4e2f2df 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -174,6 +174,35 @@ echo 'VAULT_SECRET_ID=' > /opt/rustguac/env chmod 600 /opt/rustguac/env ``` +### mTLS (client certificate authentication) + +If your Vault or OpenBao server requires mutual TLS (client certificates), add the certificate paths to the `[vault]` section: + +```toml +[vault] +addr = "https://openbao.example.com:8200" +role_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +ca_cert = "/opt/rustguac/certs/vault-ca.pem" +client_cert = "/opt/rustguac/certs/vault-client.pem" +client_key = "/opt/rustguac/certs/vault-client-key.pem" +``` + +| Field | Description | +|-------|-------------| +| `ca_cert` | Custom CA certificate (PEM) for verifying the Vault server. Use this when Vault uses a private or self-signed CA. | +| `client_cert` | Client certificate (PEM) presented to Vault for mTLS. | +| `client_key` | Client private key (PEM). Required when `client_cert` is set. | + +Ensure the certificate files are readable by the `rustguac` system user and have restrictive permissions: + +```bash +mkdir -p /opt/rustguac/certs +cp ca.pem client.pem client-key.pem /opt/rustguac/certs/ +chown rustguac:rustguac /opt/rustguac/certs/* +chmod 600 /opt/rustguac/certs/client-key.pem +chmod 644 /opt/rustguac/certs/ca.pem /opt/rustguac/certs/client.pem +``` + ### KV v2 path structure | Path | Description | diff --git a/src/api.rs b/src/api.rs index dc7faaa..933e964 100644 --- a/src/api.rs +++ b/src/api.rs @@ -2500,3 +2500,63 @@ fn html_escape(s: &str) -> String { .replace('"', """) .replace('\'', "'") } + +#[cfg(test)] +mod tests { + use super::*; + use std::path::Path; + + #[test] + fn test_html_escape_special_chars() { + assert_eq!(html_escape("