timmy commited on
Commit ·
86efc10
1
Parent(s): 55c2299
test
Browse files- Dockerfile +2 -2
- dante.template.conf +1 -1
- entrypoint.sh +5 -4
Dockerfile
CHANGED
|
@@ -8,7 +8,7 @@ COPY dante.template.conf /etc/dante.template.conf
|
|
| 8 |
COPY entrypoint.sh /entrypoint.sh
|
| 9 |
RUN chmod +x /entrypoint.sh
|
| 10 |
|
| 11 |
-
EXPOSE
|
| 12 |
|
| 13 |
ENTRYPOINT ["/entrypoint.sh"]
|
| 14 |
-
CMD [
|
|
|
|
| 8 |
COPY entrypoint.sh /entrypoint.sh
|
| 9 |
RUN chmod +x /entrypoint.sh
|
| 10 |
|
| 11 |
+
EXPOSE 7860
|
| 12 |
|
| 13 |
ENTRYPOINT ["/entrypoint.sh"]
|
| 14 |
+
CMD []
|
dante.template.conf
CHANGED
|
@@ -2,7 +2,7 @@ logoutput: stderr
|
|
| 2 |
|
| 3 |
internal: 0.0.0.0 port = 1080
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
method: username
|
| 8 |
user.notprivileged: nobody
|
|
|
|
| 2 |
|
| 3 |
internal: 0.0.0.0 port = 1080
|
| 4 |
|
| 5 |
+
__EXTERNAL_INTERFACE__
|
| 6 |
|
| 7 |
method: username
|
| 8 |
user.notprivileged: nobody
|
entrypoint.sh
CHANGED
|
@@ -4,7 +4,7 @@ echo ">>> Detecting network interface..."
|
|
| 4 |
IFACE=$(ip route get 8.8.8.8 | awk '{print $5; exit}')
|
| 5 |
echo ">>> Detected external interface: $IFACE"
|
| 6 |
|
| 7 |
-
# 自动生成账号密码
|
| 8 |
if [ -z "$USERNAME" ]; then
|
| 9 |
USERNAME="user$(date +%s | md5sum | cut -c1-5)"
|
| 10 |
fi
|
|
@@ -20,11 +20,12 @@ echo ">>> SOCKS Password: $PASSWORD"
|
|
| 20 |
useradd -r -s /bin/false "$USERNAME"
|
| 21 |
echo "$USERNAME:$PASSWORD" | chpasswd
|
| 22 |
|
| 23 |
-
# 生成
|
| 24 |
-
sed "s|
|
|
|
|
| 25 |
|
| 26 |
echo ">>> Final /etc/dante.conf:"
|
| 27 |
cat /etc/dante.conf
|
| 28 |
|
| 29 |
echo ">>> Starting Dante SOCKS5..."
|
| 30 |
-
exec
|
|
|
|
| 4 |
IFACE=$(ip route get 8.8.8.8 | awk '{print $5; exit}')
|
| 5 |
echo ">>> Detected external interface: $IFACE"
|
| 6 |
|
| 7 |
+
# 自动生成账号密码
|
| 8 |
if [ -z "$USERNAME" ]; then
|
| 9 |
USERNAME="user$(date +%s | md5sum | cut -c1-5)"
|
| 10 |
fi
|
|
|
|
| 20 |
useradd -r -s /bin/false "$USERNAME"
|
| 21 |
echo "$USERNAME:$PASSWORD" | chpasswd
|
| 22 |
|
| 23 |
+
# 生成最终配置文件
|
| 24 |
+
sed "s|__EXTERNAL_INTERFACE__|external: $IFACE|" \
|
| 25 |
+
/etc/dante.template.conf > /etc/dante.conf
|
| 26 |
|
| 27 |
echo ">>> Final /etc/dante.conf:"
|
| 28 |
cat /etc/dante.conf
|
| 29 |
|
| 30 |
echo ">>> Starting Dante SOCKS5..."
|
| 31 |
+
exec /usr/sbin/sockd -f /etc/dante.conf
|