1
1
mirror of https://github.com/dnscrypt/dnscrypt-server-docker synced 2024-11-26 06:13:49 +01:00

If a secret.key file is present, import it even in start()

This commit is contained in:
Frank Denis 2019-09-26 23:50:16 +02:00
parent b8b7e34f10
commit 7ece61f762
2 changed files with 10 additions and 1 deletions

@ -37,7 +37,7 @@ ENV RUSTFLAGS "-C link-arg=-s"
RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS && \ RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS && \
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly && \ curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly && \
export PATH="$HOME/.cargo/bin:$PATH" && \ export PATH="$HOME/.cargo/bin:$PATH" && \
echo "Compiling encrypted-dns version 0.2.5" && \ echo "Compiling encrypted-dns version 0.2.6" && \
cargo install encrypted-dns && \ cargo install encrypted-dns && \
mkdir -p /opt/encrypted-dns/sbin && \ mkdir -p /opt/encrypted-dns/sbin && \
mv ~/.cargo/bin/encrypted-dns /opt/encrypted-dns/sbin/ && \ mv ~/.cargo/bin/encrypted-dns /opt/encrypted-dns/sbin/ && \

@ -78,6 +78,7 @@ init() {
--config "$CONFIG_FILE" \ --config "$CONFIG_FILE" \
--import-from-dnscrypt-wrapper "${KEYS_DIR}/secret.key" \ --import-from-dnscrypt-wrapper "${KEYS_DIR}/secret.key" \
--dry-run >/dev/null || exit 1 --dry-run >/dev/null || exit 1
mv -f "${KEYS_DIR}/secret.key" "${KEYS_DIR}/secret.key.migrated"
fi fi
/opt/encrypted-dns/sbin/encrypted-dns \ /opt/encrypted-dns/sbin/encrypted-dns \
@ -149,6 +150,14 @@ ensure_initialized() {
start() { start() {
ensure_initialized ensure_initialized
if [ -f "${KEYS_DIR}/secret.key" ]; then
echo "Importing the previous secret key [${KEYS_DIR}/secret.key]"
/opt/encrypted-dns/sbin/encrypted-dns \
--config "$CONFIG_FILE" \
--import-from-dnscrypt-wrapper "${KEYS_DIR}/secret.key" \
--dry-run >/dev/null || exit 1
mv -f "${KEYS_DIR}/secret.key" "${KEYS_DIR}/secret.key.migrated"
fi
/opt/encrypted-dns/sbin/encrypted-dns \ /opt/encrypted-dns/sbin/encrypted-dns \
--config "$CONFIG_FILE" --dry-run | --config "$CONFIG_FILE" --dry-run |
tee "${KEYS_DIR}/provider-info.txt" tee "${KEYS_DIR}/provider-info.txt"