Add Webserver user (www-data) to group 'dovecot' if not already done.

This commit is contained in:
Christoph 2021-04-19 01:43:54 +02:00
parent c37da29142
commit a013c0317e

View File

@ -177,6 +177,8 @@ if $xmpp_listener ; then
[[ -n "$xmpp_listener_port" ]] || xmpp_listener_port="44444"
fi
[[ -n "$http_user" ]] || http_user="www-data"
[[ -n "$dbname" ]] || dbname="postfix"
[[ -n "$dbuser" ]] || dbuser="postfix"
if [[ -z "$dbhost" ]] ; then
@ -694,6 +696,19 @@ else
echo -e "$rc_skipped"
fi
echononl "\tAdd Apache User (${http_user}) to group 'dovecot'.."
if getent group dovecot 2> /dev/null | grep -q "\b${http_user}\b" > /dev/null 2>&1 ; then
echo -e "$rc_skipped"
else
usermod -a -G dovecot $http_user > ${_log_dir}/system.log 2>&1
if [[ $? -eq 0 ]] ; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
error "Failed to add Apache User (${http_user}) to group 'dovecot'!"
fi
fi
echononl "\tCreate group dovenull.."
if ! grep dovenull /etc/group > /dev/null ; then