summaryrefslogtreecommitdiff
path: root/vpn/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'vpn/entrypoint.sh')
-rw-r--r--vpn/entrypoint.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/vpn/entrypoint.sh b/vpn/entrypoint.sh
index febdfef..b80528a 100644
--- a/vpn/entrypoint.sh
+++ b/vpn/entrypoint.sh
@@ -1,6 +1,23 @@
#!/bin/sh
set -e
+# 中間証明書チェーンを個別ファイルに分割(strongSwan は複数証明書 PEM の最初しか読まないため)
+n=0
+file=""
+while IFS= read -r line; do
+ case "$line" in
+ "-----BEGIN CERTIFICATE-----")
+ n=$((n+1))
+ file="/etc/swanctl/x509ca/chain-${n}.crt"
+ printf '%s\n' "$line" > "$file"
+ ;;
+ *)
+ [ -n "$file" ] && printf '%s\n' "$line" >> "$file"
+ ;;
+ esac
+done < /tmp/server-chain.crt
+echo "Loaded ${n} intermediate CA certs from chain"
+
# IP フォワーディング有効化(network_mode: host では書き込み不可の場合があるのでエラー無視)
sysctl -w net.ipv4.ip_forward=1 2>/dev/null || true
sysctl -w net.ipv6.conf.all.forwarding=1 2>/dev/null || true