init edns
This commit is contained in:
parent
e226014b69
commit
ff46784103
2 changed files with 54 additions and 0 deletions
12
Dockerfile
Normal file
12
Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM alpine:3.20
|
||||
|
||||
RUN apk --no-cache add \
|
||||
socat
|
||||
|
||||
ADD ./entrypoint.sh /usr/local/bin/entrypoint
|
||||
|
||||
EXPOSE 53/udp
|
||||
|
||||
ENTRYPOINT [ "entrypoint" ]
|
||||
|
||||
CMD [ "-any" ]
|
42
entrypoint.sh
Normal file
42
entrypoint.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
# Without arguments, simply exec shell
|
||||
[[ -z $1 ]] && {
|
||||
exec /bin/sh
|
||||
}
|
||||
|
||||
|
||||
# If the first character from the input is different from "-"
|
||||
# execute the command - allow it to run any command
|
||||
[[ ! "${1:0:1}" = '-' ]] && {
|
||||
exec "$@"
|
||||
}
|
||||
|
||||
debug=""
|
||||
bind="0.0.0.0"
|
||||
|
||||
while [ "$#" != "0" ]; do
|
||||
case $1 in
|
||||
-debug)
|
||||
debug="-d -d -d -d"
|
||||
;;
|
||||
|
||||
-any)
|
||||
;;
|
||||
|
||||
-iface)
|
||||
bind="$1"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown Argument [$1]."
|
||||
echo "Aborting."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exec socat $debug UDP4-RECVFROM:53,fork,bind="$bind" UDP4-SENDTO:127.0.0.11:53
|
Loading…
Reference in a new issue