ServiceRadar supports multiple security modes for gRPC communication between components. Choose the mode that best fits your environment and security requirements.
The simplest secure configuration uses basic TLS:
{
"security": {
"mode": "tls",
"cert_dir": "/etc/serviceradar/certs"
}
}
{
"security": {
"mode": "none"
}
}
Provides encryption and server authentication:
{
"security": {
"mode": "tls",
"cert_dir": "/etc/serviceradar/certs"
}
}
Required files in cert_dir:
ca.crt
: Certificate Authority certificateserver.crt
: Server certificateserver.key
: Server private key
Provides encryption with both server and client authentication:
{
"security": {
"mode": "mtls",
"cert_dir": "/etc/serviceradar/certs"
}
}
Required files in cert_dir:
ca.crt
: Certificate Authority certificateserver.crt
: Server certificateserver.key
: Server private keyclient.crt
: Client certificateclient.key
: Client private key
Zero-trust workload identity using SPIFFE:
{
"security": {
"mode": "spiffe",
"trust_domain": "example.org",
"workload_socket": "unix:/run/spire/sockets/agent.sock"
}
}
apiVersion: v1
kind: Pod
metadata:
name: serviceradar
spec:
containers:
- name: serviceradar
image: serviceradar:latest
env:
- name: SR_SECURITY_MODE
value: "spiffe"
- name: SR_TRUST_DOMAIN
value: "example.org"
volumeMounts:
- name: spire-socket
mountPath: /run/spire/sockets
readOnly: true
volumes:
- name: spire-socket
hostPath:
path: /run/spire/sockets
type: Directory
apiVersion: v1
kind: Pod
metadata:
name: serviceradar
spec:
containers:
- name: serviceradar
image: serviceradar:latest
env:
- name: SR_SECURITY_MODE
value: "mtls"
- name: SR_CERT_DIR
value: "/etc/serviceradar/certs"
volumeMounts:
- name: certs
mountPath: /etc/serviceradar/certs
readOnly: true
volumes:
- name: certs
secret:
secretName: serviceradar-certs
For testing or development environments, you can generate self-signed certificates using the provided tool:
# Generate basic TLS certificates
serviceradar cert generate --dir /etc/serviceradar/certs
# Generate mTLS certificates (includes client certs)
serviceradar cert generate --dir /etc/serviceradar/certs --mtls
# View certificate information
serviceradar cert info --dir /etc/serviceradar/certs
If you have an existing PKI infrastructure, place your certificates in the configured certificate directory:
# Example directory structure
/etc/serviceradar/certs/
├── ca.crt
├── server.crt
├── server.key
├── client.crt # Only needed for mTLS
└── client.key # Only needed for mTLS
ServiceRadar automatically detects and reloads certificates when they change. For SPIFFE mode, certificate rotation is handled automatically by the SPIFFE Workload API.
All security settings can be configured via environment variables:
# Security mode
export SR_SECURITY_MODE=mtls
# Certificate directory for TLS/mTLS modes
export SR_CERT_DIR=/etc/serviceradar/certs
# SPIFFE configuration
export SR_TRUST_DOMAIN=example.org
export SR_WORKLOAD_SOCKET=unix:/run/spire/sockets/agent.sock
- Always use a secure mode in production environments
- Regularly rotate certificates
- Use mTLS or SPIFFE for zero-trust environments
- Keep private keys protected (0600 permissions)
- Monitor certificate expiration
- Use separate certificates for different components
Common issues and solutions:
-
Certificate not found errors
- Verify certificate paths
- Check file permissions
- Ensure certificates are in PEM format
-
SPIFFE Workload API connection issues
- Check SPIFFE agent is running
- Verify socket path and permissions
- Confirm trust domain configuration
-
mTLS authentication failures
- Verify client and server certificates are signed by the same CA
- Check certificate expiration dates
- Confirm trust domain matches (SPIFFE mode)
For more detailed security configuration and best practices, see the full documentation.