Overview
Proper security configuration is essential for production Sunshine deployments. This guide covers authentication, network security, firewall configuration, and encryption setup.Authentication
Web UI Authentication
Sunshine requires authentication for the web UI and configuration access.Initial Setup
On first launch, Sunshine prompts you to create credentials:Reset Credentials
If you forget your credentials:Client Pairing Authentication
Moonlight clients must pair with Sunshine using a PIN.Unpair Clients
Remove compromised or unused clients:Network Security
Web UI Access Control
Restrict web UI access by origin:sunshine.conf
Bind Address
Restrict which network interface Sunshine listens on:Port Configuration
Change default ports to reduce attack surface:sunshine.conf
- Base port:
47989(configurable) - Web UI: Base + 21 (
48010) - TCP streaming: Base - 5 to Base + 1 (
47984-47990) - UDP streaming: Base + 9 to Base + 11 (
47998-48000)
Address Family
Control IPv4/IPv6 usage:sunshine.conf
Using IPv4 only reduces attack surface but limits IPv6 clients.
Firewall Configuration
Linux (iptables)
Allow Sunshine Ports
Restrict to LAN Only
Linux (firewalld)
Create Service Definition
sunshine.xml
Apply Rules
Linux (UFW)
Windows Firewall
Using Installer
The Windows installer automatically creates firewall rules.Manual Configuration
Restrict to Private Network
Encryption
Stream Encryption
Sunshine supports encryption for both LAN and WAN streaming.LAN Encryption
sunshine.conf
WAN Encryption
sunshine.conf
WAN encryption is enabled by default (
wan_encryption_mode = 1).HTTPS/TLS for Web UI
Sunshine automatically generates self-signed certificates for HTTPS.Default Certificates
Certificates are stored in:
Files:
cakey.pem- Private key (RSA-2048)cacert.pem- Certificate
Custom Certificates
Replace default certificates with your own:Use Let’s Encrypt Certificate
For production deployments with a domain:Reverse Proxy
For advanced deployments, use a reverse proxy:NGINX Configuration
sunshine.conf
VPN Configuration
For secure remote access, use a VPN:WireGuard
Access Sunshine via VPN IP:https://10.0.0.1:47990
Security Checklist
Security Best Practices
- Never expose Sunshine directly to the internet - Use a VPN for remote access
- Use strong, unique passwords - Store credentials in a password manager
- Enable encryption - Especially for WAN streaming
- Keep Sunshine updated - Apply security patches promptly
- Audit paired clients regularly - Remove unused devices
- Restrict web UI access - Use
origin_web_ui_allowed = lan - Use firewall rules - Allow only necessary ports
- Monitor logs - Watch for suspicious activity
- Use system service - Run with minimal privileges
- Backup credentials - Store certificates securely

