Skip to content

Security Guide

Security considerations for self-hosting DesterLib.

Recommended for: Most users

Keep DesterLib on your local network:

  • ✅ No port forwarding
  • ✅ No public exposure
  • ✅ Access via LAN only
  • ✅ Use Tailscale for remote access

Only if necessary, and follow these rules:

  1. Use HTTPS (reverse proxy required)
  2. Monitor access logs regularly
  3. Use strong database passwords
  4. Keep system updated
  5. Enable authentication (when available)

Generate secure password:

Terminal window
openssl rand -base64 32

Use in your configuration:

DATABASE_URL=postgresql://desterlib:GENERATED_PASSWORD_HERE@postgres:5432/desterlib?schema=public

Default (Secure):

postgres:
ports:
- "127.0.0.1:5432:5432" # Localhost only

Insecure (Avoid):

postgres:
ports:
- "0.0.0.0:5432:5432" # Exposed to network ❌

Media files are mounted read-only:

volumes:
- /path/to/media:/media:ro # :ro prevents writes

DesterLib can’t modify your media files.

Containers run in isolated network:

networks:
desterlib-net:
driver: bridge

Keep Docker images updated:

Terminal window
docker compose pull
docker compose up -d

Recommended permissions:

Terminal window
# Server can read, but not write
chmod -R 755 /path/to/media

Protect sensitive files:

Terminal window
chmod 600 ~/.desterlib/.env # Only owner can read/write
chmod 644 ~/.desterlib/docker-compose.yml

Install Caddy:

Terminal window
sudo apt install caddy # Ubuntu/Debian
brew install caddy # macOS

Configure (Caddyfile):

desterlib.yourdomain.com {
reverse_proxy localhost:3001
}

Start:

Terminal window
sudo caddy start

Caddy automatically:

  • ✅ Gets Let’s Encrypt certificate
  • ✅ Renews certificates
  • ✅ Redirects HTTP → HTTPS

Install:

Terminal window
sudo apt install nginx certbot python3-certbot-nginx

Configure nginx:

server {
listen 80;
server_name desterlib.yourdomain.com;
location / {
proxy_pass http://localhost:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}

Get certificate:

Terminal window
sudo certbot --nginx -d desterlib.yourdomain.com
Terminal window
# Allow SSH (don't lock yourself out!)
sudo ufw allow ssh
# Allow DesterLib
sudo ufw allow 3001/tcp
# If using HTTPS
sudo ufw allow 443/tcp
# Enable firewall
sudo ufw enable
Terminal window
sudo firewall-cmd --permanent --add-port=3001/tcp
sudo firewall-cmd --reload

System Preferences → Security & Privacy → Firewall → Firewall Options

  • Add Docker.app
  • Allow incoming connections

Watch for suspicious activity:

Terminal window
# Monitor API access
docker compose logs -f api | grep -E "POST|PUT|DELETE"
# Monitor errors
docker compose logs -f api | grep -i error

Monitor rate limiting:

Terminal window
docker compose logs api | grep "Too many requests"

If you see many, someone may be abusing your API.

When authentication is implemented:

  • JWT-based authentication
  • User registration and login
  • Role-based access control
  • API key management
  • Session management

Use network-level security:

  • Keep on private network
  • Use VPN (Tailscale)
  • Use reverse proxy with auth (Authelia, OAuth2 Proxy)

High priority:

  • Database (has your library metadata)
  • .env file (has credentials)

Low priority:

  • Docker images (public)
  • docker-compose.yml (no secrets if using .env)

Database encryption:

  • PostgreSQL doesn’t encrypt by default
  • Use disk encryption at OS level (LUKS, FileVault, BitLocker)

Transport encryption:

  • Use HTTPS for remote access
  • Tailscale encrypts all traffic automatically
  1. Immediately:

    Terminal window
    docker compose down
  2. Change all passwords:

    • Database password
    • Update in .env and docker-compose.yml
  3. Review logs:

    Terminal window
    docker compose logs api > incident-logs.txt
  4. Restore from backup:

    • See installation guide for backup procedures
  5. Update everything:

    Terminal window
    docker compose pull
    docker compose up -d

Before going to production:

  • Strong database password (32+ characters)
  • .env file has correct permissions (600)
  • Media mounted read-only (:ro)
  • Firewall configured
  • Using HTTPS (if exposed to internet)
  • Regular backups configured
  • Monitoring in place
  • Keep containers updated weekly

Found a security vulnerability?

DO NOT open a public issue.

Email: security@dester.in (or GitHub security advisory)

We’ll respond within 48 hours.