Security Overview
Running a public Pokemon Showdown server requires careful attention to security. This guide covers essential security practices to protect your server and users.Production Checklist
Before running your server in production, verify these critical security settings:Restrict Console Access
Limit developer console access to localhost only:Or disable it entirely:
config/config.js
config/config.js
Review Backdoor Setting
Decide whether to allow Pokemon Showdown system operators access:
config/config.js
The backdoor allows Pokemon Showdown developers to help with technical support but gives them full admin access.
Network Security
HTTPS/SSL Configuration
Always use HTTPS in production to encrypt traffic:config/config.js
The Pokemon Showdown client requires port 443 for SSL connections. Use Let’s Encrypt for free SSL certificates.
Let’s Encrypt Setup
Reverse Proxy
Consider using a reverse proxy like nginx for additional security:nginx.conf
config/config.js
Firewall Configuration
Use a firewall to restrict access:ufw
Access Control
Administrator Privileges
Minimal Admins
Only grant Administrator (~) rank to the server owner and highly trusted individuals.
Console Restriction
Never give console permission to anyone except the server owner. Console allows arbitrary code execution.
Regular Audits
Periodically review
config/usergroups.csv and remove inactive admins.Secure Credentials
Ensure all admin accounts use strong, unique passwords.
Permission Hierarchy
Follow the principle of least privilege:- Administrators (~) - Server owner only
- Moderators (@) - Highly trusted, experienced staff
- Drivers (%) - Active, trustworthy moderators
- Voice (+) - Trusted community members
- Regular users - Everyone else
Console Access
The developer console is the most dangerous feature:config/config.js
User Security
Anti-Abuse Features
Enable security features to combat abuse:config/config.js
Rate Limiting
Throttles prevent abuse and DoS attacks:- Rename throttling (prevent rapid name changes)
- Chat message throttling (prevent spam)
- Challenge throttling (prevent harassment)
- Ladder search throttling (prevent abuse)
IP-Based Protection
IP checking helps identify alt accounts and ban evaders:config/config.js
- Alt account detection
- Ban evasion prevention
- Shared IP identification
- Connection limiting
Data Protection
Sensitive Files
Protect sensitive configuration files:.gitignore
Logging
Enable comprehensive logging for security auditing:config/config.js
logs/chat/- Chat room logslogs/modlog/- Moderation actionslogs/repl/- Console usage- Punishment files
Regularly review logs for suspicious activity. Archive old logs and implement log rotation.
Database Security
Pokemon Showdown stores data in TSV files:- Daily: User groups and punishments
- Weekly: Full server backup
- Monthly: Archive backups off-site
Server Hardening
System Updates
Keep your system and dependencies updated:Set up automated security updates for your operating system.
Process Management
Use a process manager to automatically restart crashed servers:ecosystem.config.js
Dedicated User
Run Pokemon Showdown as a dedicated non-root user:Monitoring
Server Monitoring
Monitor server health and performance:Security Monitoring
Watch for suspicious activity:- Failed login attempts - Monitor authentication failures
- Unusual IP patterns - Track connections from suspicious IPs
- Privilege escalation - Log all rank changes
- Console usage - Audit all console commands
- Punishment patterns - Identify serial offenders
Automated Alerts
Set up alerts for critical events:config/config.js
- UptimeRobot - Server availability monitoring
- Sentry - Error tracking and reporting
- LogRocket - User session replay
Incident Response
Security Breach Protocol
If your server is compromised:Assess Damage
- Review console logs
- Check moderation logs
- Verify user data integrity
- Identify compromised accounts
Reset Credentials
- Change all admin passwords
- Regenerate SSL certificates if needed
- Review and update
config/usergroups.csv - Reset any compromised accounts
Patch Vulnerability
- Update to latest Pokemon Showdown version
- Apply security patches
- Review configuration for weaknesses
- Implement additional security measures
Restore Service
- Verify all security measures in place
- Restore from clean backup if necessary
- Restart server
- Monitor closely for further issues
Security Best Practices Summary
Defense in Depth
Use multiple security layers: firewall, SSL, authentication, rate limiting
Least Privilege
Give users and processes only the minimum permissions needed
Regular Updates
Keep all software updated with latest security patches
Monitor Everything
Enable logging and monitoring for all security-relevant events
Backup Regularly
Maintain regular backups and test restoration procedures
Security Audits
Periodically review security settings and access logs
Additional Resources
Report Security Issues
If you discover a security vulnerability in Pokemon Showdown itself, report it to the development team at:[email protected]Do not disclose vulnerabilities publicly until they have been patched.
Next Steps
Configuration
Review all configuration options
Administration
Learn user management and moderation
