Skip to content

Commit 96e6b0f

Browse files
authored
Merge pull request #71 from linuxserver/disablecore
disable CoreDNS in client mode or if port 53 is in use
2 parents 09a0854 + b3703f2 commit 96e6b0f

File tree

7 files changed

+16
-4
lines changed

7 files changed

+16
-4
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +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 in client mode, or if port 53 is already in use in server mode.
294295
* **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
295296
* **27.09.20:** - Cleaning service binding example to have accurate PreDown script.
296297
* **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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ app_setup_block: |
103103
104104
# changelog
105105
changelogs:
106+
- { date: "06.10.20:", desc: "Disable CoreDNS in client mode, or if port 53 is already in use in server mode." }
106107
- { 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" }
107108
- { date: "27.09.20:", desc: "Cleaning service binding example to have accurate PreDown script." }
108109
- { 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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ if [ -n "$PEERS" ]; then
231231
fi
232232
PEERS_COUNT=$(echo "${#PEERS_ARRAY[@]}")
233233
if [ -z "$SERVERURL" ] || [ "$SERVERURL" = "auto" ]; then
234-
SERVERURL=$(curl icanhazip.com)
234+
SERVERURL=$(curl -s icanhazip.com)
235235
echo "**** SERVERURL var is either not set or is set to \"auto\", setting external IP to auto detected value of $SERVERURL ****"
236236
else
237237
echo "**** External server address is set to $SERVERURL ****"
@@ -266,11 +266,13 @@ 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+
echo "**** Disabling CoreDNS ****"
275+
rm -rf /etc/services.d/coredns
274276
fi
275277

276278
# set up CoreDNS

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)