aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/turn_server
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-10-12 08:14:59 -0400
committerCullum Smith <cullum@sacredheartsc.com>2024-10-12 08:15:33 -0400
commit99b8524c16cc99ceeaf1ebf588f2fc0f2c0fbe0a (patch)
tree3ffa4113f23eca6cea8ff2c94ba7ce60188d943e /scripts/hostclass/turn_server
parent1c882c769e5476b5cb3fa294257c76165a7a6f46 (diff)
downloadinfrastructure-99b8524c16cc99ceeaf1ebf588f2fc0f2c0fbe0a.tar.gz
add a bunch of hostclasses
Diffstat (limited to 'scripts/hostclass/turn_server')
-rw-r--r--scripts/hostclass/turn_server29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/hostclass/turn_server b/scripts/hostclass/turn_server
new file mode 100644
index 0000000..2c01e30
--- /dev/null
+++ b/scripts/hostclass/turn_server
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+: ${coturn_secret:="$turn_secret"}
+: ${coturn_external_ip:="$BOXCONF_DEFAULT_IPV4"}
+: ${coturn_realm:="$turn_domain"}
+: ${coturn_threads:="$nproc"}
+
+coturn_user=coturn
+coturn_uid=792
+
+add_user \
+ -u "$coturn_uid" \
+ -c 'Turnserver Psuedo-User' \
+ -d /nonexistent \
+ -s /usr/sbin/nologin \
+ "$coturn_user"
+
+# Install required packages.
+pkg install -y turnserver
+
+# Copy coturn config file.
+install_template -o root -g "$coturn_user" -m 0640 /usr/local/etc/turnserver.conf
+
+# Start turnserver.
+sysrc -v \
+ turnserver_enable=YES \
+ turnserver_user="$coturn_user" \
+ turnserver_group="$coturn_user"
+service turnserver restart