sudo apt install coturn
sudo ufw allow Turnserver
Benvenuti nel blog di Clarintux!
Installare prosody:
sudo apt install prosody
Aprire le porte 5222 e 5269:
sudo ufw allow 5222,5269/tcp
Configurare il file /etc/prosody/prosody.cfg.lua:
admins = { "[email protected]" }
allow_registration = true;
c2s_require_encryption = true
s2s_require_encryption = true
VirtualHost "localhost"
VirtualHost "chat.mio-dominio"
Abilitare moduli a piacimento nella sezione modules_enabled.
Creare il file /etc/nginx/conf.d/prosody.conf col seguente contenuto:
server {
listen 80;
listen [::]:80;
server_name chat.mio-dominio;
root /var/www/prosody/;
location ~ /.well-known/acme-challenge {
allow all;
}
}
Creare la directory /var/www/prosody:
sudo mkdir /var/www/prosody/
Impostare www-data come proprietario della directory:
sudo chown www-data:www-data /var/www/prosody -R
Riavviare Nginx:
sudo systemctl reload nginx
Installare il certificato Let’s Encrypt:
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email] -d chat.mio-dominio
Aggiungere il certificato TLS e la chiave al file /etc/prosody/prosody.cfg.lua:
VirtualHost "chat.mio-dominio"
ssl = {
key = "/etc/letsencrypt/live/chat.mio-dominio/privkey.pem";
certificate = "/etc/letsencrypt/live/chat.mio-dominio/fullchain.pem";
}
Permettere all’utente prosody di leggere il certificato TLS e la chiave:
sudo apt install acl
sudo setfacl -R -m u:prosody:rx /etc/letsencrypt/
Creare un utente:
sudo prosodyctl adduser [email]
Riavviare prosody:
sudo systemctl restart prosody
Aprire le porte 5222 e 5269 del router.
Pronti per provare un client XMPP come pidgin…
Per rinnovare automaticamente il certificato TLS:
sudo crontab -e
@daily certbot renew --quiet && systemctl reload prosody nginx
Abilitare una Multi-User Chat che puo essere creata solo da “admin” in /etc/prosody/prosody.cfg.lua:
Component "conference.chat.mio-dominio" "muc"
restrict_room_creation = "admin"
Per la stabilita delle chiamate audio/video:
sudo apt install coturn
sudo ufw allow Turnserver
Installare mod_turn_external e mod_external_services.
Abilitare mod_turn_external:
modules_enabled = {
-- other modules ...
"turn_external"
}
turn_external_host = "turn.mio-dominio"
turn_external_port = 3478
turn_external_secret = "s1kr3t" #qui password generata con ssl
E in /etc/turnserver.conf:
realm=turn.mio-dominio
use-auth-secret
static-auth-secret=s1kr3t # stessa password
# Use fingerprint in TURN message
fingerprint
# IPs the TURN server listens to
listening-ip=0.0.0.0
# External IP-Address of the TURN server
external-ip=IP_ADDRESS
# Main listening port
listening-port=3478
# Further ports that are open for communication
min-port=10000
max-port=20000
# Log file path
log-file=/var/log/turnserver.log
# Enable verbose logging
verbose
# Specify the user for the TURN authentification
user=test:test123
# Enable long-term credential mechanism
lt-cred-mech
# SSL certificates
cert=/etc/letsencrypt/live/<DOMAIN>/cert.pem
pkey=/etc/letsencrypt/live/<DOMAIN>/privkey.pem
# 443 for TURN over TLS, which can bypass firewalls
tls-listening-port=443
# If running coturn version older than 4.5.2, uncomment these rules and ensure
# that you have listening-ip set to ipv4 addresses only.
# Prevent Loopback bypass https://github.com/coturn/coturn/security/advisories/GHSA-6g6j-r9rf-cm7p
#denied-peer-ip=0.0.0.0-0.255.255.255
#denied-peer-ip=127.0.0.0-127.255.255.255
#denied-peer-ip=::1
Generare il certificato:
sudo certbot certonly --standalone --preferred-challenges http \
--deploy-hook "systemctl restart coturn" \
-d <YOUR_DOMAIN>
In /etc/default/coturn:
TURNSERVER_ENABLED=1
Linux GNU Server Internet NORWAY DIY YouTube Sistema operativo Bla News Clothing Bla Bla Games