Files
OpenVPN-Monitoring-Simple/APP_PROFILER/entrypoint.sh
2026-02-07 14:30:45 +03:00

36 lines
949 B
Bash

#!/bin/sh
# EnsureTUN device exists
if [ ! -c /dev/net/tun ]; then
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
fi
# Enable IP forwarding (moved to docker-compose.yml sysctls)
# sysctl -w net.ipv4.ip_forward=1 || true
# NAT MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# MSS Clamping (Path MTU Tuning)
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# Minimal OpenRC initialization to allow rc-service to work in Alpine
mkdir -p /run/openrc
touch /run/openrc/softlevel
# Initialize Easy-RSA if not already present in /app/easy-rsa
if [ ! -d /app/easy-rsa ]; then
echo "[INIT] Initializing Easy-RSA workspace..."
mkdir -p /app/easy-rsa
# Alpine installs easy-rsa files to /usr/share/easy-rsa
cp -r /usr/share/easy-rsa/* /app/easy-rsa/
fi
# Start the APP_PROFILER API
# We use 0.0.0.0 to be reachable from other containers
python main.py