forked from extern/zerotier-docker
commit
16cd0d1dba
@ -3,13 +3,12 @@ ARG FROM_VERSION=latest
|
||||
|
||||
FROM ${FROM_IMAGE}:${FROM_VERSION}
|
||||
|
||||
RUN apk add --no-cache --purge --clean-protected supervisor iptables \
|
||||
&& mkdir -p /var/log/supervisor \
|
||||
RUN apk add --no-cache --purge --clean-protected iptables \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
ENV LOG_PATH=/var/log/supervisor
|
||||
|
||||
COPY conf scripts /opt
|
||||
COPY scripts /opt
|
||||
|
||||
EXPOSE 9993/udp
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=%(ENV_LOG_PATH)s/supervisord.log
|
||||
childlogdir=%(ENV_LOG_PATH)s
|
||||
priority=1
|
||||
|
||||
[program:bridge]
|
||||
command=/opt/bridge.sh
|
||||
stdout_logfile=%(ENV_LOG_PATH)s/bridge.stdout.log
|
||||
stderr_logfile=%(ENV_LOG_PATH)s/bridge.stderr.log
|
||||
startsecs=0
|
||||
autorestart=false
|
||||
exitcodes=0
|
||||
priority=1
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
echo "Waiting for network interface to be ready..."
|
||||
|
||||
while ! ifconfig | grep -q zt; do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Network interface is ready. Starting bridge..."
|
||||
|
||||
PHY_IFACE=eth0
|
||||
ZT_IFACE=$(ifconfig | grep zt | awk '{print $1}')
|
||||
iptables -t nat -A POSTROUTING -o $PHY_IFACE -j MASQUERADE
|
||||
iptables -A FORWARD -i $PHY_IFACE -o $ZT_IFACE -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -A FORWARD -i $ZT_IFACE -o $PHY_IFACE -j ACCEPT
|
||||
|
||||
echo "Bridge started."
|
@ -1,4 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
/usr/bin/supervisord --configuration /opt/supervisord.conf &
|
||||
PHY_IFACE=eth0
|
||||
ZT_IFACE="zt+"
|
||||
iptables -t nat -A POSTROUTING -o $PHY_IFACE -j MASQUERADE
|
||||
iptables -A FORWARD -i $PHY_IFACE -o $ZT_IFACE -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -A FORWARD -i $ZT_IFACE -o $PHY_IFACE -j ACCEPT
|
||||
|
||||
zerotier-one $@
|
Loading…
Reference in New Issue
Block a user