mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Use modified knockd to set a cooldown on port 19132 (#2003)
This commit is contained in:
parent
e43669d792
commit
e217ac503e
@ -52,6 +52,11 @@ RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
|
||||
| tar -C /usr/share -zxf - \
|
||||
&& ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin
|
||||
|
||||
# Install modified knockd
|
||||
ADD https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-${TARGETARCH}${TARGETVARIANT}.tar.gz /tmp/knock.tar.gz
|
||||
RUN tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||
RUN find /usr/lib -name 'libpcap.so.0.8' -execdir cp '{}' libpcap.so.1 \;
|
||||
|
||||
VOLUME ["/data"]
|
||||
WORKDIR /data
|
||||
|
||||
|
@ -21,7 +21,7 @@ apk add --no-cache -U \
|
||||
rsync \
|
||||
nano \
|
||||
sudo \
|
||||
knock \
|
||||
tar \
|
||||
zstd \
|
||||
nfs-utils
|
||||
nfs-utils \
|
||||
libpcap
|
||||
|
@ -33,6 +33,6 @@ dnf install -y ImageMagick \
|
||||
unzip \
|
||||
zstd \
|
||||
lbzip2 \
|
||||
knock
|
||||
libpcap
|
||||
|
||||
bash /build/ol/install-gosu.sh
|
||||
|
@ -23,7 +23,7 @@ apt-get install -y \
|
||||
unzip \
|
||||
zstd \
|
||||
lbzip2 \
|
||||
knockd \
|
||||
nfs-common
|
||||
nfs-common \
|
||||
libpcap0.8
|
||||
|
||||
apt-get clean
|
||||
apt-get clean
|
||||
|
@ -45,7 +45,7 @@ if isTrue "${DEBUG_AUTOPAUSE}"; then
|
||||
knockdArgs+=(-D)
|
||||
fi
|
||||
|
||||
sudo /usr/sbin/knockd "${knockdArgs[@]}"
|
||||
sudo /usr/local/sbin/knockd "${knockdArgs[@]}"
|
||||
if [ $? -ne 0 ] ; then
|
||||
logAutopause "Failed to start knockd daemon."
|
||||
logAutopause "Probable cause: Unable to attach to interface \"$AUTOPAUSE_KNOCK_INTERFACE\"."
|
||||
|
@ -13,3 +13,4 @@
|
||||
[unpauseMCServer-bedrock]
|
||||
sequence = 19132:udp
|
||||
command = /auto/resume.sh %IP%
|
||||
seq_cooldown = 60
|
||||
|
@ -1,2 +1,2 @@
|
||||
minecraft ALL=(ALL) NOPASSWD:/usr/bin/pkill
|
||||
minecraft ALL=(ALL) NOPASSWD:/usr/sbin/knockd
|
||||
minecraft ALL=(ALL) NOPASSWD:/usr/local/sbin/knockd
|
||||
|
@ -84,4 +84,9 @@ elif [[ -z "$MAX_TICK_TIME" ]] ; then
|
||||
export MAX_TICK_TIME
|
||||
fi
|
||||
|
||||
# seq_cooldown cannot be larger than AUTOPAUSE_TIMEOUT_KN, otherwise the server may
|
||||
# become paused while knockd is still ignoring packets, preventing players from joining.
|
||||
let COOLDOWN=$AUTOPAUSE_TIMEOUT_KN/2
|
||||
sed -i "s/\(seq_cooldown *= *\).*/\1$COOLDOWN/" /tmp/knockd-config.cfg
|
||||
|
||||
/auto/autopause-daemon.sh &
|
||||
|
Loading…
Reference in New Issue
Block a user