aboutsummaryrefslogtreecommitdiff
path: root/files/usr
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2025-03-25 21:24:12 -0400
committerCullum Smith <cullum@sacredheartsc.com>2025-03-25 21:24:12 -0400
commitd58dac1bb32b87e79e16a2e9777a6dced701aa3b (patch)
treef273075417e09566ec6d7a63d1627429909295a1 /files/usr
parent9ffc950b5296374f387bfc689806d7af717bb78a (diff)
downloadinfrastructure-d58dac1bb32b87e79e16a2e9777a6dced701aa3b.tar.gz
add mollysocket support to xmpp server
Diffstat (limited to 'files/usr')
-rw-r--r--files/usr/local/etc/mollysocket.conf.xmpp_server5
-rw-r--r--files/usr/local/etc/nginx/vhosts.conf.xmpp_server23
-rw-r--r--files/usr/local/etc/rc.d/mollysocket.xmpp_server50
3 files changed, 78 insertions, 0 deletions
diff --git a/files/usr/local/etc/mollysocket.conf.xmpp_server b/files/usr/local/etc/mollysocket.conf.xmpp_server
new file mode 100644
index 0000000..9fd83c9
--- /dev/null
+++ b/files/usr/local/etc/mollysocket.conf.xmpp_server
@@ -0,0 +1,5 @@
+host = "127.0.0.1"
+port = ${mollysocket_local_port}
+webserver = true
+allowed_endpoints = ["https://${prosody_public_fqdn}/"]
+vapid_privkey = "${mollysocket_vapid_key}"
diff --git a/files/usr/local/etc/nginx/vhosts.conf.xmpp_server b/files/usr/local/etc/nginx/vhosts.conf.xmpp_server
index fad92ad..7cbe5a2 100644
--- a/files/usr/local/etc/nginx/vhosts.conf.xmpp_server
+++ b/files/usr/local/etc/nginx/vhosts.conf.xmpp_server
@@ -21,3 +21,26 @@ server {
proxy_pass http://127.0.0.1:${prosody_http_port};
}
}
+
+server {
+ listen ${mollysocket_port} ssl default_server;
+ listen [::]:${mollysocket_port} ssl default_server;
+
+ http2 on;
+
+ ssl_certificate ${prosody_https_cert};
+ ssl_certificate_key ${prosody_https_key};
+ ssl_trusted_certificate ${prosody_https_cacert};
+
+ add_header Strict-Transport-Security "max-age=63072000" always;
+
+ location / {
+ proxy_http_version 1.1;
+ proxy_set_header Host \$host:\$server_port;
+ proxy_set_header X-Real-IP \$remote_addr;
+ proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto \$scheme;
+ proxy_set_header X-Original-URL \$uri;
+ proxy_pass http://127.0.0.1:${mollysocket_local_port};
+ }
+}
diff --git a/files/usr/local/etc/rc.d/mollysocket.xmpp_server b/files/usr/local/etc/rc.d/mollysocket.xmpp_server
new file mode 100644
index 0000000..1a03931
--- /dev/null
+++ b/files/usr/local/etc/rc.d/mollysocket.xmpp_server
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# PROVIDE: mollysocket
+# REQUIRE: NETWORKING
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name=mollysocket
+rcvar=mollysocket_enable
+
+load_rc_config "$name"
+
+: ${mollysocket_enable:='NO'}
+: ${mollysocket_dir:='/usr/local/mollysocket/mollysocket.git'}
+: ${mollysocket_user='mollysocket'}
+: ${mollysocket_log_level:='info'}
+: ${mollysocket_syslog_facility:='daemon'}
+: ${mollysocket_conf_file:='/usr/local/etc/mollysocket.conf'}
+
+mollysocket_syslog_tag=mollysocket
+mollysocket_run_dir=/var/run/mollysocket
+mollysocket_db_dir=/var/db/mollysocket
+mollysocket_env="MOLLY_CONF=${mollysocket_conf_file} MOLLY_DB=${mollysocket_db_dir}/db.sqlite RUST_LOG=${mollysocket_log_level}"
+
+required_files="${mollysocket_conf_file}"
+sig_stop=SIGINT
+
+mollysocket_chdir=$mollysocket_dir
+pidfile=${mollysocket_run_dir}/mollysocket.pid
+command=/usr/sbin/daemon
+
+command_args="-f \
+-s ${mollysocket_log_level} \
+-l ${mollysocket_syslog_facility} \
+-T ${mollysocket_syslog_tag} \
+-p ${pidfile} \
+-t ${name} \
+${mollysocket_dir}/target/release/mollysocket server"
+
+procname="${mollysocket_dir}/target/release/mollysocket"
+start_precmd=mollysocket_prestart
+
+mollysocket_prestart(){
+ install -d -m 0755 -o ${mollysocket_user} ${mollysocket_run_dir}
+ install -d -m 0750 -o ${mollysocket_user} ${mollysocket_db_dir}
+}
+
+run_rc_command "$1"
+