Skip to main content
Proper security configuration is critical for protecting your Pterodactyl Panel installation. This guide covers SSL/TLS, proxy configuration, session security, and other security-related settings.

SSL/TLS Configuration

Application URL

Always use HTTPS in production:
.env
Critical: Using HTTP in production exposes user credentials and session cookies to interception.

Force HTTPS

The Panel automatically enforces HTTPS when APP_URL uses https://. Ensure your web server (Nginx/Apache) is configured to redirect HTTP to HTTPS.

Trusted Proxies

What are Trusted Proxies?

When the Panel runs behind a reverse proxy (Cloudflare, load balancer, etc.), the Panel sees the proxy’s IP address instead of the client’s. Configuring trusted proxies allows the Panel to read the real client IP from proxy headers.

Configuration

.env
string
Comma-separated list of trusted proxy IP addresses or CIDR ranges.Special values:
  • * - Trust the directly connected proxy only
  • ** - Trust all proxies in the chain
  • 192.168.1.1,10.0.0.0/8 - Specific IPs or CIDR ranges

Common Configurations

Security Risk: Only set TRUSTED_PROXIES=** if you fully control all proxies in the chain. Malicious proxies can spoof client IPs.

Verifying Proxy Configuration

Check if the Panel sees the correct client IP:

Session Security

Session Configuration

.env
string
default:"redis"
Session storage driver. Use redis or database in production, never file.
integer
default:"720"
Session lifetime in minutes (12 hours by default).
boolean
default:"true"
Encrypt session data before storage.
Always keep this enabled in production.
Only send session cookies over HTTPS. Auto-detected from APP_URL if not set.
Must be enabled when using HTTPS, or users will be logged out.
boolean
default:"true"
Prevent JavaScript from accessing session cookies.
Never disable! This protects against XSS attacks stealing session cookies.
string
default:"lax"
SameSite cookie attribute. Options:
  • lax - Balanced security (recommended)
  • strict - Maximum security, may break some workflows
  • none - Allow cross-site requests (requires secure flag)
.env
Session cookie name. Auto-generated from APP_NAME if not set.
string
Cookie domain. Leave empty to use the current domain.
Set to .example.com (with leading dot) to share sessions across subdomains.
string
default:"/"
Cookie path. Usually should remain /.

Encryption Key Management

Application Key

.env
The APP_KEY is used to encrypt:
  • Session data
  • Cookies
  • Database encrypted fields
  • Signed URLs
Never share or commit your APP_KEY to version control!Changing this key will:
  • Log out all users
  • Invalidate all encrypted data
  • Break password reset tokens

Generating a New Key

Key Rotation

To rotate the encryption key without breaking existing data:
  1. Add the current key to APP_PREVIOUS_KEYS:
    .env
  2. Generate a new key:
  3. Laravel will attempt to decrypt data with old keys if the current key fails.

Debug Mode

.env
boolean
default:"false"
Enable detailed error messages and stack traces.
Critical Security Risk! Debug mode exposes:
  • Environment variables (including passwords)
  • Database queries
  • File paths
  • Application internals
NEVER enable in production!

Safe Error Reporting

For production error tracking, use error monitoring services:
.env

Password Security

The Panel uses bcrypt for password hashing. No additional configuration needed.

Password Requirements

Password requirements are enforced at the application level:
  • Minimum 8 characters
  • No maximum length
  • No character requirements (allowing passphrases)

Two-Factor Authentication

Encourage users to enable 2FA:
  1. User account → Security → Two-Factor Authentication
  2. Scan QR code with authenticator app
  3. Enter verification code
Consider making 2FA mandatory for administrator accounts.

Security Headers

Configure security headers in your web server:

Header Explanations

Prevents browsers from MIME-sniffing responses away from the declared content-type.X-Content-Type-Options: nosniff
Prevents clickjacking attacks by controlling whether the page can be embedded in frames.X-Frame-Options: SAMEORIGIN - Allow framing only from the same origin.
Enables browser’s XSS filtering (legacy, but still useful for older browsers).X-XSS-Protection: 1; mode=block
Controls how much referrer information is included with requests.Referrer-Policy: same-origin - Only send referrer for same-origin requests.
Controls which resources the browser is allowed to load, preventing XSS and injection attacks.
The Panel requires unsafe-inline and unsafe-eval for JavaScript functionality.
Forces browsers to only use HTTPS connections.Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Only enable HSTS after verifying HTTPS works correctly. Once enabled, browsers will refuse HTTP connections for the specified duration.

Firewall Configuration

Required Ports

Only expose necessary ports to the internet:
Never expose database or Redis ports to the public internet!

UFW Firewall

File Permissions

Proper file permissions prevent unauthorized access:
Never set permissions to 777 or run the Panel as root!

Security Checklist

1

Use HTTPS

Configure SSL/TLS with a valid certificate (Let’s Encrypt recommended).
2

Disable Debug Mode

Set APP_DEBUG=false in production.
3

Secure Environment File

Set .env permissions to 600 and never commit to version control.
4

Configure Trusted Proxies

Set TRUSTED_PROXIES if behind a reverse proxy or CDN.
5

Enable Session Security

Verify SESSION_ENCRYPT, SESSION_SECURE_COOKIE, and SESSION_HTTP_ONLY are enabled.
6

Secure Database Access

Use strong passwords and restrict access to localhost or private network.
7

Secure Redis

Set REDIS_PASSWORD and bind to localhost.
8

Configure Firewall

Only expose ports 80 and 443 to the public internet.
9

Set File Permissions

Follow the principle of least privilege for file permissions.
10

Enable 2FA

Enable two-factor authentication for all administrator accounts.
11

Regular Updates

Keep the Panel, PHP, and system packages up to date.
12

Monitor Logs

Regularly review logs for suspicious activity:

Additional Resources

Let's Encrypt SSL

Free SSL/TLS certificates with automatic renewal.

Mozilla SSL Config

Generate secure SSL configurations for your web server.

Security Headers

Test your site’s security headers.

SSL Labs Test

Test your SSL/TLS configuration.