mirror of
https://github.com/taigrr/nats.docs
synced 2025-01-18 04:03:23 -08:00
961 B
961 B
Securing NATS
The nats-server provides several forms of security:
- Connections can be encrypted with TLS
- Client connections can require authentication
- Clients can require authorization for subjects the publish or subscribe to
Server TLS Configuration
TLS server configuration revolves around two options:
cert_file
- the server's certificatekey_file
- the server's key file
You can configure tls on the configuration file:
tls: {
cert_file: "./server-cert.pem"
key_file: "./server-key.pem"
}
Or by using server options:
> nats-server --tls --tlscert=./server-cert.pem --tlskey=./server-key.pem
More advanced configurations require additional options:
ca_file
- a certificate file providing the trust chain for the certificate authority (CA). Used to validate client certificates.verify
- set totrue
if you want to verify client certs against theca_file
certificate.