Skip to content

Commit c1c4a0d

Browse files
committed
verifying new turn instucts
1 parent 9ef61ee commit c1c4a0d

File tree

3 files changed

+53
-20
lines changed

3 files changed

+53
-20
lines changed

turnserver.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,17 @@ stale-nonce=600 # Nonce timeout in seconds
5353
realm=turn.example.com # Your server's domain
5454
server-name=turn.example.com
5555
no-multicast-peers # Security measure
56-
dh2066 # Strong DH params
5756
no-stdout-log # Disable stdout logging
5857
```
5958

6059
## SSL/TLS Support (Optional)
6160

62-
The installer can configure SSL/TLS support which:
61+
The installer configures SSL/TLS support which:
6362
- Enables TURNS (TURN over TLS) on port 443
6463
- Automatically obtains and renews SSL certificates via certbot
64+
- Generates secure DH parameters for improved TLS security
6565
- Configures automatic certificate reload without server restart
66+
- Sets up proper file permissions for security
6667

6768
## Testing Your Server
6869

@@ -130,9 +131,16 @@ sudo systemctl status coturn
130131
- Manual fix: `sudo setcap cap_net_bind_service=+ep /usr/bin/turnserver`
131132

132133
2. **SSL certificate errors (701)**
133-
- Verify certificate permissions
134-
- Check certificate paths in configuration
135-
- Ensure certificates are readable by turnserver user
134+
- Verify certificate permissions: `sudo chown -R turnserver:turnserver /etc/letsencrypt/live/your-domain/`
135+
- Check DH parameters: `sudo ls -l /etc/turnserver/dhparam.pem`
136+
- Ensure all SSL files are readable by turnserver user
137+
- Verify cipher suite compatibility in config
138+
139+
3. **TLS connection failures**
140+
- Check firewall rules for both TCP and UDP on port 443
141+
- Verify TLS certificate paths in configuration
142+
- Ensure DH parameters are properly generated
143+
- Check logs: `sudo journalctl -u coturn -n 50`
136144

137145
## Production Considerations
138146

@@ -146,11 +154,13 @@ sudo systemctl status coturn
146154
- Watch for high CPU/memory usage
147155
- Track active connections
148156

149-
3. **Security**
150-
- Regularly update credentials
151-
- Monitor for abuse
152-
- Keep coturn and SSL certificates up to date
153-
157+
2. **Security**
158+
- Regularly rotate TURN credentials
159+
- Monitor for unusual traffic patterns
160+
- Keep coturn, OpenSSL, and certificates up to date
161+
- Use strong cipher suites for TLS connections
162+
- Maintain proper file permissions
163+
154164
## Support
155165

156166
For issues or questions:

turnserver_basic.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ realm=turn.vdo.ninja
1111
server-name=turn.vdo.ninja
1212
no-multicast-peers
1313
stale-nonce=600
14-
dh2066
1514
no-stdout-log
1615
#verbose

turnserver_install.sh.sample

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ fi
88
configure_ssl() {
99
local DOMAIN=$1
1010

11+
# Generate DH params first
12+
if [ ! -f /etc/turnserver/dhparam.pem ]; then
13+
mkdir -p /etc/turnserver
14+
openssl dhparam -out /etc/turnserver/dhparam.pem 2066
15+
fi
16+
1117
# Check if port 80 is in use
1218
if netstat -tuln | grep ':80 '; then
1319
echo "Warning: Port 80 is in use. Stopping potentially conflicting services..."
@@ -46,11 +52,24 @@ configure_ssl() {
4652

4753
# Update turnserver.conf with SSL settings
4854
cat >> /etc/turnserver.conf << EOL
55+
# SSL Configuration
4956
cert=/etc/letsencrypt/live/${DOMAIN}/fullchain.pem
5057
pkey=/etc/letsencrypt/live/${DOMAIN}/privkey.pem
51-
tls-listening-port=443
58+
dh-file=/etc/turnserver/dhparam.pem
59+
60+
# Cipher Suite
61+
cipher-list="ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384"
5262
EOL
5363

64+
# Set proper permissions
65+
chown -R turnserver:turnserver /etc/turnserver
66+
chmod 700 /etc/turnserver
67+
chmod 600 /etc/turnserver/dhparam.pem
68+
69+
# Also ensure proper permissions for SSL certs
70+
chown -R turnserver:turnserver /etc/letsencrypt/live/${DOMAIN}/
71+
chmod -R 700 /etc/letsencrypt/live/${DOMAIN}/
72+
5473
# Create renewal hook
5574
mkdir -p /etc/letsencrypt/renewal-hooks/deploy
5675
cat > /etc/letsencrypt/renewal-hooks/deploy/coturn-reload << EOL
@@ -70,7 +89,7 @@ install_coturn() {
7089

7190
# Install required packages
7291
apt-get update
73-
apt-get install coturn curl dnsutils -y
92+
apt-get install coturn curl dnsutils openssl -y
7493

7594
# Configure system limits
7695
echo "fs.file-max = 65535" >> /etc/sysctl.conf
@@ -82,20 +101,25 @@ install_coturn() {
82101

83102
# Generate base turnserver configuration
84103
cat > /etc/turnserver.conf << EOL
104+
# Listening Ports
85105
listening-port=3478
86-
alt-listening-port=0
106+
alt-listening-port=3479
107+
tls-listening-port=443
108+
109+
# Authentication
87110
fingerprint
88111
lt-cred-mech
89-
# STUN/TURN configuration
90-
stun-port=3478
91-
min-port=49152
92-
max-port=65535
93112
user=${USERNAME}:${PASSWORD}
94113
stale-nonce=600
114+
115+
# Server Configuration
95116
realm=${DOMAIN}
96117
server-name=${DOMAIN}
118+
min-port=49152
119+
max-port=65535
120+
121+
# Security
97122
no-multicast-peers
98-
dh2066
99123
no-stdout-log
100124
EOL
101125

@@ -152,7 +176,7 @@ echo "Installation complete!"
152176
echo "----------------------------------------"
153177
echo "Domain: $DOMAIN"
154178
echo "Username: $USERNAME"
155-
echo "STUN/TURN ports: 3478 (default)"
179+
echo "STUN/TURN ports: 3478 (default), 3479 (alt)"
156180
if [ "${ENABLE_SSL,,}" = "y" ]; then
157181
echo "TLS enabled on port 443"
158182
echo "SSL certificates will automatically renew via certbot"

0 commit comments

Comments
 (0)