Menu
 

TeamSpeak Security Hardening Guide

TeamSpeak: Complete Security Hardening Guide

Comprehensive guide to securing TeamSpeak servers against threats, implementing access controls, protecting against DDoS attacks, and maintaining security best practices.

Security Assessment Overview

Common Threat Vectors

  • Unauthorized Access: Brute force attacks on server query and admin accounts
  • DDoS Attacks: Network-level attacks targeting TeamSpeak ports
  • Griefing: Malicious users disrupting server operations
  • Spam/Flooding: Channel and chat flooding attacks
  • Data Breaches: Exposure of user information and communications

Security Layers

🌐 Network Security

Firewall rules, DDoS protection, port security

🔐 Application Security

Access controls, authentication, encryption

⚙️ Operational Security

Monitoring, logging, incident response

Network Security Configuration

Firewall Rules

# iptables rules for TeamSpeak (Linux) # Allow established connections iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # Allow TeamSpeak ports from trusted IPs only iptables -A INPUT -p udp -s 192.168.1.0/24 --dport 9987 -j ACCEPT iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 10011 -j ACCEPT iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 30033 -j ACCEPT # Allow SSH from admin IPs only iptables -A INPUT -p tcp -s 192.168.1.100 --dport 22 -j ACCEPT # Drop everything else iptables -A INPUT -j DROP # UFW alternative (Ubuntu/Debian) ufw allow from 192.168.1.0/24 to any port 9987 proto udp ufw allow from 192.168.1.0/24 to any port 10011 proto tcp ufw allow from 192.168.1.0/24 to any port 30033 proto tcp ufw enable

DDoS Protection Setup

CloudFlare Integration

# TeamSpeak behind CloudFlare (UDP proxy) # Domain: teamspeak.example.com # DNS: A record pointing to server IP # CloudFlare settings: # - Enable DDoS protection # - Set security level to High # - Enable rate limiting # - Block common attacks # Configure TeamSpeak to use domain ts3server_startscript.sh start \ default_voice_port=9987 \ filetransfer_port=30033 \ query_port=10011 \ license_accepted=1

Rate Limiting Configuration

# TCP rate limiting (iptables) iptables -A INPUT -p tcp --dport 10011 -m limit --limit 3/min --limit-burst 5 -j ACCEPT iptables -A INPUT -p tcp --dport 30033 -m limit --limit 10/min --limit-burst 15 -j ACCEPT # UDP connection limiting iptables -A INPUT -p udp --dport 9987 -m connlimit --connlimit-above 100 -j REJECT # Syn-flood protection iptables -A INPUT -p tcp --syn -m limit --limit 1/s -j ACCEPT iptables -A INPUT -p tcp --syn -j DROP

Access Control Implementation

Server Query Security

# ts3server.ini security settings [Query] # Enable whitelist for server query query_ip_whitelist = 127.0.0.1,192.168.1.100,192.168.1.101 # Limit query attempts query_bruteforce_protection = 1 query_bruteforce_threshold = 5 query_bruteforce_bantime = 600 # Set query password query_password = "your_secure_query_password" # Disable query for non-whitelisted IPs query_ip_blacklist = 0.0.0.0/0

Admin Account Security

# Create secure admin account using server query # Connect to server query telnet localhost 10011 # Login with server admin login serveradmin your_serveradmin_password # Create new admin with secure password servercreate virtualserver_name="Secure TS3 Server" \ virtualserver_maxclients=100 \ virtualserver_port=9987 # Create admin account with strong password serveradmin_add \ client_login_name=secureadmin \ client_login_password=SuperSecurePassword123!@# # Set proper permissions servergroupadd name="Secure Admin" sgid=6 type=1 servergroupaddclient sgid=6 cldbid=2

Channel Security

# Secure channel configuration # Set channel permissions channeladd permname="Admin" cpid=1 \ channel_flag_password=1 \ channel_password_strong="AdminPassword123" \ channel_needed_talk_power=60 # Create private channels with required permissions channeladd permname="Private" cpid=2 \ channel_flag_maxfamily_unlimited=0 \ channel_flag_maxclients_unlimited=0 \ channel_maxfamily=10 \ channel_maxclients=5 # Set join power requirements channeladdperm cpid=2 permid=50 permvalue=50 permneg=0 permskip=0 channeladdperm cpid=2 permid=51 permvalue=75 permneg=0 permskip=0

Authentication & Encryption

SSL/TLS Configuration

# Generate SSL certificate openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ -keyout /opt/teamspeak3-server_linux_amd64/ts3server.key \ -out /opt/teamspeak3-server_linux_amd64/ts3server.crt \ -subj "/C=US/ST=State/L=City/O=Organization/CN=teamspeak.example.com" # Configure TeamSpeak for SSL ts3server_startscript.sh start \ default_voice_port=9987 \ filetransfer_port=30033 \ query_port=10011 \ license_accepted=1 \ voice_ip=0.0.0.0 \ query_ip=0.0.0.0 \ filetransfer_ip=0.0.0.0 \ dbplugin=ts3db_sqlite3 \ dbpluginparameter=ts3server.sqlitedb \ logappend=1 \ logquerycommands=1 \ create_default_virtualserver=1 \ licensepath=/opt/teamspeak3-server_linux_amd64/licensekey.dat

Two-Factor Authentication

#!/bin/bash # 2FA implementation script # Install Google Authenticator apt-get install libpam-google-authenticator # Configure PAM for TeamSpeak echo "auth required pam_google_authenticator.so" >> /etc/pam.d/ts3server # Generate 2FA secrets for admins python3 -c " import pyotp import qrcode import base64 # Generate secret for each admin admins = ['admin1', 'admin2', 'admin3'] for admin in admins: secret = pyotp.random_base32() totp = pyotp.TOTP(secret) print(f'{admin}: {secret}') # Generate QR code qr = qrcode.QRCode(version=1, box_size=10, border=5) qr.add_data(f'otpauth://totp/TeamSpeak-{admin}?secret={secret}&issuer=TeamSpeak') qr.make(fit=True) qr.print_ascii() "

Monitoring and Detection

Intrusion Detection System

#!/bin/bash # intrusion_detection.sh LOG_FILE="/opt/teamspeak3-server_linux_amd64/logs/ts3server_*.log" ALERT_EMAIL="admin@example.com" MAX_FAILED_ATTEMPTS=5 BANTIME=3600 # Monitor for failed login attempts tail -f "$LOG_FILE" | while read line; do if echo "$line" | grep -q "failed login"; then IP=$(echo "$line" | grep -oP 'from \K[\d.]+') FAILED_ATTEMPTS=$((FAILED_ATTEMPTS + 1)) if [ "$FAILED_ATTEMPTS" -gt "$MAX_FAILED_ATTEMPTS" ]; then # Block IP iptables -A INPUT -s "$IP" -j DROP # Send alert echo "ALERT: Multiple failed login attempts from $IP" | \ mail -s "TeamSpeak Security Alert" "$ALERT_EMAIL" FAILED_ATTEMPTS=0 fi fi done

Real-time Monitoring

#!/usr/bin/env python3 # real_time_monitor.py import teamspeak3 import time import smtplib TS_HOST = "localhost" TS_PORT = 10011 TS_USER = "serveradmin" TS_PASS = "your_password" def check_server_status(): try: with teamspeak3.query.TS3ServerConnection(TS_HOST, TS_PORT) as ts: ts.login(TS_USER, TS_PASS) # Check for suspicious activity clients = ts.clientlist() # Check for multiple connections from same IP ip_count = {} for client in clients: ip = client['connection_client_ip'] ip_count[ip] = ip_count.get(ip, 0) + 1 for ip, count in ip_count.items(): if count > 5: alert_admin(f"Suspicious activity: {count} connections from {ip}") # Check for abnormal channel creation channels = ts.channellist() recent_channels = [c for c in channels if int(c['seconds_empty']) < 60] if len(recent_channels) > 3: alert_admin("Rapid channel creation detected") except Exception as e: print(f"Monitoring error: {e}") def alert_admin(message): print(f"ALERT: {message}") # Add email/SMS notification here if __name__ == "__main__": while True: check_server_status() time.sleep(30)

Incident Response Procedures

Security Incident Response Plan

Phase 1: Detection & Analysis

  1. Identify Threat: Monitor logs and alerts for suspicious activity
  2. Assess Impact: Determine scope and severity of the incident
  3. Document Evidence: Preserve logs and system state
  4. Isolate Systems: Contain threat to prevent further damage

Phase 2: Containment & Eradication

  1. Block Malicious IPs: Update firewall rules immediately
  2. Disable Compromised Accounts: Revoke access for affected users
  3. Patch Vulnerabilities: Address security gaps that were exploited
  4. Clean Systems: Remove malware and backdoors if present

Phase 3: Recovery & Lessons Learned

  1. Restore Services: Bring systems back online safely
  2. Verify Security: Test systems before full restoration
  3. Update Procedures: Improve security based on lessons learned
  4. Train Staff: Educate team on new security measures

Advanced Security Measures

Honeypot Implementation

#!/bin/bash # honeypot_teamspeak.sh # Create fake TeamSpeak instance mkdir /opt/teamspeak_honeypot cd /opt/teamspeak_honeypot # Deploy honeypot TeamSpeak server ts3server_startscript.sh start \ default_voice_port=9988 \ filetransfer_port=30034 \ query_port=10012 \ virtualserver_name="Honeypot Server" \ virtualserver_maxclients=10 # Monitor honeypot activity tail -f /opt/teamspeak_honeypot/logs/ts3server_*.log | while read line; do if echo "$line" | grep -q "client connected"; then IP=$(echo "$line" | grep -oP 'from \K[\d.]+') echo "Honeypot hit from: $IP" # Add to permanent blocklist iptables -A INPUT -s "$IP" -j DROP fi done

Automated Security Scanning

#!/bin/bash # security_scan.sh TS_HOST="localhost" TS_PORT=9987 QUERY_PORT=10011 # Check for common vulnerabilities echo "Starting security scan..." # Test for default passwords if nmap -p 10011 --script ts3-query-brute "$TS_HOST" | grep -q "Valid credentials"; then echo "VULNERABILITY: Default or weak passwords detected" fi # Check for open unnecessary ports if nmap "$TS_HOST" | grep -E "(30033|41144)"; then echo "WARNING: Unnecessary ports open" fi # Test for SSL/TLS issues if openssl s_client -connect "$TS_HOST:10011" -servername teamspeak.example.com 2>/dev/null | \ grep -q "certificate"; then echo "INFO: SSL certificate present" else echo "WARNING: No SSL certificate configured" fi # Check for recent updates if ! dpkg -l teamspeak3-server | grep -q "2023"; then echo "WARNING: TeamSpeak server may be outdated" fi echo "Security scan completed"

Compliance and Auditing

Security Audit Checklist

Monthly Security Review

  • Review firewall rules and update as needed
  • Rotate admin passwords quarterly
  • Monitor backup integrity and test restores
  • Review access logs for unusual patterns
  • Update server software and security patches

Quarterly Security Assessment

  • Perform penetration testing
  • Review and update security policies
  • Validate SSL/TLS certificates
  • Audit user permissions and roles
  • Test incident response procedures

Documentation and Training

Security Policy Template

TeamSpeak Security Policy

  1. Access Control: Only authorized personnel may access server administration
  2. Password Requirements: Minimum 12 characters with complexity requirements
  3. Monitoring: All server access and modifications must be logged
  4. Incident Reporting: Security incidents must be reported within 1 hour
  5. Regular Updates: Security patches must be applied within 48 hours

Security Tip: Implement defense in depth - multiple layers of security controls provide better protection against sophisticated attacks.

Top