install_update_dovecot: add mail_log plugin configuration and logging options
This commit is contained in:
1 parent
564a5254ad
commit
686f291b68
2 files changed
+91
No files matched your search
@@ -1093,6 +1093,10 @@ fi
|
||||
[[ -n "$max_userip_connections" ]] || max_userip_connections=24
|
||||
[[ -n "$auth_mechanisms" ]] || auth_mechanisms="plain login"
|
||||
|
||||
[[ -n "$mail_log" ]] || mail_log=true
|
||||
[[ -n "$mail_log_events" ]] || mail_log_events="copy save expunge delete undelete mailbox_create mailbox_delete mailbox_rename"
|
||||
[[ -n "$mail_log_fields" ]] || mail_log_fields="uid box msgid from subject"
|
||||
|
||||
[[ -n "$service_limit_nofile" ]] || service_limit_nofile=524280
|
||||
|
||||
[[ -n "${vmail_uid}" ]] || vmail_uid=${DEFAULT_VMAIL_UID}
|
||||
@@ -1303,6 +1307,12 @@ echo ""
|
||||
echo -e "\tSpan folder...................: $spam_folder"
|
||||
echo -e "\tMax user connections per ip...: $max_userip_connections"
|
||||
echo ""
|
||||
echo -e "\tLog mail actions (mail_log)...: $mail_log"
|
||||
if $mail_log ; then
|
||||
echo -e "\t mail_log_events............: $mail_log_events"
|
||||
echo -e "\t mail_log_fields............: $mail_log_fields"
|
||||
fi
|
||||
echo ""
|
||||
echo -e "\tAuth Listener (Jabber)........: $xmpp_listener"
|
||||
if $xmpp_listener ; then
|
||||
echo -e "\t Auth Listener Addresses....: $xmpp_listener_addresses"
|
||||
@@ -2337,6 +2347,10 @@ echo "" >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
echo "spam_folder=\"${spam_folder}\"" >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
echo "max_userip_connections"=${max_userip_connections} >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
|
||||
echo "mail_log=${mail_log}" >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
echo "mail_log_events=\"${mail_log_events}\"" >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
echo "mail_log_fields=\"${mail_log_fields}\"" >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
|
||||
echo "plugin_expire=${plugin_expire}" >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
|
||||
#echo "" >> ${INSTALL_UPDATE_ENVIRONMENT_FILE}
|
||||
@@ -9723,6 +9737,62 @@ PYEOF
|
||||
fi # Dovecot 2.4+ quota_clone
|
||||
|
||||
|
||||
## -----------------------------------------------------------------
|
||||
## --- mail_log plugin (Dovecot 2.4+)
|
||||
## ---
|
||||
## --- Logs mailbox actions (copy/move, save, expunge, delete, folder
|
||||
## --- create/delete/rename). Helps to answer "where did my mail go?"
|
||||
## --- (e.g. client rules moving mails into the spam folder).
|
||||
## ---
|
||||
## --- Every line carries the prefix imap(<user>)<pid><session>; the
|
||||
## --- session id links it to the imap-login line (rip=, login time).
|
||||
## -----------------------------------------------------------------
|
||||
|
||||
if [[ $dovecot_major_version -gt 2 ]] \
|
||||
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
||||
|
||||
_conf_file="/usr/local/dovecot-${_version}/etc/dovecot/conf.d/95-mail-log.conf"
|
||||
|
||||
if $mail_log ; then
|
||||
echononl " Create '$(basename "${_conf_file}")' (mail_log plugin).."
|
||||
cat <<EOF > "${_conf_file}" 2> "${log_file}"
|
||||
##
|
||||
## Logging of mail actions (mail_log plugin)
|
||||
##
|
||||
## Generated by $(basename "$0") - change settings in
|
||||
## conf/$(basename "${conf_file}") (mail_log, mail_log_events,
|
||||
## mail_log_fields) and rerun the script.
|
||||
##
|
||||
## Every line carries the prefix imap(<user>)<pid><session>
|
||||
## -> the session=<...> of the matching imap-login line gives
|
||||
## client IP (rip=) and login time.
|
||||
##
|
||||
## see also: https://doc.dovecot.org/${_version}/core/plugins/mail_log.html
|
||||
##
|
||||
|
||||
mail_plugins {
|
||||
notify = yes
|
||||
mail_log = yes
|
||||
}
|
||||
|
||||
mail_log_events = ${mail_log_events}
|
||||
mail_log_fields = ${mail_log_fields}
|
||||
EOF
|
||||
if [ "$?" = 0 ]; then
|
||||
echo -e "$rc_done"
|
||||
else
|
||||
echo -e "$rc_failed"
|
||||
error "Creating file '${_conf_file}' failed!\n$(cat "${log_file}")"
|
||||
fi
|
||||
else
|
||||
echononl " Create '$(basename "${_conf_file}")' (mail_log plugin).."
|
||||
rm -f "${_conf_file}"
|
||||
echo -e "$rc_skipped"
|
||||
fi
|
||||
|
||||
fi # Dovecot 2.4+ mail_log
|
||||
|
||||
|
||||
# In order to support extra variable "quota_rule", also userdb's and
|
||||
# passdb's SQL query have to update
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user