Using existing certs..
This commit is contained in:
@@ -38,7 +38,7 @@ fi
|
|||||||
# (directories are already created in Dockerfile with proper ownership)
|
# (directories are already created in Dockerfile with proper ownership)
|
||||||
touch /var/log/prosody/prosody.log /var/log/prosody/prosody.err 2>/dev/null || true
|
touch /var/log/prosody/prosody.log /var/log/prosody/prosody.err 2>/dev/null || true
|
||||||
|
|
||||||
# Copy Let's Encrypt certificate to prosody certs directory
|
# Copy Let's Encrypt certificate to prosody certs directory if available
|
||||||
CERT_PATH="/etc/prosody/certs/xmpp.guschin.info.crt"
|
CERT_PATH="/etc/prosody/certs/xmpp.guschin.info.crt"
|
||||||
KEY_PATH="/etc/prosody/certs/xmpp.guschin.info.key"
|
KEY_PATH="/etc/prosody/certs/xmpp.guschin.info.key"
|
||||||
LETSENCRYPT_CERT="/etc/prosody/certs/letsencrypt/fullchain.pem"
|
LETSENCRYPT_CERT="/etc/prosody/certs/letsencrypt/fullchain.pem"
|
||||||
@@ -51,11 +51,16 @@ if [ -f "$LETSENCRYPT_CERT" ] && [ -f "$LETSENCRYPT_KEY" ]; then
|
|||||||
chmod 644 "$CERT_PATH"
|
chmod 644 "$CERT_PATH"
|
||||||
chmod 600 "$KEY_PATH"
|
chmod 600 "$KEY_PATH"
|
||||||
chown prosody:prosody "$CERT_PATH" "$KEY_PATH"
|
chown prosody:prosody "$CERT_PATH" "$KEY_PATH"
|
||||||
|
echo "Let's Encrypt certificate successfully installed"
|
||||||
|
elif [ ! -f "$CERT_PATH" ] || [ ! -f "$KEY_PATH" ]; then
|
||||||
|
echo "Let's Encrypt certificate not found, generating self-signed certificate..."
|
||||||
|
openssl req -x509 -newkey rsa:4096 -keyout "$KEY_PATH" -out "$CERT_PATH" \
|
||||||
|
-days 365 -nodes -subj "/CN=xmpp.guschin.info"
|
||||||
|
chmod 600 "$KEY_PATH"
|
||||||
|
chmod 644 "$CERT_PATH"
|
||||||
|
chown prosody:prosody "$CERT_PATH" "$KEY_PATH"
|
||||||
else
|
else
|
||||||
echo "ERROR: Let's Encrypt certificates not found at:"
|
echo "Using existing certificates"
|
||||||
echo " Certificate: $LETSENCRYPT_CERT"
|
|
||||||
echo " Private Key: $LETSENCRYPT_KEY"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting Prosody..."
|
echo "Starting Prosody..."
|
||||||
|
|||||||
Reference in New Issue
Block a user