diff --git a/Dockerfile b/Dockerfile index 5b55df8..1a0acd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,15 @@ FROM ubuntu ENV DEBIAN_FRONTEND=noninteractive -RUN apt update && apt install -y apt-utils && apt install -y gcc make dkms && apt upgrade -y && apt install nano openresolv iproute2 iptables dante-server +RUN apt update && apt install -y apt-utils dnsutils && apt upgrade -y && apt install -y dante-server iproute2 iptables nano curl wget tini + +ENTRYPOINT ["tini", "--"] + +ADD danted-init.sh /danted-init.sh +ADD docker-entrypoint.sh /docker-entrypoint.sh + +RUN chmod 755 /*.sh + +ENTRYPOINT ["tini", "--"] +STOPSIGNAL SIGINT +CMD ["/docker-entrypoint.sh"] diff --git a/danted-init.sh b/danted-init.sh new file mode 100644 index 0000000..d3c9f65 --- /dev/null +++ b/danted-init.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +useradd -r -M -s /sbin/nologin -c "Socks user" -u 1000 $SUSER +(echo $PASSWD; echo $PASSWD) | passwd $SUSER diff --git a/danted.conf b/danted.conf new file mode 100644 index 0000000..022d96d --- /dev/null +++ b/danted.conf @@ -0,0 +1,23 @@ +logoutput: syslog +user.privileged: root +user.unprivileged: nobody + +# The listening network interface or address. +internal: 0.0.0.0 port=1080 + +# The proxying network interface or address. +external: eth0 + +# socks-rules determine what is proxied through the external interface. +socksmethod: username + +# client-rules determine who can connect to the internal interface. +clientmethod: none + +client pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 +} + +socks pass { + from: 0.0.0.0/0 to: 0.0.0.0/0 +} diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..24faf19 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,17 @@ +--- +version: "3.9" +services: + tubuntu: + build: + context: . + dockerfile: Dockerfile + image: ghostklart/danted:arm + container_name: danted + hostname: danted + volumes: + - ./danted.conf:/etc/danted.conf + env_file: + - danted.env + ports: + - 1080:1080 + restart: unless-stopped diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..87d5af3 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +starting() { + echo "Creating user" + bash /danted-init.sh + echo "Starting danted" + danted -p /danted.pid +} + +ending() { + echo "Stopping danted" + kill -9 $(cat /danted.pid) + echo "Stopping container" +} + +trap ending SIGINT SIGTERM + +echo "Starting container" +starting +