Skip to content

Commit 7922d38

Browse files
authored
Merge pull request #7684 from michnovka/talk-trust-custom-ca
feat(talk): trust custom CA certificates via NEXTCLOUD_TRUSTED_CACERTS_DIR
2 parents 978a4ce + dd103fa commit 7922d38

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

Containers/talk/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ RUN set -ex; \
7070
libwebsockets \
7171
\
7272
shadow \
73-
grep; \
73+
grep \
74+
util-linux-misc; \
7475
useradd --system -u 1000 eturnal; \
7576
apk del --no-cache \
7677
shadow; \

Containers/talk/start.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ elif [ -z "$INTERNAL_SECRET" ]; then
1818
exit 1
1919
fi
2020

21+
# Trust additional CA certificates, if the user provided NEXTCLOUD_TRUSTED_CACERTS_DIR
22+
# The container is read-only, so we build a custom bundle in /tmp (tmpfs) and
23+
# point Go's TLS stack to it via SSL_CERT_FILE.
24+
if mountpoint -q /usr/local/share/ca-certificates; then
25+
echo "Trusting additional CA certificates..."
26+
set -x
27+
cp /etc/ssl/certs/ca-certificates.crt /tmp/ca-certificates.crt
28+
for cert in /usr/local/share/ca-certificates/*; do
29+
if [ -f "$cert" ]; then
30+
cat "$cert" >> /tmp/ca-certificates.crt
31+
fi
32+
done
33+
export SSL_CERT_FILE=/tmp/ca-certificates.crt
34+
set +x
35+
fi
36+
2137
set -x
2238
IPv4_ADDRESS_TALK_RELAY="$(hostname -i | grep -oP '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1)"
2339
# shellcheck disable=SC2153

php/containers.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,13 @@
437437
"8081"
438438
],
439439
"internal_port": "%TALK_PORT%",
440+
"volumes": [
441+
{
442+
"source": "%NEXTCLOUD_TRUSTED_CACERTS_DIR%",
443+
"destination": "/usr/local/share/ca-certificates",
444+
"writeable": false
445+
}
446+
],
440447
"environment": [
441448
"NC_DOMAIN=%NC_DOMAIN%",
442449
"TALK_HOST=nextcloud-aio-talk",

0 commit comments

Comments
 (0)