You need WeeChat 4.0+ (4.1+ for the channel list) and a domain pointing at the machine running it.
1. Get a certificate. Port 80 must be reachable while it is issued (if a web server already uses it, swap --standalone for --webroot -w /var/www/html):
sudo certbot certonly --standalone -d relay.example.com --register-unsafely-without-email
2. In WeeChat, set the relay password and a fixed FIFO path so the certificate can be reloaded automatically:
/secure set relay YOUR_PASSWORD
/set relay.network.password "${sec.data.relay}"
/set fifo.file.enabled on
/set fifo.file.path "${weechat_data_dir}/weechat_fifo"
/save
3. Save this as /etc/letsencrypt/renewal-hooks/deploy/weechat-relay and set WEECHAT_USER and DOMAIN. Certbot runs it after every renewal:
#!/bin/sh # Install the renewed Let's Encrypt certificate for the WeeChat relay and reload it set -eu WEECHAT_USER="youruser" DOMAIN="relay.example.com" user_home=$(getent passwd "$WEECHAT_USER" | cut -d: -f6) live_dir="/etc/letsencrypt/live/$DOMAIN" tls_dir="$user_home/.config/weechat/tls" fifo="$user_home/.local/share/weechat/weechat_fifo" umask 077 # WeeChat wants the private key and the full certificate chain in one PEM file mkdir -p "$tls_dir" cat "$live_dir/privkey.pem" "$live_dir/fullchain.pem" > "$tls_dir/relay.pem" chown -R "$WEECHAT_USER:" "$tls_dir" # Reload the certificate if WeeChat is running (the FIFO only exists while it is) if [ -p "$fifo" ]; then echo '*/relay tlscertkey' | timeout 5 tee "$fifo" > /dev/null fi
Make it executable and run it once now:
sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/weechat-relay sudo /etc/letsencrypt/renewal-hooks/deploy/weechat-relay
4. In WeeChat, add the relay:
/relay add tls.weechat 9001 /save
5. Open port 9001/tcp in your firewall, then connect here with host relay.example.com, port 9001, SSL/TLS on, and your password.