Skip to content

Commit b3703f2

Browse files
committed
disable coredns in client mode or if 53 is in use
1 parent a64e45f commit b3703f2

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ RUN \
2626
jq \
2727
libc6 \
2828
libelf-dev \
29+
net-tools \
2930
openresolv \
3031
perl \
3132
pkg-config \

Dockerfile.aarch64

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ RUN \
2626
jq \
2727
libc6 \
2828
libelf-dev \
29+
net-tools \
2930
openresolv \
3031
perl \
3132
pkg-config \

Dockerfile.armhf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ RUN \
2626
jq \
2727
libc6 \
2828
libelf-dev \
29+
net-tools \
2930
openresolv \
3031
perl \
3132
pkg-config \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
291291

292292
## Versions
293293

294-
* **06.10.20:** - Disable CoreDNS when Host networking is detected.
294+
* **06.10.20:** - Disable CoreDNS in client mode, or if port 53 is already in use in server mode.
295295
* **04.10.20:** - Allow to specify a list of names as PEERS and add ALLOWEDIPS environment variable. Also, add peer name/id to each one of the peer sections in wg0.conf. Important: Existing users need to delete `/config/templates/peer.conf` and restart
296296
* **27.09.20:** - Cleaning service binding example to have accurate PreDown script.
297297
* **06.08.20:** - Replace resolvconf with openresolv due to dns issues when a client based on this image is connected to a server also based on this image. Add IPv6 info to readme. Display kernel version in logs.

readme-vars.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ app_setup_block: |
103103
104104
# changelog
105105
changelogs:
106-
- { date: "06.10.20:", desc: "Disable CoreDNS when Host networking is detected." }
106+
- { date: "06.10.20:", desc: "Disable CoreDNS in client mode, or if port 53 is already in use in server mode." }
107107
- { date: "04.10.20:", desc: "Allow to specify a list of names as PEERS and add ALLOWEDIPS environment variable. Also, add peer name/id to each one of the peer sections in wg0.conf. Important: Existing users need to delete `/config/templates/peer.conf` and restart" }
108108
- { date: "27.09.20:", desc: "Cleaning service binding example to have accurate PreDown script." }
109109
- { date: "06.08.20:", desc: "Replace resolvconf with openresolv due to dns issues when a client based on this image is connected to a server also based on this image. Add IPv6 info to readme. Display kernel version in logs." }

root/etc/cont-init.d/30-config

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,22 +266,19 @@ if [ -n "$PEERS" ]; then
266266
fi
267267
fi
268268
else
269-
echo "**** Client mode selected."
269+
echo "**** Client mode selected. ****"
270270
if [ ! -f /config/wg0.conf ]; then
271271
echo "**** No client conf found. Provide your own client conf as \"/config/wg0.conf\" and restart the container. ****"
272272
sleep infinity
273273
fi
274-
fi
275-
276-
# set up or disable CoreDNS
277-
if ip addr show dev docker0 > /dev/null 2>&1; then
278-
echo "Host networking detected, disabling CoreDNS"
274+
echo "**** Disabling CoreDNS ****"
279275
rm -rf /etc/services.d/coredns
280-
else
281-
[[ ! -f /config/coredns/Corefile ]] && \
282-
cp /defaults/Corefile /config/coredns/Corefile
283276
fi
284277

278+
# set up CoreDNS
279+
[[ ! -f /config/coredns/Corefile ]] && \
280+
cp /defaults/Corefile /config/coredns/Corefile
281+
285282
# permissions
286283
chown -R abc:abc \
287284
/config

root/etc/services.d/coredns/run

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22

33
cd /config/coredns
44

5-
exec \
6-
/app/coredns -dns.port=53
5+
if netstat -apn | grep -q ":53 "; then
6+
echo "Another service is using port 53, disabling CoreDNS"
7+
sleep infinity
8+
else
9+
exec \
10+
/app/coredns -dns.port=53
11+
fi

0 commit comments

Comments
 (0)