entrypoint.sh
This commit is contained in:
parent
3f669a53a4
commit
b670438ca2
|
|
@ -13,6 +13,10 @@ services:
|
||||||
- ./ssl:/etc/dovecot/ssl
|
- ./ssl:/etc/dovecot/ssl
|
||||||
- ./mail:/var/mail
|
- ./mail:/var/mail
|
||||||
- ./log:/var/log
|
- ./log:/var/log
|
||||||
|
- ./entrypoint.sh:/entrypoint.sh # Custom Entrypoint-Script
|
||||||
|
environment:
|
||||||
|
- UMASK=002 # Wird von unserem Entrypoint verwendet
|
||||||
|
entrypoint: ["/bin/sh", "/entrypoint.sh"]
|
||||||
networks:
|
networks:
|
||||||
- mail_network
|
- mail_network
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# entrypoint.sh - Custom entrypoint für Dovecot mit UMASK-Einstellung
|
||||||
|
|
||||||
|
# UMASK aus Umgebungsvariable setzen (Standard ist 002, wenn nicht anders angegeben)
|
||||||
|
CUSTOM_UMASK=${UMASK:-002}
|
||||||
|
echo "Setting umask to $CUSTOM_UMASK"
|
||||||
|
umask $CUSTOM_UMASK
|
||||||
|
|
||||||
|
# UMASK auch in /etc/login.defs setzen für zukünftige Logins
|
||||||
|
sed -i "s/^UMASK\s*[0-9]\+/UMASK $CUSTOM_UMASK/" /etc/login.defs
|
||||||
|
# Falls UMASK noch nicht existiert, hinzufügen
|
||||||
|
grep -q "^UMASK" /etc/login.defs || echo "UMASK $CUSTOM_UMASK" >> /etc/login.defs
|
||||||
|
|
||||||
|
# Dovecot-Einstellungen anwenden (falls nötig)
|
||||||
|
if [ -n "$DOVECOT_UID" ] && [ -n "$DOVECOT_GID" ]; then
|
||||||
|
echo "Configuring Dovecot with UID=$DOVECOT_UID, GID=$DOVECOT_GID"
|
||||||
|
sed -i "s/^mail_uid\s*=.*/mail_uid = $DOVECOT_UID/" /etc/dovecot/dovecot.conf
|
||||||
|
sed -i "s/^mail_gid\s*=.*/mail_gid = $DOVECOT_GID/" /etc/dovecot/dovecot.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wenn nicht genügend Berechtigungen für Mail-Verzeichnisse, automatisch korrigieren
|
||||||
|
echo "Checking mail directory permissions..."
|
||||||
|
find /var/mail -type d -exec chmod 775 {} \; 2>/dev/null || true
|
||||||
|
find /var/mail -type f -exec chmod 664 {} \; 2>/dev/null || true
|
||||||
|
|
||||||
|
# Original Docker-Entrypoint ausführen
|
||||||
|
# oder direkter Start von Dovecot, je nach Image
|
||||||
|
if [ -f "/docker-entrypoint.sh" ]; then
|
||||||
|
echo "Executing original docker-entrypoint.sh"
|
||||||
|
exec /docker-entrypoint.sh "$@"
|
||||||
|
else
|
||||||
|
echo "Starting dovecot"
|
||||||
|
exec dovecot -F
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue