Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
update docker entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ciphax committed Mar 1, 2019
1 parent 8cfe5e2 commit 2dd614a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
6 changes: 3 additions & 3 deletions etc/certbot-inwx-auth
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh

CRED_PATH=/etc/letsencrypt-inwx-cred
CONFIG_PATH=/etc/letsencrypt-inwx.json

if [ -f ~/.config/letsencrypt-inwx-cred ]; then
CRED_PATH=~/.config/letsencrypt-inwx-cred
CONFIG_PATH=~/.config/letsencrypt-inwx.json
fi

/usr/bin/letsencrypt-inwx create -c $CRED_PATH -d "_acme-challenge.$CERTBOT_DOMAIN" -v "$CERTBOT_VALIDATION"
/usr/bin/letsencrypt-inwx create -c $CONFIG_PATH -d "_acme-challenge.$CERTBOT_DOMAIN" -v "$CERTBOT_VALIDATION"
6 changes: 3 additions & 3 deletions etc/certbot-inwx-cleanup
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh

CRED_PATH=/etc/letsencrypt-inwx-cred
CONFIG_PATH=/etc/letsencrypt-inwx.json

if [ -f ~/.config/letsencrypt-inwx-cred ]; then
CRED_PATH=~/.config/letsencrypt-inwx-cred
CONFIG_PATH=~/.config/letsencrypt-inwx.json
fi

/usr/bin/letsencrypt-inwx delete -c $CRED_PATH -d "_acme-challenge.$CERTBOT_DOMAIN"
/usr/bin/letsencrypt-inwx delete -c $CONFIG_PATH -d "_acme-challenge.$CERTBOT_DOMAIN"
41 changes: 20 additions & 21 deletions etc/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
hasErrors=false
CONF_CREATED=false

if [ -z "$INWX_USER" ]; then
echo "ERROR: Missing env-argument INWX_USER"
hasErrors=true
fi

if [ -z "$INWX_PASSWD" ]; then
echo "ERROR: Missing env-argument INWX_PASSWD"
hasErrors=true
fi

if [ $hasErrors = true ]; then
exit 1;
fi

cat << EOF > /etc/letsencrypt-inwx-cred
$INWX_USER
$INWX_PASSWD
if [ ! -z "$INWX_USER" -a ! -z "$INWX_PASSWD" ]; then
CONF_CREATED=true
>&2 echo "\
!!! WARNING !!!
PASSING INWX_USER AND INWX_PASSWD AS ENV VARIABLES IS DEPRECATED AND WILL BE REMOVED IN THE FUTURE!
You should mount a config file into the container instead. See https://github.com/kegato/letsencrypt-inwx for details.
"
cat << EOF > /etc/letsencrypt-inwx.conf
{
"accounts": [{
"username": "$INWX_USER",
"password": "$INWX_PASSWD"
}]
}
EOF

chmod 600 /etc/letsencrypt-inwx-cred
chmod 600 /etc/letsencrypt-inwx.conf
fi

set -x
certbot -n --agree-tos --server https://acme-v02.api.letsencrypt.org/directory $@
set +x

rm /etc/letsencrypt-inwx-cred
if [ $CONF_CREATED = true ]; then
rm /etc/letsencrypt-inwx.conf
fi

0 comments on commit 2dd614a

Please sign in to comment.