added hook to override hostname; amavis fix
This commit is contained in:
parent
7d72204a33
commit
75529a077a
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -19,7 +18,7 @@ DEFAULT_VARS["ENABLE_SASLAUTHD"]="${ENABLE_SASLAUTHD:="0"}"
|
||||||
DEFAULT_VARS["SMTP_ONLY"]="${SMTP_ONLY:="0"}"
|
DEFAULT_VARS["SMTP_ONLY"]="${SMTP_ONLY:="0"}"
|
||||||
DEFAULT_VARS["VIRUSMAILS_DELETE_DELAY"]="${VIRUSMAILS_DELETE_DELAY:="7"}"
|
DEFAULT_VARS["VIRUSMAILS_DELETE_DELAY"]="${VIRUSMAILS_DELETE_DELAY:="7"}"
|
||||||
DEFAULT_VARS["DMS_DEBUG"]="${DMS_DEBUG:="0"}"
|
DEFAULT_VARS["DMS_DEBUG"]="${DMS_DEBUG:="0"}"
|
||||||
DEFAULT_VARS["OVERRIDE_HOSTNAME"]="${OVERRIDE_HOSTNAME:=false}"
|
DEFAULT_VARS["OVERRIDE_HOSTNAME"]="${OVERRIDE_HOSTNAME:="false"}"
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# << DEFAULT VARS
|
# << DEFAULT VARS
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -96,6 +95,7 @@ function register_functions() {
|
||||||
_register_setup_function "_setup_docker_permit"
|
_register_setup_function "_setup_docker_permit"
|
||||||
|
|
||||||
_register_setup_function "_setup_mailname"
|
_register_setup_function "_setup_mailname"
|
||||||
|
_register_setup_function "_setup_amavis"
|
||||||
|
|
||||||
_register_setup_function "_setup_postfix_override_configuration"
|
_register_setup_function "_setup_postfix_override_configuration"
|
||||||
_register_setup_function "_setup_postfix_sasl_password"
|
_register_setup_function "_setup_postfix_sasl_password"
|
||||||
|
@ -319,15 +319,16 @@ function check() {
|
||||||
function _check_hostname() {
|
function _check_hostname() {
|
||||||
notify "task" "Check that hostname/domainname is provided or overidden (no default docker hostname/kubernetes) [$FUNCNAME]"
|
notify "task" "Check that hostname/domainname is provided or overidden (no default docker hostname/kubernetes) [$FUNCNAME]"
|
||||||
|
|
||||||
|
if [[ ${DEFAULT_VARS["OVERRIDE_HOSTNAME"]} != "false" ]]; then
|
||||||
|
export HOSTNAME=${DEFAULT_VARS["OVERRIDE_HOSTNAME"]}
|
||||||
|
export DOMAINNAME=$(echo $HOSTNAME | sed s/[^.]*.//)
|
||||||
|
fi
|
||||||
|
|
||||||
if ( ! echo $HOSTNAME | grep -E '^(\S+[.]\S+)$' > /dev/null ); then
|
if ( ! echo $HOSTNAME | grep -E '^(\S+[.]\S+)$' > /dev/null ); then
|
||||||
notify 'err' "Setting hostname/domainname is required"
|
notify 'err' "Setting hostname/domainname is required"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
if [[ ${DEFAULT_VARS["OVERRIDE_HOSTNAME"]} != "false" ]]; then
|
notify 'inf' "Domain has been set to $DOMAINNAME"
|
||||||
HOSTNAME=${DEFAULT_VARS["OVERRIDE_HOSTNAME"]}
|
|
||||||
DOMAINNAME=$(echo $HOSTNAME | sed s/[^.]*.//)
|
|
||||||
fi
|
|
||||||
|
|
||||||
notify 'inf' "Hostname has been set to $HOSTNAME"
|
notify 'inf' "Hostname has been set to $HOSTNAME"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -371,6 +372,13 @@ function _setup_mailname() {
|
||||||
echo $DOMAINNAME > /etc/mailname
|
echo $DOMAINNAME > /etc/mailname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _setup_amavis() {
|
||||||
|
notify 'task' 'Setting up Amavis'
|
||||||
|
|
||||||
|
notify 'inf' "Applying hostname to /etc/amavis/conf.d/05-node_id"
|
||||||
|
sed -i 's/^#\$myhostname = "mail.example.com";/\$myhostname = "'$HOSTNAME'";/' /etc/amavis/conf.d/05-node_id
|
||||||
|
}
|
||||||
|
|
||||||
function _setup_dovecot() {
|
function _setup_dovecot() {
|
||||||
notify 'task' 'Setting up Dovecot'
|
notify 'task' 'Setting up Dovecot'
|
||||||
|
|
||||||
|
@ -1018,17 +1026,8 @@ function _start_daemons_clamav() {
|
||||||
function _start_daemons_amavis() {
|
function _start_daemons_amavis() {
|
||||||
notify 'task' 'Starting amavis' 'n'
|
notify 'task' 'Starting amavis' 'n'
|
||||||
display_startup_daemon "/etc/init.d/amavis start"
|
display_startup_daemon "/etc/init.d/amavis start"
|
||||||
|
|
||||||
# @TODO fix: on integration test of mail_with_ldap amavis fails because of:
|
|
||||||
# Starting amavisd: The value of variable $myhostname is "ldap", but should have been
|
|
||||||
# a fully qualified domain name; perhaps uname(3) did not provide such.
|
|
||||||
# You must explicitly assign a FQDN of this host to variable $myhostname
|
|
||||||
# in /etc/amavis/conf.d/05-node_id, or fix what uname(3) provides as a host's
|
|
||||||
# network name!
|
|
||||||
|
|
||||||
# > temporary workaround to pass integration test
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# << Start Daemons
|
# << Start Daemons
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in New Issue