Prerequisites
- Linux system with systemd (systemd version 232 or higher recommended)
- Cerbos binary installed
- Root or sudo access for service installation
Installation
# Download latest release
curl -L https://github.com/cerbos/cerbos/releases/latest/download/cerbos_Linux_x86_64.tar.gz | \
sudo tar xz -C /usr/local/bin cerbos
# Make executable
sudo chmod +x /usr/local/bin/cerbos
# Verify installation
cerbos version
---
server:
httpListenAddr: ":3592"
grpcListenAddr: ":3593"
engine:
defaultPolicyVersion: "default"
storage:
driver: "disk"
disk:
directory: /var/cerbos/policies
watchForChanges: true
[Unit]
Description=Cerbos Policy Decision Point
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/cerbos server --config=/etc/cerbos.yaml
Restart=on-failure
RestartSec=5s
# Security hardening
ProtectSystem=full
ProtectHome=true
PrivateUsers=true
PrivateTmp=true
DynamicUser=yes
# Working directory
WorkingDirectory=/var/cerbos
# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=cerbos
[Install]
WantedBy=multi-user.target
Service Management
Basic Commands
View Logs
Configuration
Server Configuration
The default configuration file at/etc/cerbos.yaml:
Storage Backends
Environment Variables
Add environment variables to the service:/etc/cerbos/environment:
Security Hardening
Enhanced Service Configuration
A production-hardened systemd service:Create Dedicated User
File Permissions
Health Checks
Manual Health Check
Systemd Health Check
Add a health check to the service:External Monitoring
Create a separate systemd timer for health checks:/etc/systemd/system/cerbos-health.service:
/etc/systemd/system/cerbos-health.timer:
TLS Configuration
sudo mkdir -p /etc/cerbos/tls
# Generate CA key and certificate
openssl genrsa -out /etc/cerbos/tls/ca.key 4096
openssl req -new -x509 -days 365 -key /etc/cerbos/tls/ca.key \
-out /etc/cerbos/tls/ca.crt
# Generate server key and certificate
openssl genrsa -out /etc/cerbos/tls/server.key 4096
openssl req -new -key /etc/cerbos/tls/server.key \
-out /etc/cerbos/tls/server.csr
openssl x509 -req -days 365 -in /etc/cerbos/tls/server.csr \
-CA /etc/cerbos/tls/ca.crt -CAkey /etc/cerbos/tls/ca.key \
-CAcreateserial -out /etc/cerbos/tls/server.crt
server:
httpListenAddr: ":3592"
grpcListenAddr: ":3593"
tls:
cert: /etc/cerbos/tls/server.crt
key: /etc/cerbos/tls/server.key
caCert: /etc/cerbos/tls/ca.crt
Audit Logging
Enable audit logging to track all policy decisions:/etc/logrotate.d/cerbos:
Firewall Configuration
UFW (Ubuntu/Debian)
firewalld (RHEL/CentOS)
Backup and Recovery
Backup Configuration
Restore Configuration
Troubleshooting
Service Won’t Start
Permission Errors
Port Already in Use
High Memory Usage
Complete Production Example
A complete production configuration:/etc/cerbos.yaml: