net/eturnal: erlang-based TURN server (new port)

- appease portclippy
- sort pkg-plist

PR:		275114
Sponsored by:	SkunkWerks, GmbH
This commit is contained in:
Dave Cottlehuber 2024-01-04 23:25:10 +00:00
parent 85da8c39b9
commit 5182994929
9 changed files with 329 additions and 2 deletions

2
GIDs
View file

@ -287,7 +287,7 @@ openfire:*:342:
# free: 344
# free: 345
# free: 346
# free: 347
eturnal:*:347:
# free: 348
# free: 349
_sabnzbd:*:350:

2
UIDs
View file

@ -292,7 +292,7 @@ openfire:*:342:342::0:0:Openfire IM Daemon:/nonexistent:/usr/sbin/nologin
# free: 344
# free: 345
# free: 346
# free: 347
eturnal:*:347:347::0:0:eturnal User:/var/spool/eturnal:/bin/sh
# free: 348
# free: 349
_sabnzbd:*:350:350::0:0:sabnzb Daemon:/nonexistent:/usr/sbin/nologin

View file

@ -145,6 +145,7 @@
SUBDIR += endlessh
SUBDIR += enet
SUBDIR += eternalterminal
SUBDIR += eturnal
SUBDIR += evans
SUBDIR += eventviews
SUBDIR += exabgp4

90
net/eturnal/Makefile Normal file
View file

@ -0,0 +1,90 @@
PORTNAME= eturnal
DISTVERSION= 1.12.0
CATEGORIES= net
MAINTAINER= yzrh@noema.org
COMMENT= Modern, straightforward STUN and TURN server
WWW= https://eturnal.net/
LICENSE= APACHE20
LIB_DEPENDS= libyaml.so:textproc/libyaml
USES= compiler:c11 cpe erlang:rebar3 ssl
CPE_VENDOR= process-one
USE_GITHUB= yes
GH_TUPLE= processone:eturnal:${DISTVERSION} \
blt:port_compiler:${PC_VERSION}:pc/_checkouts/pc \
ferd:recon:${RECON_VERSION}:recon/_checkouts/recon \
deadtrickster:quantile_estimator:${QUANTILE_ESTIMATOR_VERSION}:quantile_estimator/_checkouts/quantile_estimator \
processone:stun:${STUN_VERSION}:stun/_checkouts/stun \
weiss:conf:${CONF_VERSION}:conf/_checkouts/conf \
processone:yval:${YVAL_VERSION}:yval/_checkouts/yval \
processone:fast_yaml:${FAST_YAML_VERSION}:fast_yaml/_checkouts/fast_yaml \
processone:fast_tls:${FAST_TLS_VERSION}:fast_tls/_checkouts/fast_tls \
processone:p1_utils:${P1_UTILS_VERSION}:p1_utils/_checkouts/p1_utils \
palkan:influx_udp:${INFLUX_UDP_VERSION}:influx_udp/_checkouts/influx_udp \
devinus:poolboy:${POOLBOY_VERSION}:poolboy/_checkouts/poolboy \
palkan:ulitos:${ULITOS_VERSION}:ulitos/_checkouts/ulitos \
deadtrickster:prometheus-httpd:${PROMETHEUS_HTTPD_VERSION}:prometheus_httpd/_checkouts/prometheus_httpd \
deadtrickster:prometheus.erl:${PROMETHEUS_VERSION}:prometheus/_checkouts/prometheus \
deadtrickster:accept:${ACCEPT_VERSION}:accept/_checkouts/accept
USE_RC_SUBR= ${PORTNAME}
# USES=erlang related variables
REBAR_PROFILE= distro
REBAR_TARGETS= release
USERS= ${PORTNAME}
GROUPS= ${USERS}
.ifnmake portclippy
ACCEPT_VERSION= 897dfca # 0.3.5
CONF_VERSION= 1d80a8b # 0.2.6
FAST_TLS_VERSION= 1.1.16
FAST_YAML_VERSION= 1.0.36
INFLUX_UDP_VERSION= c744ccf # 1.1.2
P1_UTILS_VERSION= 1.0.25
PC_VERSION= 3c62162 # 1.14.0
POOLBOY_VERSION= 1.5.2
PROMETHEUS_HTTPD_VERSION= b1ae3bc # 2.1.11
PROMETHEUS_VERSION= b78e17e # 4.10.0
QUANTILE_ESTIMATOR_VERSION= eeea7c7 # 0.2.1
RECON_VERSION= 2.5.4
STUN_VERSION= 1.2.9
ULITOS_VERSION= 0.4.0
YVAL_VERSION= 1.0.10
.endif
post-patch:
${REINPLACE_CMD} -e 's|/opt/eturnal|${LOCALBASE}/lib/eturnal|' \
-e 's|/etc|${LOCALBASE}/etc/eturnal|' \
-e 's|static|dynamic|' \
${WRKSRC}/build.config
${REINPLACE_CMD} 's|-/etc|-${LOCALBASE}/etc/eturnal|' \
${WRKSRC}/overlay/eturnalctl
do-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/lib/eturnal
cd ${WRKSRC}/_build/${REBAR_PROFILE}/rel/eturnal && ${COPYTREE_BIN} bin \
${STAGEDIR}${PREFIX}/lib/eturnal/
cd ${WRKSRC}/_build/${REBAR_PROFILE}/rel/eturnal && ${COPYTREE_SHARE} lib \
${STAGEDIR}${PREFIX}/lib/eturnal/
cd ${WRKSRC}/_build/${REBAR_PROFILE}/rel/eturnal && ${COPYTREE_SHARE} releases \
${STAGEDIR}${PREFIX}/lib/eturnal/
${REINPLACE_CMD} 's|__erts_dir="$$RELEASE_ROOT_DIR/erts-$$ERTS_VSN"|__erts_dir="${LOCALBASE}/lib/erlang/erts-$$ERTS_VSN"|' \
${STAGEDIR}${PREFIX}/lib/eturnal/bin/eturnal
post-install:
${MKDIR} ${STAGEDIR}${PREFIX}/etc/eturnal
${INSTALL_DATA} ${WRKSRC}/_build/${REBAR_PROFILE}/rel/eturnal/etc/eturnal.yml \
${STAGEDIR}${PREFIX}/etc/eturnal/eturnal.yml.sample
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/_build/${REBAR_PROFILE}/rel/eturnal/doc/README.md \
${STAGEDIR}${DOCSDIR}/
${RLN} ${STAGEDIR}${PREFIX}/lib/eturnal/bin/eturnalctl \
${STAGEDIR}${PREFIX}/sbin/eturnalctl
${MKDIR} ${STAGEDIR}/var/log/eturnal
${FIND} ${STAGEDIR}${PREFIX}/lib/eturnal/lib -type f -name '*.so' -exec ${STRIP_CMD} {} +
.include <bsd.port.mk>

33
net/eturnal/distinfo Normal file
View file

@ -0,0 +1,33 @@
TIMESTAMP = 1704409305
SHA256 (processone-eturnal-1.12.0_GH0.tar.gz) = e8e3be145a8e1c0c62c118c642fc7feb6168f2deff3f47df5d8d9569b43484b4
SIZE (processone-eturnal-1.12.0_GH0.tar.gz) = 139407
SHA256 (blt-port_compiler-3c62162_GH0.tar.gz) = 8084ca2a8c366b29bc146564b71991af94468ef18d79ad508236d14fb1ff0fd3
SIZE (blt-port_compiler-3c62162_GH0.tar.gz) = 13989
SHA256 (ferd-recon-2.5.4_GH0.tar.gz) = a9a750f64ac82133ce33ba16df3510bf4cf0012858429ca6290075d4a4ef7192
SIZE (ferd-recon-2.5.4_GH0.tar.gz) = 53397
SHA256 (deadtrickster-quantile_estimator-eeea7c7_GH0.tar.gz) = b1b552f2a650cb5ecb1aa5486b07d20176460c72bb3836aff59e00ba3d80fbd9
SIZE (deadtrickster-quantile_estimator-eeea7c7_GH0.tar.gz) = 919517
SHA256 (processone-stun-1.2.9_GH0.tar.gz) = d3ebd81a35fc7fd26fd4415e371d371a68ef2d690504c5193b5c544023631281
SIZE (processone-stun-1.2.9_GH0.tar.gz) = 42490
SHA256 (weiss-conf-1d80a8b_GH0.tar.gz) = e331c5613faec75d138455a931511b050a529547e3b719530e69b3e4baba79dd
SIZE (weiss-conf-1d80a8b_GH0.tar.gz) = 23211
SHA256 (processone-yval-1.0.10_GH0.tar.gz) = cfecec24e5a23f354e5539fb1c35b25da50309879a654d41a6000154b6c437b6
SIZE (processone-yval-1.0.10_GH0.tar.gz) = 18477
SHA256 (processone-fast_yaml-1.0.36_GH0.tar.gz) = 6794470ef35fb3985c4e9aa0ed8d3a0b44e7a5c7bf4c5a1efbeca42060db6806
SIZE (processone-fast_yaml-1.0.36_GH0.tar.gz) = 60410
SHA256 (processone-fast_tls-1.1.16_GH0.tar.gz) = 8c38768998e8ee0aa2bf5831bc25deeb4ea2e08bd52e26b2abfd654504fbe4f9
SIZE (processone-fast_tls-1.1.16_GH0.tar.gz) = 83971
SHA256 (processone-p1_utils-1.0.25_GH0.tar.gz) = c62f93ab5ea8d9251d9acda2abf576352d50f4a3299972549180a5387656746a
SIZE (processone-p1_utils-1.0.25_GH0.tar.gz) = 47802
SHA256 (palkan-influx_udp-c744ccf_GH0.tar.gz) = 6c5d8159e9a9ff0723b86da6d4929399618645e6a5509161e8da66378583bca9
SIZE (palkan-influx_udp-c744ccf_GH0.tar.gz) = 12580
SHA256 (devinus-poolboy-1.5.2_GH0.tar.gz) = ee4684c0de73782ddb7682aa257bf9e1bfaec6276d92ac53ab044a0983e111e3
SIZE (devinus-poolboy-1.5.2_GH0.tar.gz) = 1126991
SHA256 (palkan-ulitos-0.4.0_GH0.tar.gz) = 53b49024dc4c9a2bfb7d74a53fb31ae3c8ee752089233de45b3f365ee0acd499
SIZE (palkan-ulitos-0.4.0_GH0.tar.gz) = 5204
SHA256 (deadtrickster-prometheus-httpd-b1ae3bc_GH0.tar.gz) = e82746e423d75f6fc5cc6afca7f9d82e123b46935d88496e2abefc0fbf793fee
SIZE (deadtrickster-prometheus-httpd-b1ae3bc_GH0.tar.gz) = 17341
SHA256 (deadtrickster-prometheus.erl-b78e17e_GH0.tar.gz) = 4b071e2a569e67cc22f804aeb31ca368f5cb1dcbe5e021e0992bb2915e1d4e6c
SIZE (deadtrickster-prometheus.erl-b78e17e_GH0.tar.gz) = 103642
SHA256 (deadtrickster-accept-897dfca_GH0.tar.gz) = 0ae80f35e86e06ea89634d1feb486835c4210c48b1472b0f245dbd05678f7577
SIZE (deadtrickster-accept-897dfca_GH0.tar.gz) = 758745

View file

@ -0,0 +1,78 @@
#! /bin/sh
# PROVIDE: eturnal
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
# Define these eturnal_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/eturnal
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
eturnal_enable=${eturnal_enable-"NO"}
eturnal_epmd_address=${eturnal_epmd_address-"127.0.0.1"}
eturnal_log_dir=${eturnal_log_dir-"/var/log/eturnal"}
. /etc/rc.subr
name="eturnal"
rcvar=eturnal_enable
reload_cmd="eturnal_reload"
restart_cmd="eturnal_reload"
start_cmd="eturnal_start"
status_cmd="eturnal_status"
stop_cmd="eturnal_stop"
extra_commands="reload status"
ETURNALCTL=%%PREFIX%%/sbin/eturnalctl
ETURNALUSER=eturnal
eturnal_status()
{
if eturnal_checkstatus; then
echo "$name is running."
else
echo "$name is not running."
return 1
fi
}
eturnal_checkstatus()
{
su $ETURNALUSER -c "env ERL_EPMD_ADDRESS=\"${eturnal_epmd_address}\" RUNNER_LOG_DIR=\"${eturnal_log_dir}\" $ETURNALCTL status > /dev/null"
}
eturnal_start()
{
echo "Starting $name."
su $ETURNALUSER -c "env ERL_EPMD_ADDRESS=\"${eturnal_epmd_address}\" RUNNER_LOG_DIR=\"${eturnal_log_dir}\" $ETURNALCTL daemon"
}
eturnal_stop()
{
echo "Stopping $name."
if su $ETURNALUSER -c "env ERL_EPMD_ADDRESS=\"${eturnal_epmd_address}\" RUNNER_LOG_DIR=\"${eturnal_log_dir}\" $ETURNALCTL stop"; then
# sleep 2
# killall -u eturnal -kill
else
_run_rc_notrunning
fi
}
eturnal_reload()
{
echo "Restarting $name."
if eturnal_checkstatus; then
su $ETURNALUSER -c "env ERL_EPMD_ADDRESS=\"${eturnal_epmd_address}\" RUNNER_LOG_DIR=\"${eturnal_log_dir}\" $ETURNALCTL reload"
else
eturnal_start
fi
}
load_rc_config $name
run_rc_command "$1"

View file

@ -0,0 +1,13 @@
--- config/eturnal.yml.orig 2023-09-28 08:04:22 UTC
+++ config/eturnal.yml
@@ -7,6 +7,10 @@
eturnal:
+ ## Minimum configuration needed for FreeBSD file system hierarchy.
+ log_dir: /var/log/eturnal
+ run_dir: /var/spool/eturnal
+
## Shared secret for deriving temporary TURN credentials (default: $RANDOM):
#secret: "long-and-cryptic"

5
net/eturnal/pkg-descr Normal file
View file

@ -0,0 +1,5 @@
eturnal is a clean, scalable STUN and TURN server for Unix-like
operating systems and Microsoft Windows. Clients can connect using
UDP, TCP, or TLS over IPv4 or IPv6. For authentication, eturnal
supports the mechanism described in the REST API for Access to TURN
Services specification (in addition to static credentials).

107
net/eturnal/pkg-plist Normal file
View file

@ -0,0 +1,107 @@
@dir(eturnal,eturnal,750) /var/log/eturnal
@sample %%ETCDIR%%/eturnal.yml.sample
lib/eturnal/bin/eturnal
lib/eturnal/bin/eturnal-%%VERSION%%
lib/eturnal/bin/eturnalctl
lib/eturnal/bin/extensions/credentials
lib/eturnal/bin/extensions/disconnect
lib/eturnal/bin/extensions/info
lib/eturnal/bin/extensions/loglevel
lib/eturnal/bin/extensions/password
lib/eturnal/bin/extensions/reload
lib/eturnal/bin/extensions/sessions
lib/eturnal/bin/extensions/version
lib/eturnal/bin/hooks/builtin/wait_for_process
lib/eturnal/bin/hooks/post_stop
lib/eturnal/bin/hooks/pre_start
lib/eturnal/bin/install_upgrade.escript
lib/eturnal/bin/no_dot_erlang.boot
lib/eturnal/bin/nodetool
lib/eturnal/lib/conf-0.2.6/ebin/conf_backend.beam
lib/eturnal/lib/conf-0.2.6/ebin/conf_env.beam
lib/eturnal/lib/conf-0.2.6/ebin/conf_file.beam
lib/eturnal/lib/conf-0.2.6/ebin/conf_http.beam
lib/eturnal/lib/conf-0.2.6/ebin/conf_misc.beam
lib/eturnal/lib/conf-0.2.6/ebin/conf_sup.beam
lib/eturnal/lib/conf-0.2.6/ebin/conf_yaml_backend.beam
lib/eturnal/lib/conf-0.2.6/ebin/conf.app
lib/eturnal/lib/conf-0.2.6/ebin/conf.beam
lib/eturnal/lib/conf-0.2.6/ebin/crypto_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/kernel_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/mnesia_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/odbc_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/os_mon_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/runtime_tools_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/sasl_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/ssl_yaml.beam
lib/eturnal/lib/conf-0.2.6/ebin/stdlib_yaml.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_app.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_cert.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_ctl.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_logger.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_misc.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_module.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_sup.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_systemd.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal_yaml.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal.app
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/eturnal.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/mod_log_stun.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/mod_stats_influx.beam
lib/eturnal/lib/eturnal-%%VERSION%%/ebin/mod_stats_prometheus.beam
lib/eturnal/lib/fast_tls-1.1.16/ebin/fast_tls.app
lib/eturnal/lib/fast_tls-1.1.16/ebin/fast_tls.beam
lib/eturnal/lib/fast_tls-1.1.16/ebin/p1_sha.beam
lib/eturnal/lib/fast_tls-1.1.16/priv/lib/fast_tls.so
lib/eturnal/lib/fast_tls-1.1.16/priv/lib/p1_sha.so
lib/eturnal/lib/fast_yaml-1.0.36/ebin/fast_yaml_app.beam
lib/eturnal/lib/fast_yaml-1.0.36/ebin/fast_yaml_sup.beam
lib/eturnal/lib/fast_yaml-1.0.36/ebin/fast_yaml.app
lib/eturnal/lib/fast_yaml-1.0.36/ebin/fast_yaml.beam
lib/eturnal/lib/fast_yaml-1.0.36/priv/lib/fast_yaml.so
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_file_queue.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_fsm.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_http.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_nif_utils.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_options.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_prof.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_proxy_protocol.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_queue.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_rand.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_server.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_shaper.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_time_compat.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_utils_sup.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_utils.app
lib/eturnal/lib/p1_utils-1.0.25/ebin/p1_utils.beam
lib/eturnal/lib/p1_utils-1.0.25/ebin/treap.beam
lib/eturnal/lib/p1_utils-1.0.25/include/p1_queue.hrl
lib/eturnal/lib/stun-1.2.9/ebin/stun_acceptor_sup.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_acceptor.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_app.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_codec.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_listener_sup.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_listener.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_logger.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_shaper.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_sup.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_test.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun_tmp_sup.beam
lib/eturnal/lib/stun-1.2.9/ebin/stun.app
lib/eturnal/lib/stun-1.2.9/ebin/stun.beam
lib/eturnal/lib/stun-1.2.9/ebin/turn_sm.beam
lib/eturnal/lib/stun-1.2.9/ebin/turn_tmp_sup.beam
lib/eturnal/lib/stun-1.2.9/ebin/turn.beam
lib/eturnal/lib/stun-1.2.9/include/stun_logger.hrl
lib/eturnal/lib/stun-1.2.9/include/stun.hrl
lib/eturnal/lib/yval-1.0.10/ebin/yval.app
lib/eturnal/lib/yval-1.0.10/ebin/yval.beam
lib/eturnal/releases/%%VERSION%%/eturnal.rel
lib/eturnal/releases/%%VERSION%%/no_dot_erlang.boot
lib/eturnal/releases/%%VERSION%%/start_clean.boot
lib/eturnal/releases/%%VERSION%%/start.boot
lib/eturnal/releases/%%VERSION%%/start.script
lib/eturnal/releases/%%VERSION%%/sys.config
lib/eturnal/releases/%%VERSION%%/vm.args
lib/eturnal/releases/start_erl.data
sbin/eturnalctl