From 3ede224d7b3bc95f45c73a73375c0ad1b911fa1c Mon Sep 17 00:00:00 2001 From: Cullum Smith Date: Fri, 13 Dec 2024 20:53:47 -0500 Subject: add matrix hostclass --- scripts/hostclass/matrix_server | 78 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/hostclass/matrix_server b/scripts/hostclass/matrix_server index df22c3b..ae8f7a7 100644 --- a/scripts/hostclass/matrix_server +++ b/scripts/hostclass/matrix_server @@ -6,11 +6,7 @@ : ${synapse_ldap_password:='changeme'} : ${synapse_domain:="$email_domain"} : ${synapse_public_fqdn:="$fqdn"} -: ${synapse_local_client_port:='8008'} -: ${synapse_local_federation_port:='8009'} -: ${synapse_client_port:='8443'} -: ${synapse_federation_port:='8448'} -: ${synapse_mail_from:="Matrix "} +: ${synapse_email_from:="Matrix "} : ${synapse_username:='s-synapse'} : ${synapse_local_media_retention:='365d'} : ${synapse_remote_media_retention:='90d'} @@ -18,22 +14,90 @@ : ${synapse_turn_host:="$turn_domain"} : ${synapse_turn_secret:="$turn_secret"} : ${synapse_access_role:='matrix-access'} +: ${synapse_dbhost:="$postgres_host"} +: ${synapse_dbname:='synapse'} synapse_db_dir=/var/db/matrix-synapse synapse_conf_dir=/usr/local/etc/matrix-synapse synapse_local_user=synapse +synapse_dn="uid=${synapse_username},${robots_basedn}" +synapse_client_keytab="${keytab_dir}/synapse.client.keytab" +synapse_https_cacert="${acme_cert_dir}/nginx.ca.crt" +synapse_https_cert="${acme_cert_dir}/nginx.crt" +synapse_https_key="${acme_cert_dir}/nginx.key" +synapse_local_client_port=8008 +synapse_local_federation_port=8009 +synapse_element_webroot=/usr/local/www/element # Install required packages. pkg install -y \ py${python_version}-matrix-synapse \ py${python_version}-matrix-synapse-ldap3 \ - nginx + nginx \ + element-web + +# Create ZFS dataset for HTTP upload files. +create_dataset -o "mountpoint=${synapse_db_dir}" "${state_dataset}/synapse" +install_directory -o "$synapse_local_user" -g wheel -m 0700 "$synapse_db_dir" + +# Create synapse principal. +ldap_add "$synapse_dn" <