Overview
Security is critical for any VPN deployment. WireGuard Easy provides multiple layers of security including password authentication, two-factor authentication (2FA), and various hardening options.Authentication
Password Authentication
All users must authenticate with a username and password to access the WireGuard Easy web interface and API.Initial Setup
During first-time setup, you’ll create an admin account with:- Username
- Password (minimum security requirements apply)
- Optional display name and email
Password Requirements
While WireGuard Easy doesn’t enforce strict password policies by default, follow these best practices:Minimum Length
Minimum Length
Use passwords with at least 12 characters. Longer passwords are exponentially more secure.
Complexity
Complexity
Include a mix of:
- Uppercase letters (A-Z)
- Lowercase letters (a-z)
- Numbers (0-9)
- Special characters (!@#$%^&*)
Uniqueness
Uniqueness
Never reuse passwords from other services. Use a password manager to generate and store unique passwords.
Regular Rotation
Regular Rotation
Change passwords periodically, especially:
- After suspected compromise
- When team members leave
- Every 90 days for high-security environments
Changing Your Password
Via Web Interface:- Click your username in the top-right corner
- Select Account
- Navigate to Change Password
- Enter current password and new password
- Click Save
Two-Factor Authentication (2FA)
Overview
WireGuard Easy supports Time-based One-Time Password (TOTP) two-factor authentication for enhanced security. When enabled, you’ll need both your password and a 6-digit code from an authenticator app to log in.API access is currently incompatible with 2FA. If you enable 2FA, you won’t be able to use Basic Authentication for API requests.
Supported Authenticator Apps
- Google Authenticator (iOS, Android)
- Microsoft Authenticator (iOS, Android)
- Authy (iOS, Android, Desktop)
- 1Password (iOS, Android, Desktop)
- Bitwarden (iOS, Android, Desktop, Browser)
- Any TOTP-compatible authenticator
Enabling 2FA
Using 2FA
Once enabled, the login flow changes:- Enter username and password
- You’ll be prompted for a TOTP code
- Open your authenticator app
- Enter the current 6-digit code
- Click Login
Disabling 2FA
Via API:
2FA Recovery
If you lose access to your authenticator device:- If you have the secret key: Set up 2FA again on a new device using the saved secret key
- If you don’t have the secret key: You’ll need to access the server directly:
Session Management
Session Timeout
Configure how long users stay logged in:- Navigate to Admin → General
- Set Session Timeout (in seconds)
- Default: 86400 seconds (24 hours)
- Recommended: 3600 seconds (1 hour) for high-security environments
- Click Save
Remember Me
During login, users can check “Remember Me” to create a persistent session that survives browser restarts. This extends the session timeout.Session Storage
Sessions are stored server-side with encrypted cookies sent to the client. Sessions are automatically invalidated when:- The timeout period expires
- The user logs out
- The server restarts (optional, depending on session storage configuration)
API Security
Basic Authentication
The API uses HTTP Basic Authentication:API with 2FA Disabled
Currently, 2FA is incompatible with API access. If you need to use both:- Create a separate user account for API access without 2FA
- Restrict this account’s permissions
- Use a strong, unique password
- Consider IP allowlisting for this account
Securing API Endpoints
Recommendations:Use HTTPS
Always use TLS/SSL certificates. Never expose the API over HTTP.
IP Allowlisting
Restrict API access to known IP addresses using firewall rules.
Rate Limiting
Implement rate limiting at the reverse proxy level to prevent brute force attacks.
Audit Logging
Enable and monitor logs for suspicious API activity.
Network Security
Firewall Configuration
Only expose necessary ports:docker-compose.yml
Reverse Proxy with Authentication
Use a reverse proxy (Nginx, Caddy, Traefik) for additional security: Nginx example with Basic Auth:VPN Tunnel Security
WireGuard itself provides strong security, but follow these best practices:Use Pre-Shared Keys
Use Pre-Shared Keys
Regular Key Rotation
Regular Key Rotation
Periodically delete and recreate client configurations to rotate keys.Consider rotating keys:
- Every 90 days for normal environments
- Every 30 days for high-security environments
- Immediately after suspected compromise
Disable Unused Clients
Disable Unused Clients
Instead of deleting clients, disable them first. This allows you to re-enable if needed.
Set Client Expiration
Set Client Expiration
Use the expiration feature for temporary access.
Metrics Security
When exposing metrics endpoints (Prometheus), ensure they’re secured:Bearer Token Authentication
- Navigate to Admin → General
- Enable Prometheus metrics
- Set a strong Metrics Password (bearer token)
- Click Save
Network Restrictions
Restrict metrics endpoints to monitoring systems only:Docker Security
Minimal Capabilities
WireGuard Easy requires certain Linux capabilities. Only grant what’s necessary:docker-compose.yml
Read-Only Root Filesystem
Run with a read-only root filesystem where possible:User Namespace Remapping
Enable Docker user namespace remapping to reduce privilege escalation risks:/etc/docker/daemon.json
Security Scanning
Regularly scan the WireGuard Easy image for vulnerabilities:Environment Variables Security
Sensitive Variables
Never commit sensitive environment variables to version control:docker-compose.yml
Environment Variable Encryption
For production, use secrets management: Docker Swarm:Audit Logging
Enable Logging
Monitor all access and changes:Log Shipping
Ship logs to a centralized logging system:docker-compose.yml
Important Events to Monitor
- Failed login attempts
- Successful logins (especially from new IPs)
- Client creation/deletion
- Configuration changes
- API access
- 2FA enable/disable events
Incident Response
Suspected Compromise
If you suspect a security breach:Security Checklist
Use this checklist to ensure your deployment is secure:- Strong admin password (12+ characters, mixed case, numbers, symbols)
- 2FA enabled for all admin accounts
- HTTPS/TLS enabled (not HTTP)
- Web UI access restricted by IP (not exposed to internet)
- API access restricted or disabled
- Firewall rules configured (only necessary ports open)
- Pre-shared keys enabled for all clients
- Client expiration dates set for temporary access
- Unused clients disabled or deleted
- Metrics endpoint secured with bearer token
- Docker running with minimal capabilities
- Environment variables stored securely (not in version control)
- Audit logging enabled and monitored
- Regular security updates applied
- Backup and disaster recovery plan in place
Best Practices Summary
Defense in Depth
Use multiple layers of security: strong passwords, 2FA, network restrictions, and monitoring.
Principle of Least Privilege
Grant only the minimum necessary permissions to users, services, and processes.
Regular Updates
Keep WireGuard Easy and dependencies up to date with security patches.
Monitor and Audit
Enable logging, review logs regularly, and set up alerts for suspicious activity.
Related Documentation
- 2FA User Guide - Detailed 2FA setup instructions
- API Reference - Secure API usage
- Metrics & Monitoring - Secure metrics configuration
- Hooks - Security considerations for hooks