From 6b1b0cd3f0dcd7b620293e1057c6b51658eebbe9 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 11 Apr 2018 12:00:43 +0200 Subject: [PATCH] Finishing installation Postfix --- bin/postinst | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/bin/postinst b/bin/postinst index 6114ca6..f932402 100644 --- a/bin/postinst +++ b/bin/postinst @@ -21,6 +21,7 @@ GIT_PASSWD="shiesa&a4taich+iecah8Chu" GIT_REPO_DIR="postfix_config" GIT_REPO="https://@@acount@@:@@pwd@@@git.pixelpark.com/ppadmin/${GIT_REPO_DIR}.git" POSTFIX_MYORIGIN='pixelpark.net' +POSTFIX_RELAYHOST='[mx.pixelpark.net]' echo echo "Some information:" @@ -693,16 +694,27 @@ install_postfix() { log "Installing and configuring Postfix ..." local -a main_options_remove=( + 'address_verify_map' + 'address_verify_relay_transport' + 'broken_sasl_auth_clients' 'command_directory' 'daemon_directory' 'data_directory' 'debug_peer_level' 'debugger_command' + 'hash_queue_depth' 'html_directory' 'lmtp_tls_loglevel' 'mail_owner' 'manpage_directory' + 'masquerade_domains' + 'master_service_disable' + 'maximal_queue_lifetime' 'queue_directory' + 'readme_directory' + 'recipient_canonical_maps' + 'recipient_delimiter' + 'relay_domains' 'sample_directory' 'sender_dependent_default_transport_maps' 'sender_dependent_relayhost_maps' @@ -719,6 +731,9 @@ install_postfix() { 'smtpd_client_restrictions' 'smtpd_helo_restrictions' 'smtpd_recipient_restrictions' + 'smtpd_relay_restrictions' + 'smtpd_sasl_auth_enable' + 'smtpd_sasl_authenticated_header' 'smtpd_sasl_local_domain' 'smtpd_sender_restrictions' 'smtpd_tls_auth_only' @@ -731,22 +746,32 @@ install_postfix() { 'smtpd_use_tls' 'tls_random_prng_update_period' 'tls_random_source' + 'transport_maps' 'unknown_local_recipient_reject_code' + 'unverified_recipient_reject_code' ) local -a main_options_set=( + 'alias_database = ${default_database_type}:/etc/aliases' + 'alias_maps =' 'append_dot_mydomain = no' 'biff = no' 'default_database_type = hash' 'inet_protocols = all' + 'local_recipient_maps =' + 'local_transport = error:5.1.1 Mailbox unavailable' 'mailbox_size_limit = 0' 'message_size_limit = 358400000' + 'mydestination =' "mydomain = ${POSTFIX_MYORIGIN}" "myhostname = ${hostname}" + 'mynetworks = 127.0.0.0/8' + "relayhost = ${POSTFIX_RELAYHOST}" 'smtp_generic_maps = ${default_database_type}:/etc/postfix/generic' 'smtp_tls_note_starttls_offer = yes' 'smtp_tls_security_level = none' 'smtpd_banner = $myhostname ESMTP $mail_name $mail_version' + 'virtual_alias_maps = ${default_database_type}:/etc/postfix/virtual' ) @@ -776,7 +801,8 @@ install_postfix() { local option= for option in "${main_options_remove[@]}" ; do echo "Removing postfix option '${option}' ..." - sed -i -e "s/^\\(${option}( |$).*\\)/#\\1/" "/etc/postfix/main.cf" + postconf -X "${option}" + #sed -i -e "s/^\\(${option}( |$).*\\)/#\\1/" "/etc/postfix/main.cf" done for option in "${main_options_set[@]}" ; do @@ -794,11 +820,30 @@ install_postfix() { git clone "${url}" cd "${GIT_REPO_DIR}" + echo "Copying virtual ..." + cp -pv maps/virtual-nullclient-webmaster /etc/postfix/virtual + postmap hash:/etc/postfix/virtual + + echo "Copying master.cf ..." + cp -pv master-nullclient.cf /etc/postfix/master.cf + cd .. echo "Removing '${GIT_REPO_DIR}'" rm -rf "${GIT_REPO_DIR}" cd + echo + echo "${HASH_LINE}" + echo "Generated main postfix configuration:" + echo + postconf -n + echo + echo "${HASH_LINE}" + echo "Generated master postfix configuration:" + echo + postconf -M + echo + } #----------------------------------------------------------- @@ -843,6 +888,7 @@ main() { dist_upgrade install_clamav install_puppet + install_postfix config_rsyslog_to_remote remove_ipv6_localhost -- 2.39.5