From 30f5e27889b7b452dc3521d1dc924c1dfbeb596d Mon Sep 17 00:00:00 2001 From: Simon L Date: Wed, 8 Nov 2023 14:52:49 +0100 Subject: [PATCH 1/2] fix getting ip-address Signed-off-by: Simon L --- Containers/talk/Dockerfile | 3 ++- Containers/talk/start.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Containers/talk/Dockerfile b/Containers/talk/Dockerfile index 5dcbba5e..df5315c7 100644 --- a/Containers/talk/Dockerfile +++ b/Containers/talk/Dockerfile @@ -65,7 +65,8 @@ RUN set -ex; \ libusrsctp \ libwebsockets \ \ - shadow; \ + shadow \ + grep; \ useradd --system -u 1000 eturnal; \ apk del --no-cache \ shadow; \ diff --git a/Containers/talk/start.sh b/Containers/talk/start.sh index 1e7bafbd..43bfd0ca 100644 --- a/Containers/talk/start.sh +++ b/Containers/talk/start.sh @@ -19,7 +19,7 @@ elif [ -z "$INTERNAL_SECRET" ]; then fi set -x -IPv4_ADDRESS_TALK="$(dig nextcloud-aio-talk IN A +short +search | grep '^[0-9.]\+$' | sort | head -n1)" +IPv4_ADDRESS_TALK="$(hostname -i | grep -oP '[0-9]+\.[0-9]+.[0-9]+\.[0-9]+' | head -1)" IPv6_ADDRESS_TALK="$(dig nextcloud-aio-talk AAAA +short +search | grep '^[0-9a-f:]\+$' | sort | head -n1)" set +x From 5808898b38386f52b88c815e06b7898ea84d0531 Mon Sep 17 00:00:00 2001 From: Simon L Date: Wed, 8 Nov 2023 15:17:03 +0100 Subject: [PATCH 2/2] address review and fix another detail Signed-off-by: Simon L --- Containers/talk/start.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Containers/talk/start.sh b/Containers/talk/start.sh index 43bfd0ca..fb720233 100644 --- a/Containers/talk/start.sh +++ b/Containers/talk/start.sh @@ -19,10 +19,15 @@ elif [ -z "$INTERNAL_SECRET" ]; then fi set -x -IPv4_ADDRESS_TALK="$(hostname -i | grep -oP '[0-9]+\.[0-9]+.[0-9]+\.[0-9]+' | head -1)" +IPv4_ADDRESS_TALK_RELAY="$(hostname -i | grep -oP '[0-9]+\.[0-9]\+.[0-9]+\.[0-9]+' | head -1)" +IPv4_ADDRESS_TALK="$(dig nextcloud-aio-talk IN A +short +search | grep '^[0-9.]\+$' | sort | head -n1)" IPv6_ADDRESS_TALK="$(dig nextcloud-aio-talk AAAA +short +search | grep '^[0-9a-f:]\+$' | sort | head -n1)" set +x +if [ -n "$IPv4_ADDRESS_TALK" ] && [ "$IPv4_ADDRESS_TALK_RELAY" = "$IPv4_ADDRESS_TALK" ]; then + IPv4_ADDRESS_TALK="" +fi + # Turn cat << TURN_CONF > "/conf/eturnal.yml" eturnal: @@ -36,13 +41,14 @@ eturnal: log_dir: stdout log_level: warning secret: "$TURN_SECRET" - relay_ipv4_addr: "$IPv4_ADDRESS_TALK" + relay_ipv4_addr: "$IPv4_ADDRESS_TALK_RELAY" relay_ipv6_addr: "$IPv6_ADDRESS_TALK" blacklist_peers: - recommended whitelist_peers: - 127.0.0.1 - ::1 + - "$IPv4_ADDRESS_TALK_RELAY" - "$IPv4_ADDRESS_TALK" - "$IPv6_ADDRESS_TALK" TURN_CONF