User Guide
Everything you need to install, configure, and build with Montycat — from getting started to governance, advanced operations, and security.
Security
Security overview
Montycat combines multiple layers of security by default: safe API design, TLS, encrypted credentials, system file integrity, and enforced secret management.
While other databases offer some of these features individually, Montycat integrates them seamlessly, making it easier to deploy a secure database out-of-the-box—and reducing reliance on user configuration.
From eliminating raw database injections to providing native encryption in transit, Montycat ensures your data remains safe and confidential.
Montycat does not allow raw queries, which eliminates the risk of SQL-style injection attacks present in many legacy databases.
All operations are performed through safe, structured APIs, ensuring that user inputs cannot directly manipulate the underlying database engine.
Montycat has native TLS support, encrypting all communication between the database server and its clients.
Enabling TLS ensures that data in transit cannot be intercepted or tampered with.
Default path to certificates: /var/lib/.montycat on Linux and home directories on Windows and MacOS.
Note: Where a trusted certificate authority is available, use it. Self-signed certificates are the right answer for closed networks and internal deployments that no public CA can issue for — Montycat can generate one for you; see Self-signed certificates below.
Note for Rust Client: In order to use TLS with the Rust client, ensure you include the TLS feature flag in your Cargo.toml. Then call engine.enable_tls() for a publicly trusted certificate:
montycat = { version = "1", features = ["tls"] }
Enabling TLS
montycat tls-paths --cert <absolute path> --key <absolute path>or
montycat console
> tls-paths cert <absolute path> key <absolute path>
exitMake sure the certificate and key files have the correct permissions on UNIX-based systems.
Within Docker, you can set TLS paths using environment variables, and mount the certificate files as volumes.
FROM montygovernance/montycat:latest
# MONTYCAT_TLS_CERT and MONTYCAT_TLS_KEY paths
ENV MONTYCAT_TLS_CERT=/path/to/tls.crt
ENV MONTYCAT_TLS_KEY=/path/to/tls.keyConnecting clients with TLS
TLS must also be enabled by the client. The setting applies to regular commands and subscriptions.
from montycat import Engine
connection = Engine(
host="db.example.com",
port=21210,
username="USER",
password="PASSWORD",
store="Company",
tls=True,
)Self-signed certificates
Montycat can generate its own certificate, so an install can serve encrypted traffic without a certificate authority, an openssl binary, or a mounted certificate. Generation happens inside the engine and writes the key with 0600 permissions and the certificate with 0644.
There are two ways to trigger it. Set MONTYCAT_INIT_SELF_TLS=true and the certificate is generated at startup before any listener binds, so TLS is active on that same run — this is the right choice for containers. Or run init-self-tls in the console on a server that is already up; that reaches listeners which are already bound, so it reports restart_required and TLS activates on the next restart.
Both are idempotent: existing certificate material is never replaced unless force is given explicitly (MONTYCAT_TLS_FORCE=true, or force true in the console). Restarting a container does not churn the certificate.
FROM montygovernance/montycat:latest
# Generate a self-signed certificate on startup, before any listener binds.
# Only this variable is required; the rest are optional.
ENV MONTYCAT_INIT_SELF_TLS=true
# Identities clients will use. 0.0.0.0 is a bind address, not an identity,
# so put the address clients actually dial here.
ENV MONTYCAT_TLS_IP_ADDRESSES=192.168.1.20
ENV MONTYCAT_TLS_DNS_NAMES=montycat,db.example.com
ENV MONTYCAT_TLS_VALIDITY_DAYS=365
ENV MONTYCAT_TLS_FORCE=falseBinding to 0.0.0.0 means "accept connections on every interface". It is not an address a client dials, so it is deliberately not put in the certificate, and neither is ::.
With no configuration the certificate covers DNS:localhost, IP:127.0.0.1, and IP:::1 for 365 days — enough for local use. For anything else, pass the address clients actually use via MONTYCAT_TLS_IP_ADDRESSES (bare-IP deployments need no DNS names at all) or MONTYCAT_TLS_DNS_NAMES. A certificate whose identities do not include the dialed address will fail verification even though it is otherwise valid.
A self-signed certificate encrypts traffic, but nothing vouches for who is on the other end unless the client is told to trust that specific certificate. The Node, Python, and Dart clients currently accept any server certificate — traffic is encrypted but the server is not authenticated.
Rust is different: its client verifies the certificate chain and the server hostname. For a private CA or a Montycat-generated self-signed certificate, pass the generated PEM certificate explicitly: engine.with_tls_ca_file("/path/to/tls.crt")?. This also enables TLS. The hostname or IP used by the client must appear in the certificate's Subject Alternative Names; otherwise the connection is rejected.
Generation returns a SHA-256 fingerprint. Note it down and compare it out of band when distributing the certificate; verified TLS is the goal, and the fingerprint is how it will be pinned.
One more exposure to know about: init-self-tls sent to a server that does not yet have TLS travels over plaintext, credentials included. On an untrusted network use MONTYCAT_INIT_SELF_TLS=true at startup instead — it needs no network round trip.
Missing or unusable certificate material never prevents the server from starting, but it is always reported. No certificate configured logs at info; a certificate that is configured but broken — unparseable, half-present, or a key that does not belong to the certificate — logs at error with both paths and states that the listener is continuing in plaintext. Each listener also reports the mode it came up in, so check the logs after enabling TLS rather than assuming it took.
File system
All system files in Montycat are hashed and monitored for integrity.
Any unauthorized access attempts or manual modifications to configuration or system parameters will be detected immediately and result in startup failures or operational errors, ensuring that tampering is prevented and the system remains secure.
Montycat encrypts credential files and other sensitive system files automatically.
During startup:
- Montycat reads the initial secret stored locally.
- Decrypts credentials and system files.
- Loads them into memory for runtime usage.
This default approach is suitable for testing and development but not recommended for production.
Recommended Production Setup:
- Use a dedicated environment variable with a strong secret.
You can generate a new secret
montycat generate-new-secretor
montycat console
> generate-new-secret
exitExample output (44-character random secret):
Yp9KfAq2VWxB3j7N9GhRtUb5MzLsQeDcXo1K8nZyPwEr
Setting the Production Secret:
montycat console
> set-prod-secret <secret>
exitThis command removes the initial Montycat secret file.
The new secret is temporarily stored as a local environment variable.
For production, you must set it globally at the system level, otherwise Montycat will not start.
Set secret variable with Docker.
FROM montygovernance/montycat:latest
MONTYCAT_PROD_SECRET=<your_secret>Role-Based Access Control (RBAC)
Montycat includes fine-grained role-based access controls for managing database privileges:
- Superowner — has full control over the database, including system-level operations and ownership delegation.
- Owners — responsible for specific resources. Owners cannot override superowner privileges but maintain full autonomy over their assigned domains.
This ensures separation of duties, prevents privilege escalation, and provides administrators with enterprise-grade access control built-in by default.
Best Practices for Maximum Security
Always use TLS in production to encrypt all traffic.
Use strong, randomly generated secrets for credentials encryption.
Do not store secrets in plaintext; prefer environment variables or secure vault solutions.
Restrict file permissions on key and certificate files to minimize exposure.
Regularly rotate secrets and certificates for ongoing security compliance.
Apply Montycat's RBAC model to enforce least-privilege and reduce insider risk.