This commit is contained in:
+22
-4
@@ -2,9 +2,27 @@
|
||||
|
||||
set -o pipefail -o nounset -o errexit
|
||||
|
||||
# Récupère le fingerprint SHA1 du certificat fourni par le serveur
|
||||
IMAP_CERT="$(echo | (openssl s_client -connect "${IMAP_SRV}:993" 2>/dev/null || true) | openssl x509 -fingerprint -sha1 -noout | cut -d'=' -f2 | sed 's/://g')"
|
||||
CONFIG_FILE="/home/offlineimap/.offlineimaprc"
|
||||
|
||||
sed -i'' "s/XXX_REPLACE_USER_XXX/${IMAP_USER}/g;s/XXX_REPLACE_PASS_XXX/${IMAP_PASS}/g;s/XXX_REPLACE_SRV_XXX/${IMAP_SRV}/g;s/XXX_REPLACE_FINGERPRINT_XXX/${IMAP_CERT}/g" "/home/offlineimap/.offlineimaprc"
|
||||
if [ -n "${GMAIL_USER:-}" ]; then
|
||||
echo "Using Gmail configuration mode..."
|
||||
cp "/home/offlineimap/offlineimaprc.gmail.tmpl" "$CONFIG_FILE"
|
||||
|
||||
# Gmail IMAP server
|
||||
IMAP_SRV="imap.gmail.com"
|
||||
|
||||
# Récupère le fingerprint SHA1 du certificat
|
||||
IMAP_CERT="$(echo | (openssl s_client -connect "${IMAP_SRV}:993" 2>/dev/null || true) | openssl x509 -fingerprint -sha1 -noout | cut -d'=' -f2 | sed 's/://g')"
|
||||
|
||||
sed -i "s|XXX_REPLACE_USER_XXX|${GMAIL_USER}|g;s|XXX_REPLACE_PASS_XXX|${GMAIL_PASS}|g;s|XXX_REPLACE_FINGERPRINT_XXX|${IMAP_CERT:-}|g" "$CONFIG_FILE"
|
||||
else
|
||||
echo "Using standard IMAP configuration mode..."
|
||||
cp "/home/offlineimap/offlineimaprc.imap.tmpl" "$CONFIG_FILE"
|
||||
|
||||
# Récupère le fingerprint SHA1 du certificat fourni par le serveur
|
||||
IMAP_CERT="$(echo | (openssl s_client -connect "${IMAP_SRV}:993" 2>/dev/null || true) | openssl x509 -fingerprint -sha1 -noout | cut -d'=' -f2 | sed 's/://g')"
|
||||
|
||||
sed -i "s|XXX_REPLACE_USER_XXX|${IMAP_USER}|g;s|XXX_REPLACE_PASS_XXX|${IMAP_PASS}|g;s|XXX_REPLACE_SRV_XXX|${IMAP_SRV}|g;s|XXX_REPLACE_FINGERPRINT_XXX|${IMAP_CERT:-}|g" "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
exec offlineimap -c "/home/offlineimap/.offlineimaprc"
|
||||
exec offlineimap -c "$CONFIG_FILE"
|
||||
|
||||
Reference in New Issue
Block a user