Skip to main content

Overview

Proper security configuration is essential for production Sunshine deployments. This guide covers authentication, network security, firewall configuration, and encryption setup.
Sunshine is designed for trusted networks. Exposing Sunshine directly to the internet without proper security measures can compromise your system.

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
Port offsets:
  • 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
Encryption reduces streaming performance, especially on lower-end hardware.

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:
Not all Moonlight clients support ECDSA keys. Use RSA-2048 for best compatibility.

Reverse Proxy

For advanced deployments, use a reverse proxy:

NGINX Configuration

sunshine.conf
Reverse proxies only work for the web UI. Streaming traffic must go directly to Sunshine.

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

  1. Never expose Sunshine directly to the internet - Use a VPN for remote access
  2. Use strong, unique passwords - Store credentials in a password manager
  3. Enable encryption - Especially for WAN streaming
  4. Keep Sunshine updated - Apply security patches promptly
  5. Audit paired clients regularly - Remove unused devices
  6. Restrict web UI access - Use origin_web_ui_allowed = lan
  7. Use firewall rules - Allow only necessary ports
  8. Monitor logs - Watch for suspicious activity
  9. Use system service - Run with minimal privileges
  10. Backup credentials - Store certificates securely