From d58dac1bb32b87e79e16a2e9777a6dced701aa3b Mon Sep 17 00:00:00 2001 From: Cullum Smith Date: Tue, 25 Mar 2025 21:24:12 -0400 Subject: add mollysocket support to xmpp server --- scripts/hostclass/xmpp_server/10-prosody | 137 +++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 scripts/hostclass/xmpp_server/10-prosody (limited to 'scripts/hostclass/xmpp_server/10-prosody') diff --git a/scripts/hostclass/xmpp_server/10-prosody b/scripts/hostclass/xmpp_server/10-prosody new file mode 100644 index 0000000..3383282 --- /dev/null +++ b/scripts/hostclass/xmpp_server/10-prosody @@ -0,0 +1,137 @@ +#!/bin/sh + +# The LDAP library used by prosody (lualdap) does not support SASL binds. +# Therefore, you must specify the prosody_ldap_password variable. + +# prosody_acme_host= +: ${prosody_admins:=''} +: ${prosody_public_fqdn:="$fqdn"} +: ${prosody_push_fqdn:="push.${email_domain}"} +: ${prosody_domains:="$email_domain"} +: ${prosody_ldap_password:='changeme'} +: ${prosody_dbname:='prosody'} +: ${prosody_dbhost:="$postgres_host"} +: ${prosody_access_role:='xmpp-access'} +: ${prosody_archive_expiration:='1w'} +: ${prosody_upload_sizelimit:='104857600'} # 100 MB +: ${prosody_upload_expiration:='604800'} # 1 week +: ${prosody_upload_quota:='25769803776'} # 24 GB +: ${prosody_turn_port:='3478'} +: ${prosody_turn_host:="$turn_domain"} +: ${prosody_turn_realm:="$turn_domain"} +: ${prosody_turn_secret="$turn_secret"} + +prosody_dn="uid=${prosody_username},${robots_basedn}" +prosody_local_user=prosody +prosody_conf_dir=/usr/local/etc/prosody +prosody_certs_dir="${prosody_conf_dir}/certs" +prosody_keytab="${keytab_dir}/prosody.client.keytab" +prosody_roster_path="${prosody_conf_dir}/roster.ini" +prosody_http_port=8080 +prosody_db_dir=/var/db/prosody +prosody_upload_dir="${prosody_db_dir}/http_upload" + +prosody_https_cacert="${acme_cert_dir}/nginx.ca.crt" +prosody_https_cert="${acme_cert_dir}/nginx.crt" +prosody_https_key="${acme_cert_dir}/nginx.key" + +mollysocket_local_port=8081 + +# Install required packages. +pkg install -y \ + prosody \ + prosody-modules \ + lua54-luadbi \ + lua54-lualdap \ + nginx \ + ca_root_nss + +# Create ZFS dataset for HTTP upload files. +create_dataset -o "mountpoint=${prosody_db_dir}" "${state_dataset}/prosody" +install_directory -o "$prosody_local_user" -g "$prosody_local_user" -m 0750 "$prosody_db_dir" + +# Create prosody user private group. +ldap_add "cn=${prosody_username},${private_groups_basedn}" <