function rebuild_master() { $master = new master_cf(); $master->master_delete_all(); }
function MasterCFBuilder($restart_service = false) { $smtp_ssl = null; if (!isset($GLOBALS["CLASS_SOCKET"])) { $GLOBALS["CLASS_SOCKET"] = new sockets(); $sock = $GLOBALS["CLASS_SOCKET"]; } else { $sock = $GLOBALS["CLASS_SOCKET"]; } if (!is_object($GLOBALS["CLASS_SOCKET"])) { $GLOBALS["CLASS_SOCKET"] = new sockets(); $sock = $GLOBALS["CLASS_SOCKET"]; } else { $sock = $GLOBALS["CLASS_SOCKET"]; } $EnableArticaSMTPFilter = $sock->GET_INFO("EnableArticaSMTPFilter"); $EnableAmavisInMasterCF = $sock->GET_INFO('EnableAmavisInMasterCF'); $EnableAmavisDaemon = $sock->GET_INFO('EnableAmavisDaemon'); $PostfixEnableMasterCfSSL = $sock->GET_INFO("PostfixEnableMasterCfSSL"); $ArticaFilterMaxProc = $sock->GET_INFO("ArticaFilterMaxProc"); $PostfixEnableSubmission = $sock->GET_INFO("PostfixEnableSubmission"); $EnableASSP = $sock->GET_INFO('EnableASSP'); $PostfixBindInterfacePort = $sock->GET_INFO("PostfixBindInterfacePort"); $user = new usersMenus(); $main = new maincf_multi("master", "master"); $EnablePostScreen = $main->GET("EnablePostScreen"); $postscreen_line = null; $tlsproxy = null; $dnsblog = null; $re_cleanup_infos = null; $smtp_submission = null; $pre_cleanup_addons = null; $master = new master_cf(1, "master"); $MASTER_CF_DEFINED = $master->GetArray(); if ($EnablePostScreen == null) { $EnablePostScreen = 0; } if (!$user->POSTSCREEN_INSTALLED) { $EnablePostScreen = 0; } if ($EnablePostScreen == 1) { $PostfixEnableSubmission = 1; } $ADD_PRECLEANUP = false; $TLSSET = false; if ($GLOBALS["EnablePostfixMultiInstance"] == 1) { $EnableAmavisDaemon = 0; $PostfixEnableMasterCfSSL = 0; } if (!is_numeric($PostfixBindInterfacePort)) { $PostfixBindInterfacePort = 25; } if (!is_numeric($EnableAmavisInMasterCF)) { $EnableAmavisInMasterCF = 0; } if (!is_numeric($PostfixEnableSubmission)) { $PostfixEnableSubmission = 0; } if (!is_numeric($EnableAmavisInMasterCF)) { $EnableAmavisInMasterCF = 0; } if (!is_numeric($ArticaFilterMaxProc)) { $ArticaFilterMaxProc = 20; } if (!is_numeric($EnableASSP)) { $EnableASSP = 0; } shell_exec("{$GLOBALS["postconf"]} -e \"artica-filter_destination_recipient_limit = 1\" >/dev/null 2>&1"); if ($EnableArticaSMTPFilter == 0) { shell_exec("{$GLOBALS["postconf"]} -e \"content_filter =\" >/dev/null 2>&1"); } if ($EnableAmavisInMasterCF == 1) { $MasterCFAmavisInstancesCount = $sock->GET_INFO("MasterCFAmavisInstancesCount"); if (!is_numeric($MasterCFAmavisInstancesCount)) { include_once dirname(__FILE__) . '/ressources/class.amavis.inc'; $amavisClass = new amavis(); $max_servers = $amavisClass->main_array["BEHAVIORS"]["max_servers"]; $MasterCFAmavisInstancesCount = $max_servers - 1; } if ($MasterCFAmavisInstancesCount == 0) { $MasterCFAmavisInstancesCount = "-"; } $ADD_PRECLEANUP = true; echo "Starting......: Amavis is enabled using post-queue mode\n"; echo "Starting......: artica-filter enable={$EnableArticaSMTPFilter}\n"; shell_exec("{$GLOBALS["postconf"]} -e \"content_filter = amavis:[127.0.0.1]:10024\" >/dev/null 2>&1"); if ($EnableArticaSMTPFilter == 1) { $artica_filter_amavis_option = " -o content_filter=artica-filter:"; $amavis_cleanup_infos = " -o cleanup_service_name=pre-cleanup"; echo "Starting......: Artica-filter max process: {$ArticaFilterMaxProc}\n"; } if ($EnableArticaSMTPFilter == 0) { $artica_filter_amavis_option = " -o content_filter="; } echo "Starting......: Amavis max process: {$MasterCFAmavisInstancesCount}\n"; if (isset($MASTER_CF_DEFINED["amavis"])) { unset($MASTER_CF_DEFINED["amavis"]); } $amavis[] = "amavis\tunix\t-\t-\t-\t-\t{$MasterCFAmavisInstancesCount}\tsmtp"; if ($amavis_cleanup_infos != null) { $amavis[] = $amavis_cleanup_infos; } $amavis[] = " -o smtp_data_done_timeout=1200"; $amavis[] = " -o smtp_send_xforward_command=yes"; $amavis[] = " -o disable_dns_lookups=yes"; $amavis[] = " -o smtp_generic_maps="; $amavis[] = " -o smtpd_sasl_auth_enable=no"; $amavis[] = " -o smtpd_use_tls=no"; $amavis[] = " -o max_use=20"; $amavis[] = ""; $amavis[] = ""; if (isset($MASTER_CF_DEFINED["127.0.0.1:10025"])) { unset($MASTER_CF_DEFINED["127.0.0.1:10025"]); } $amavis[] = "127.0.0.1:10025\tinet\tn\t-\tn\t-\t-\tsmtpd"; if ($amavis_cleanup_infos != null) { $amavis[] = $amavis_cleanup_infos; } if ($artica_filter_amavis_option != null) { $amavis[] = $artica_filter_amavis_option; } $amavis[] = " -o local_recipient_maps="; $amavis[] = " -o relay_recipient_maps="; $amavis[] = " -o smtpd_restriction_classes="; $amavis[] = " -o smtpd_client_restrictions="; $amavis[] = " -o smtpd_helo_restrictions="; $amavis[] = " -o smtpd_sender_restrictions="; $artica[] = " -o smtpd_end_of_data_restrictions="; $amavis[] = " -o smtp_generic_maps="; $amavis[] = " -o smtpd_recipient_restrictions=permit_mynetworks,reject"; $amavis[] = " -o mynetworks=127.0.0.0/8"; $amavis[] = " -o mynetworks_style=host"; $amavis[] = " -o strict_rfc821_envelopes=yes"; $amavis[] = " -o smtpd_error_sleep_time=0"; $amavis[] = " -o smtpd_soft_error_limit=1001"; $amavis[] = " -o smtpd_hard_error_limit=1000"; $amavis[] = " -o receive_override_options=no_header_body_checks"; $amavis[] = "\t-o smtpd_sasl_auth_enable=no"; $amavis[] = "\t-o smtpd_use_tls=no"; $master_amavis = @implode("\n", $amavis); } else { $master_amavis = ""; if ($EnableArticaSMTPFilter == 1) { $ADD_PRECLEANUP = true; echo "Starting......: Enable Artica-filter globaly\n"; echo "Starting......: Artica-filter max process: {$ArticaFilterMaxProc}\n"; shell_exec("{$GLOBALS["postconf"]} -e \"content_filter = artica-filter:\" >/dev/null 2>&1"); } else { shell_exec("{$GLOBALS["postconf"]} -e \"content_filter =\" >/dev/null 2>&1"); } } if ($ADD_PRECLEANUP) { echo "Starting......: Enable pre-cleanup service...\n"; $pre_cleanup_addons = " -o smtp_generic_maps= -o canonical_maps= -o sender_canonical_maps= -o recipient_canonical_maps= -o masquerade_domains= -o recipient_bcc_maps= -o sender_bcc_maps="; $re_cleanup_infos = " -o cleanup_service_name=pre-cleanup"; } if ($PostfixEnableMasterCfSSL == 1) { echo "Starting......: Enabling SSL (465 port)\n"; SetTLS(); $TLSSET = true; if (isset($MASTER_CF_DEFINED["smtps"])) { unset($MASTER_CF_DEFINED["smtps"]); } $SSL_INSTANCE[] = "smtps\tinet\tn\t-\tn\t-\t-\tsmtpd"; if ($re_cleanup_infos != null) { $SSL_INSTANCE[] = $re_cleanup_infos; } $SSL_INSTANCE[] = " -o smtpd_tls_wrappermode=yes"; $SSL_INSTANCE[] = " -o smtpd_delay_reject=yes"; $SSL_INSTANCE[] = " -o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject\n"; $SSL_INSTANCE[] = " -o smtpd_sender_restrictions=permit_sasl_authenticated,reject"; $SSL_INSTANCE[] = " -o smtpd_helo_restrictions=permit_sasl_authenticated,reject"; $SSL_INSTANCE[] = " -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject"; $smtp_ssl = @implode("\n", $SSL_INSTANCE); } else { echo "Starting......: SSL (465 port) Disabled\n"; } if ($PostfixEnableSubmission == 1) { echo "Starting......: Enabling submission (587 port)\n"; if (isset($MASTER_CF_DEFINED["submission"])) { unset($MASTER_CF_DEFINED["submission"]); } if (!$TLSSET) { SetTLS(); } $TLSSET = true; $SUBMISSION_INSTANCE[] = "submission\tinet\tn\t-\tn\t-\t-\tsmtpd"; if ($re_cleanup_infos != null) { $SUBMISSION_INSTANCE[] = $re_cleanup_infos; } $SUBMISSION_INSTANCE[] = " -o smtpd_etrn_restrictions=reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_enforce_tls=yes"; $SUBMISSION_INSTANCE[] = " -o smtpd_sasl_auth_enable=yes"; $SUBMISSION_INSTANCE[] = " -o smtpd_delay_reject=yes"; $SUBMISSION_INSTANCE[] = " -o smtpd_client_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_sender_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_helo_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtp_generic_maps="; $SUBMISSION_INSTANCE[] = " -o sender_canonical_maps="; $smtp_submission = @implode("\n", $SUBMISSION_INSTANCE); } else { echo "Starting......: submission (587 port) Disabled\n"; } if ($PostfixBindInterfacePort == 25) { $postfix_listen_port = "smtp"; $postscreen_listen_port = "smtp"; } else { $postfix_listen_port = $PostfixBindInterfacePort; $postscreen_listen_port = $PostfixBindInterfacePort; } echo "Starting......: Postfix intended to listen SMTP Port {$postfix_listen_port}\n"; $smtp_in_proto = "inet"; $smtp_private = "n"; if ($EnableASSP == 1) { echo "Starting......: ASSP is enabled change postfix listen port to 127.0.0.1:26\n"; $postfix_listen_port = "127.0.0.1:6000"; $postscreen_listen_port = "127.0.0.1:6000"; } if ($EnablePostScreen == 1) { if (isset($MASTER_CF_DEFINED["tlsproxy"])) { unset($MASTER_CF_DEFINED["tlsproxy"]); } if (isset($MASTER_CF_DEFINED["dnsblog"])) { unset($MASTER_CF_DEFINED["dnsblog"]); } echo "Starting......: PostScreen is enabled, users should use 587 port to send mails internally\n"; $smtp_in_proto = "pass"; $smtp_private = "-"; if ($postfix_listen_port == "smtp") { $postfix_listen_port = "smtpd"; } $postscreen_line = "{$postscreen_listen_port}\tinet\tn\t-\tn\t-\t1\tpostscreen -o soft_bounce=yes"; $tlsproxy = "tlsproxy\tunix\t-\t-\tn\t-\t0\ttlsproxy"; $dnsblog = "dnsblog\tunix\t-\t-\tn\t-\t0\tdnsblog"; } else { echo "Starting......: PostScreen is disabled\n"; } if ($GLOBALS["VERBOSE"]) { echo "Starting......: run MasterCF_DOMAINS_THROTTLE()\n"; } $smtp_throttle = MasterCF_DOMAINS_THROTTLE(); // http://www.ijs.si/software/amavisd/README.postfix.html $conf[] = "#"; $conf[] = "# Postfix master process configuration file. For details on the format"; $conf[] = "# of the file, see the master(5) manual page (command: \"man 5 master\")."; $conf[] = "#"; $conf[] = "# =========================================================================="; $conf[] = "# service type private unpriv chroot wakeup maxproc command + args"; $conf[] = "# (yes) (yes) (yes) (never) (100)"; $conf[] = "# =========================================================================="; if (isset($MASTER_CF_DEFINED[$postfix_listen_port])) { unset($MASTER_CF_DEFINED[$postfix_listen_port]); } if ($postscreen_line != null) { $conf[] = $postscreen_line; } if ($tlsproxy != null) { $conf[] = $tlsproxy; } if ($dnsblog != null) { $conf[] = $dnsblog; } $conf[] = "{$postfix_listen_port}\t{$smtp_in_proto}\t{$smtp_private}\t-\tn\t-\t-\tsmtpd{$re_cleanup_infos}"; if ($smtp_ssl != null) { $conf[] = $smtp_ssl; } if ($smtp_submission != null) { $conf[] = $smtp_submission; } if ($smtp_throttle != null) { $conf[] = $smtp_throttle; } if (isset($MASTER_CF_DEFINED["pickup"])) { unset($MASTER_CF_DEFINED["pickup"]); } if (isset($MASTER_CF_DEFINED["cleanup"])) { unset($MASTER_CF_DEFINED["cleanup"]); } if (isset($MASTER_CF_DEFINED["mailman"])) { unset($MASTER_CF_DEFINED["mailman"]); } if (count($MASTER_CF_DEFINED) == 0) { $conf[] = "pickup\tfifo\tn\t-\tn\t60\t1\tpickup{$re_cleanup_infos}"; $conf[] = "cleanup\tunix\tn\t-\tn\t-\t0\tcleanup"; $conf[] = "pre-cleanup\tunix\tn\t-\tn\t-\t0\tcleanup{$pre_cleanup_addons}"; $conf[] = "qmgr\tfifo\tn\t-\tn\t300\t1\tqmgr"; $conf[] = "tlsmgr\tunix\t-\t-\tn\t1000?\t1\ttlsmgr"; $conf[] = "rewrite\tunix\t-\t-\tn\t-\t-\ttrivial-rewrite"; $conf[] = "bounce\tunix\t-\t-\tn\t-\t0\tbounce"; $conf[] = "defer\tunix\t-\t-\tn\t-\t0\tbounce"; $conf[] = "trace\tunix\t-\t-\tn\t-\t0\tbounce"; $conf[] = "verify\tunix\t-\t-\tn\t-\t1\tverify"; $conf[] = "flush\tunix\tn\t-\tn\t1000?\t0\tflush"; $conf[] = "proxymap\tunix\t-\t-\tn\t-\t-\tproxymap"; $conf[] = "proxywrite\tunix\t-\t-\tn\t-\t1\tproxymap"; $conf[] = "smtp\tunix\t-\t-\tn\t-\t-\tsmtp"; $conf[] = "relay\tunix\t-\t-\tn\t-\t-\tsmtp -o fallback_relay="; $conf[] = "showq\tunix\tn\t-\tn\t-\t-\tshowq"; $conf[] = "error\tunix\t-\t-\tn\t-\t-\terror"; $conf[] = "discard\tunix\t-\t-\tn\t-\t-\tdiscard"; $conf[] = "local\tunix\t-\tn\tn\t-\t-\tlocal"; $conf[] = "virtual\tunix\t-\tn\tn\t-\t-\tvirtual"; $conf[] = "lmtp\tunix\t-\t-\tn\t-\t-\tlmtp"; $conf[] = "anvil\tunix\t-\t-\tn\t-\t1\tanvil"; $conf[] = "scache\tunix\t-\t-\tn\t-\t1\tscache"; $conf[] = "scan\tunix\t-\t-\tn\t\t-\t10\tsm -v"; $conf[] = "maildrop\tunix\t-\tn\tn\t-\t-\tpipe "; $conf[] = "retry\tunix\t-\t-\tn\t-\t-\terror "; $conf[] = "uucp\tunix\t-\tn\tn\t-\t-\tpipe flags=Fqhu user=uucp argv=uux -r -n -z -a\$sender - \$nexthop!rmail (\$recipient)"; $conf[] = "ifmail\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r \$nexthop (\$recipient)"; $conf[] = "bsmtp\tunix\t-\tn\tn\t-\t-\tpipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t\$nexthop -f\$sender \$recipient"; } while (list($service, $MFARRY) = each($MASTER_CF_DEFINED)) { $conf[] = "{$service}\t{$MFARRY["TYPE"]}\t{$MFARRY["PRIVATE"]}\t{$MFARRY["UNIPRIV"]}\t{$MFARRY["CHROOT"]}\t{$MFARRY["WAKEUP"]}\t{$MFARRY["MAXPROC"]}\t{$MFARRY["COMMAND"]}"; echo "Starting......: master.cf adding {$service} ({$MFARRY["TYPE"]})\n"; } $conf[] = "mailman\tunix\t-\tn\tn\t-\t-\tpipe flags=FR user=mail:mail argv=/etc/mailman/postfix-to-mailman.py \${nexthop} \${mailbox}"; $conf[] = "artica-whitelist\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --white"; $conf[] = "artica-blacklist\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --black"; $conf[] = "artica-reportwbl\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --report"; $conf[] = "artica-reportquar\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --quarantines"; $conf[] = "artica-spam\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --spam"; $conf[] = "zarafa\tunix\t-\tn\tn\t-\t-\tpipe\tuser=mail argv=/usr/local/bin/zarafa-dagent \${user}"; $conf[] = "artica-filter\tunix\t-\tn\tn\t-\t{$ArticaFilterMaxProc}\tpipe flags=FOh user=www-data argv=/usr/share/artica-postfix/exec.artica-filter.php -f \${sender} -- -s \${sender} -r \${recipient} -c \${client_address}"; $conf[] = ""; $conf[] = $master_amavis; $conf[] = ""; $conf[] = "127.0.0.1:33559\tinet\tn\t-\tn\t-\t-\tsmtpd"; $conf[] = " -o notify_clases=protocol,resource,software"; $conf[] = " -o header_checks="; $conf[] = " -o content_filter="; $conf[] = " -o smtpd_restriction_classes="; $conf[] = " -o smtpd_delay_reject=no"; $conf[] = " -o smtpd_client_restrictions=permit_mynetworks,reject"; $conf[] = " -o smtpd_helo_restrictions="; $conf[] = " -o smtpd_sender_restrictions="; $conf[] = " -o smtpd_recipient_restrictions=permit_mynetworks,reject"; $conf[] = " -o smtpd_data_restrictions=reject_unauth_pipelining"; $conf[] = " -o smtpd_end_of_data_restrictions="; $conf[] = " -o mynetworks=127.0.0.0/8"; $conf[] = " -o strict_rfc821_envelopes=yes"; $conf[] = " -o smtpd_error_sleep_time=0"; $conf[] = " -o smtpd_soft_error_limit=1001"; $conf[] = " -o smtpd_hard_error_limit=1000"; $conf[] = " -o smtpd_client_connection_count_limit=0"; $conf[] = " -o smtpd_client_connection_rate_limit=0"; $conf[] = " -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks"; $conf[] = " -o smtp_send_xforward_command=yes"; $conf[] = " -o disable_dns_lookups=yes"; $conf[] = " -o local_header_rewrite_clients="; $conf[] = " -o smtp_generic_maps="; $conf[] = " -o sender_canonical_maps="; $conf[] = " -o smtpd_milters="; $conf[] = " -o smtpd_sasl_auth_enable=no"; $conf[] = " -o smtpd_use_tls=no"; $conf[] = ""; $conf[] = ""; @file_put_contents("/etc/postfix/master.cf", @implode("\n", $conf)); echo "Starting......: master.cf done\n"; if ($GLOBALS["RELOAD"]) { shell_exec("/usr/sbin/postfix reload"); } if ($restart_service) { shell_exec("{$GLOBALS["postfix"]} stop"); shell_exec("{$GLOBALS["postfix"]} start"); } }
function SaveMastercf() { $master = new master_cf(); $master->PostfixMasterCfFile = $_GET["master_datas"]; $master->SaveToLdap(); }
function MasterCFBuilder($restart_service = false) { $smtp_ssl = null; if (!isset($GLOBALS["CLASS_SOCKET"])) { $GLOBALS["CLASS_SOCKET"] = new sockets(); $sock = $GLOBALS["CLASS_SOCKET"]; } else { $sock = $GLOBALS["CLASS_SOCKET"]; } if (!is_object($GLOBALS["CLASS_SOCKET"])) { $GLOBALS["CLASS_SOCKET"] = new sockets(); $sock = $GLOBALS["CLASS_SOCKET"]; } else { $sock = $GLOBALS["CLASS_SOCKET"]; } $EnableArticaSMTPFilter = $sock->GET_INFO("EnableArticaSMTPFilter"); $EnableArticaSMTPFilter = 0; $EnableAmavisInMasterCF = intval($sock->GET_INFO('EnableAmavisInMasterCF')); $EnableAmavisDaemon = intval($sock->GET_INFO('EnableAmavisDaemon')); $PostfixEnableMasterCfSSL = $sock->GET_INFO("PostfixEnableMasterCfSSL"); $ArticaFilterMaxProc = $sock->GET_INFO("ArticaFilterMaxProc"); $PostfixEnableSubmission = $sock->GET_INFO("PostfixEnableSubmission"); $EnableASSP = $sock->GET_INFO('EnableASSP'); $PostfixBindInterfacePort = $sock->GET_INFO("PostfixBindInterfacePort"); $TrustMyNetwork = $sock->GET_INFO("TrustMyNetwork"); if (!is_numeric($TrustMyNetwork)) { $TrustMyNetwork = 1; } $user = new usersMenus(); $main = new maincf_multi("master", "master"); $EnablePostScreen = $main->GET("EnablePostScreen"); $postscreen_line = null; $tlsproxy = null; $dnsblog = null; $re_cleanup_infos = null; $smtp_submission = null; $pre_cleanup_addons = null; $master = new master_cf(1, "master"); $ver210 = false; $users = new usersMenus(); echo "Starting......: " . date("H:i:s") . " Postfix master version: {$users->POSTFIX_VERSION}\n"; if (preg_match("#^([0-9]+)\\.([0-9]+)#", $users->POSTFIX_VERSION, $re)) { $major = intval($re[1]); $minor = intval($re[2]); $binver = intval("{$major}{$minor}"); if ($binver >= 210) { echo "Starting......: " . date("H:i:s") . " Postfix master version: 2.10 [{$binver}] OK\n"; $ver210 = true; } } $MASTER_CF_DEFINED = $master->GetArray(); if ($EnablePostScreen == null) { $EnablePostScreen = 0; } if (!$user->POSTSCREEN_INSTALLED) { $EnablePostScreen = 0; } if ($EnablePostScreen == 1) { $PostfixEnableSubmission = 1; } $ADD_PRECLEANUP = false; $TLSSET = false; if ($GLOBALS["EnablePostfixMultiInstance"] == 1) { $EnableAmavisDaemon = 0; $PostfixEnableMasterCfSSL = 0; } if (!is_numeric($PostfixBindInterfacePort)) { $PostfixBindInterfacePort = 25; } if ($EnableAmavisDaemon == 0) { $EnableAmavisInMasterCF = 0; } if (!is_numeric($PostfixEnableSubmission)) { $PostfixEnableSubmission = 0; } if (!is_numeric($EnableASSP)) { $EnableASSP = 0; } shell_exec("{$GLOBALS["postconf"]} -X \"content_filter\" >/dev/null 2>&1"); build_progress_sender_routing("{building} Master.cf", 35); if ($EnableAmavisInMasterCF == 1) { build_progress_sender_routing("{building} Amavis hooks", 40); $MasterCFAmavisInstancesCount = intval($sock->GET_INFO("MasterCFAmavisInstancesCount")); if ($MasterCFAmavisInstancesCount == 0) { $MasterCFAmavisInstancesCount = "-"; } if ($MasterCFAmavisInstancesCount < 0) { $MasterCFAmavisInstancesCount = "-"; } $ADD_PRECLEANUP = true; echo "Starting......: " . date("H:i:s") . " Amavis is enabled using post-queue mode\n"; shell_exec("{$GLOBALS["postconf"]} -e \"content_filter = amavis:[127.0.0.1]:10024\" >/dev/null 2>&1"); echo "Starting......: " . date("H:i:s") . " Amavis max process: {$MasterCFAmavisInstancesCount}\n"; if (isset($MASTER_CF_DEFINED["amavis"])) { unset($MASTER_CF_DEFINED["amavis"]); } $amavis[] = "amavis\tunix\t-\t-\t-\t-\t{$MasterCFAmavisInstancesCount}\tsmtp"; $amavis[] = " -o smtp_data_done_timeout=1200"; $amavis[] = " -o smtp_send_xforward_command=yes"; $amavis[] = " -o disable_dns_lookups=yes"; $amavis[] = " -o smtp_generic_maps="; $amavis[] = " -o smtpd_sasl_auth_enable=no"; $amavis[] = " -o smtpd_use_tls=no"; $amavis[] = " -o max_use=20"; $amavis[] = ""; $amavis[] = ""; if (isset($MASTER_CF_DEFINED["127.0.0.1:10025"])) { unset($MASTER_CF_DEFINED["127.0.0.1:10025"]); } $amavis[] = "127.0.0.1:10025\tinet\tn\t-\tn\t-\t-\tsmtpd"; $amavis[] = " -o local_recipient_maps="; $amavis[] = " -o relay_recipient_maps="; $amavis[] = " -o smtpd_restriction_classes="; $amavis[] = " -o smtpd_client_restrictions="; $amavis[] = " -o smtpd_helo_restrictions="; $amavis[] = " -o smtpd_sender_restrictions="; $artica[] = " -o smtpd_end_of_data_restrictions="; $amavis[] = " -o smtp_generic_maps="; $amavis[] = " -o smtpd_recipient_restrictions=permit_mynetworks,reject"; $amavis[] = " -o mynetworks=127.0.0.0/8"; $amavis[] = " -o mynetworks_style=host"; $amavis[] = " -o strict_rfc821_envelopes=yes"; $amavis[] = " -o smtpd_error_sleep_time=0"; $amavis[] = " -o smtpd_soft_error_limit=1001"; $amavis[] = " -o smtpd_hard_error_limit=1000"; $amavis[] = " -o receive_override_options=no_header_body_checks"; $amavis[] = "\t-o smtpd_sasl_auth_enable=no"; $amavis[] = " -o smtpd_milters="; if ($ver210) { $amavis[] = "\t-o smtpd_upstream_proxy_protocol="; } $amavis[] = "\t-o smtpd_use_tls=no"; $master_amavis = @implode("\n", $amavis); } if ($ADD_PRECLEANUP) { echo "Starting......: " . date("H:i:s") . " Enable pre-cleanup service...\n"; $pre_cleanup_addons = " -o smtp_generic_maps= -o canonical_maps= -o sender_canonical_maps= -o recipient_canonical_maps= -o masquerade_domains= -o recipient_bcc_maps= -o sender_bcc_maps="; $re_cleanup_infos = " -o cleanup_service_name=pre-cleanup"; } $permit_mynetworks = null; if ($PostfixEnableMasterCfSSL == 1) { if ($TrustMyNetwork == 1) { $permit_mynetworks = "permit_mynetworks,"; } echo "Starting......: " . date("H:i:s") . " Enabling SSL (465 port)\n"; SetTLS(); $TLSSET = true; if (isset($MASTER_CF_DEFINED["smtps"])) { unset($MASTER_CF_DEFINED["smtps"]); } $SSL_INSTANCE[] = "smtps\tinet\tn\t-\tn\t-\t-\tsmtpd"; if ($re_cleanup_infos != null) { $SSL_INSTANCE[] = $re_cleanup_infos; } $SSL_INSTANCE[] = " -o smtpd_tls_wrappermode=yes"; $SSL_INSTANCE[] = " -o smtpd_delay_reject=yes"; //$SSL_INSTANCE[]=" -o smtpd_client_restrictions={$permit_mynetworks}permit_sasl_authenticated,reject\n"; //$SSL_INSTANCE[]=" -o smtpd_sender_restrictions=permit_sasl_authenticated,reject"; //$SSL_INSTANCE[]=" -o smtpd_helo_restrictions=permit_sasl_authenticated,reject"; //$SSL_INSTANCE[]=" -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject"; $smtp_ssl = @implode("\n", $SSL_INSTANCE); } else { echo "Starting......: " . date("H:i:s") . " SSL (465 port) Disabled\n"; } if ($PostfixEnableSubmission == 1) { echo "Starting......: " . date("H:i:s") . " Enabling submission (587 port)\n"; if (isset($MASTER_CF_DEFINED["submission"])) { unset($MASTER_CF_DEFINED["submission"]); } if (!$TLSSET) { SetTLS(); } $TLSSET = true; $SUBMISSION_INSTANCE[] = "submission\tinet\tn\t-\tn\t-\t-\tsmtpd"; if ($re_cleanup_infos != null) { $SUBMISSION_INSTANCE[] = $re_cleanup_infos; } $SUBMISSION_INSTANCE[] = " -o smtpd_etrn_restrictions=reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_enforce_tls=yes"; $SUBMISSION_INSTANCE[] = " -o smtpd_sasl_auth_enable=yes"; $SUBMISSION_INSTANCE[] = " -o smtpd_delay_reject=yes"; $SUBMISSION_INSTANCE[] = " -o smtpd_client_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_sender_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_helo_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject"; $SUBMISSION_INSTANCE[] = " -o smtp_generic_maps="; $SUBMISSION_INSTANCE[] = " -o sender_canonical_maps="; $smtp_submission = @implode("\n", $SUBMISSION_INSTANCE); } else { echo "Starting......: " . date("H:i:s") . " submission (587 port) Disabled\n"; } if ($PostfixBindInterfacePort == 25) { $postfix_listen_port = "smtp"; $postscreen_listen_port = "smtp"; } else { $postfix_listen_port = $PostfixBindInterfacePort; $postscreen_listen_port = $PostfixBindInterfacePort; } echo "Starting......: " . date("H:i:s") . " Postfix intended to listen SMTP Port {$postfix_listen_port}\n"; $smtp_in_proto = "inet"; $smtp_private = "n"; if ($EnableASSP == 1) { echo "Starting......: " . date("H:i:s") . " ASSP is enabled change postfix listen port to 127.0.0.1:26\n"; $postfix_listen_port = "127.0.0.1:6000"; $postscreen_listen_port = "127.0.0.1:6000"; } if ($EnablePostScreen == 1) { if (isset($MASTER_CF_DEFINED["tlsproxy"])) { unset($MASTER_CF_DEFINED["tlsproxy"]); } if (isset($MASTER_CF_DEFINED["dnsblog"])) { unset($MASTER_CF_DEFINED["dnsblog"]); } echo "Starting......: " . date("H:i:s") . " PostScreen is enabled, users should use 587 port to send mails internally\n"; $smtp_in_proto = "pass"; $smtp_private = "-"; if ($postfix_listen_port == "smtp") { $postfix_listen_port = "smtpd"; } $postscreen_line = "{$postscreen_listen_port}\tinet\tn\t-\tn\t-\t1\tpostscreen -o soft_bounce=yes"; $tlsproxy = "tlsproxy\tunix\t-\t-\tn\t-\t0\ttlsproxy"; $dnsblog = "dnsblog\tunix\t-\t-\tn\t-\t0\tdnsblog"; } else { echo "Starting......: " . date("H:i:s") . " PostScreen is disabled\n"; } if ($GLOBALS["VERBOSE"]) { echo "Starting......: " . date("H:i:s") . " run MasterCF_DOMAINS_THROTTLE()\n"; } build_progress_sender_routing("{building} DOMAINS_THROTTLE", 45); $smtp_throttle = MasterCF_DOMAINS_THROTTLE(); // http://www.ijs.si/software/amavisd/README.postfix.html $conf[] = "#"; $conf[] = "# Postfix master process configuration file. For details on the format"; $conf[] = "# of the file, see the master(5) manual page (command: \"man 5 master\")."; $conf[] = "#"; $conf[] = "# =========================================================================="; $conf[] = "# service type private unpriv chroot wakeup maxproc command + args"; $conf[] = "# (yes) (yes) (yes) (never) (100)"; $conf[] = "# =========================================================================="; if (isset($MASTER_CF_DEFINED[$postfix_listen_port])) { unset($MASTER_CF_DEFINED[$postfix_listen_port]); } if ($postscreen_line != null) { $conf[] = $postscreen_line; } if ($tlsproxy != null) { $conf[] = $tlsproxy; } if ($dnsblog != null) { $conf[] = $dnsblog; } $conf[] = "{$postfix_listen_port}\t{$smtp_in_proto}\t{$smtp_private}\t-\tn\t-\t-\tsmtpd{$re_cleanup_infos}"; if ($smtp_ssl != null) { $conf[] = $smtp_ssl; } if ($smtp_submission != null) { $conf[] = $smtp_submission; } if ($smtp_throttle != null) { $conf[] = $smtp_throttle; } if (isset($MASTER_CF_DEFINED["pickup"])) { unset($MASTER_CF_DEFINED["pickup"]); } if (isset($MASTER_CF_DEFINED["cleanup"])) { unset($MASTER_CF_DEFINED["cleanup"]); } if (isset($MASTER_CF_DEFINED["mailman"])) { unset($MASTER_CF_DEFINED["mailman"]); } if (count($MASTER_CF_DEFINED) == 0) { $conf[] = "pickup\tfifo\tn\t-\tn\t60\t1\tpickup{$re_cleanup_infos}"; $conf[] = "cleanup\tunix\tn\t-\tn\t-\t0\tcleanup"; $conf[] = "pre-cleanup\tunix\tn\t-\tn\t-\t0\tcleanup{$pre_cleanup_addons}"; $conf[] = "qmgr\tfifo\tn\t-\tn\t300\t1\tqmgr"; $conf[] = "tlsmgr\tunix\t-\t-\tn\t1000?\t1\ttlsmgr"; $conf[] = "rewrite\tunix\t-\t-\tn\t-\t-\ttrivial-rewrite"; $conf[] = "bounce\tunix\t-\t-\tn\t-\t0\tbounce"; $conf[] = "defer\tunix\t-\t-\tn\t-\t0\tbounce"; $conf[] = "trace\tunix\t-\t-\tn\t-\t0\tbounce"; $conf[] = "verify\tunix\t-\t-\tn\t-\t1\tverify"; $conf[] = "flush\tunix\tn\t-\tn\t1000?\t0\tflush"; $conf[] = "proxymap\tunix\t-\t-\tn\t-\t-\tproxymap"; $conf[] = "proxywrite\tunix\t-\t-\tn\t-\t1\tproxymap"; $conf[] = "smtp\tunix\t-\t-\tn\t-\t-\tsmtp"; $conf[] = "relay\tunix\t-\t-\tn\t-\t-\tsmtp -o fallback_relay="; $conf[] = "showq\tunix\tn\t-\tn\t-\t-\tshowq"; $conf[] = "error\tunix\t-\t-\tn\t-\t-\terror"; $conf[] = "discard\tunix\t-\t-\tn\t-\t-\tdiscard"; $conf[] = "local\tunix\t-\tn\tn\t-\t-\tlocal"; $conf[] = "virtual\tunix\t-\tn\tn\t-\t-\tvirtual"; $conf[] = "lmtp\tunix\t-\t-\tn\t-\t-\tlmtp"; $conf[] = "anvil\tunix\t-\t-\tn\t-\t1\tanvil"; $conf[] = "scache\tunix\t-\t-\tn\t-\t1\tscache"; $conf[] = "scan\tunix\t-\t-\tn\t\t-\t10\tsm -v"; $conf[] = "maildrop\tunix\t-\tn\tn\t-\t-\tpipe "; $conf[] = "retry\tunix\t-\t-\tn\t-\t-\terror "; $conf[] = "uucp\tunix\t-\tn\tn\t-\t-\tpipe flags=Fqhu user=uucp argv=uux -r -n -z -a\$sender - \$nexthop!rmail (\$recipient)"; $conf[] = "ifmail\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r \$nexthop (\$recipient)"; $conf[] = "bsmtp\tunix\t-\tn\tn\t-\t-\tpipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t\$nexthop -f\$sender \$recipient"; } else { if (!isset($MASTER_CF_DEFINED["pickup"])) { $conf[] = "pickup\tfifo\tn\t-\tn\t60\t1\tpickup{$re_cleanup_infos}"; } if (!isset($MASTER_CF_DEFINED["cleanup"])) { $conf[] = "cleanup\tunix\tn\t-\tn\t-\t0\tcleanup"; } if (!isset($MASTER_CF_DEFINED["pre-cleanup"])) { $conf[] = "pre-cleanup\tunix\tn\t-\tn\t-\t0\tcleanup{$pre_cleanup_addons}"; } if (!isset($MASTER_CF_DEFINED["qmgr"])) { $conf[] = "qmgr\tfifo\tn\t-\tn\t300\t1\tqmgr"; } if (!isset($MASTER_CF_DEFINED["rewrite"])) { $conf[] = "rewrite\tunix\t-\t-\tn\t-\t-\ttrivial-rewrite"; } if (!isset($MASTER_CF_DEFINED["bounce"])) { $conf[] = "bounce\tunix\t-\t-\tn\t-\t0\tbounce"; } if (!isset($MASTER_CF_DEFINED["defer"])) { $conf[] = "defer\tunix\t-\t-\tn\t-\t0\tbounce"; } if (!isset($MASTER_CF_DEFINED["trace"])) { $conf[] = "trace\tunix\t-\t-\tn\t-\t0\tbounce"; } if (!isset($MASTER_CF_DEFINED["verify"])) { $conf[] = "verify\tunix\t-\t-\tn\t-\t1\tverify"; } if (!isset($MASTER_CF_DEFINED["flush"])) { $conf[] = "flush\tunix\tn\t-\tn\t1000?\t0\tflush"; } if (!isset($MASTER_CF_DEFINED["proxymap"])) { $conf[] = "proxymap\tunix\t-\t-\tn\t-\t-\tproxymap"; } if (!isset($MASTER_CF_DEFINED["proxywrite"])) { $conf[] = "proxywrite\tunix\t-\t-\tn\t-\t1\tproxymap"; } if (!isset($MASTER_CF_DEFINED["smtp"])) { $conf[] = "smtp\tunix\t-\t-\tn\t-\t-\tsmtp"; } if (!isset($MASTER_CF_DEFINED["relay"])) { $conf[] = "relay\tunix\t-\t-\tn\t-\t-\tsmtp -o fallback_relay="; } if (!isset($MASTER_CF_DEFINED["showq"])) { $conf[] = "showq\tunix\tn\t-\tn\t-\t-\tshowq"; } if (!isset($MASTER_CF_DEFINED["error"])) { $conf[] = "error\tunix\t-\t-\tn\t-\t-\terror"; } if (!isset($MASTER_CF_DEFINED["discard"])) { $conf[] = "discard\tunix\t-\t-\tn\t-\t-\tdiscard"; } if (!isset($MASTER_CF_DEFINED["local"])) { $conf[] = "local\tunix\t-\tn\tn\t-\t-\tlocal"; } if (!isset($MASTER_CF_DEFINED["virtual"])) { $conf[] = "virtual\tunix\t-\tn\tn\t-\t-\tvirtual"; } if (!isset($MASTER_CF_DEFINED["lmtp"])) { $conf[] = "lmtp\tunix\t-\t-\tn\t-\t-\tlmtp"; } if (!isset($MASTER_CF_DEFINED["anvil"])) { $conf[] = "anvil\tunix\t-\t-\tn\t-\t1\tanvil"; } if (!isset($MASTER_CF_DEFINED["scache"])) { $conf[] = "scache\tunix\t-\t-\tn\t-\t1\tscache"; } if (!isset($MASTER_CF_DEFINED["scan"])) { $conf[] = "scan\tunix\t-\t-\tn\t\t-\t10\tsm -v"; } if (!isset($MASTER_CF_DEFINED["maildrop"])) { $conf[] = "maildrop\tunix\t-\tn\tn\t-\t-\tpipe "; } if (!isset($MASTER_CF_DEFINED["retry"])) { $conf[] = "retry\tunix\t-\t-\tn\t-\t-\terror "; } if (!isset($MASTER_CF_DEFINED["uucp"])) { $conf[] = "uucp\tunix\t-\tn\tn\t-\t-\tpipe flags=Fqhu user=uucp argv=uux -r -n -z -a\$sender - \$nexthop!rmail (\$recipient)"; } if (!isset($MASTER_CF_DEFINED["ifmail"])) { $conf[] = "ifmail\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r \$nexthop (\$recipient)"; } if (!isset($MASTER_CF_DEFINED["bsmtp"])) { $conf[] = "bsmtp\tunix\t-\tn\tn\t-\t-\tpipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t\$nexthop -f\$sender \$recipient"; } } while (list($service, $MFARRY) = each($MASTER_CF_DEFINED)) { $MFARRY["MAXPROC"] = intval($MFARRY["MAXPROC"]); $conf[] = "{$service}\t{$MFARRY["TYPE"]}\t{$MFARRY["PRIVATE"]}\t{$MFARRY["UNIPRIV"]}\t{$MFARRY["CHROOT"]}\t{$MFARRY["WAKEUP"]}\t{$MFARRY["MAXPROC"]}\t{$MFARRY["COMMAND"]}"; echo "Starting......: " . date("H:i:s") . " master.cf adding {$service} ({$MFARRY["TYPE"]})\n"; } $conf[] = "mailman\tunix\t-\tn\tn\t-\t-\tpipe flags=FR user=mail:mail argv=/etc/mailman/postfix-to-mailman.py \${nexthop} \${mailbox}"; $conf[] = "artica-whitelist\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --white"; $conf[] = "artica-blacklist\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --black"; $conf[] = "artica-reportwbl\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --report"; $conf[] = "artica-reportquar\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --quarantines"; $conf[] = "artica-spam\tunix\t-\tn\tn\t-\t-\tpipe flags=F user=mail argv=/usr/share/artica-postfix/bin/artica-whitelist -a \${nexthop} -s \${sender} --spam"; $conf[] = "zarafa\tunix\t-\tn\tn\t-\t-\tpipe\tuser=mail argv=/usr/bin/zarafa-dagent \${user}"; $unix = new unix(); $cyrdeliver = $unix->find_program("cyrdeliver"); if (is_file($cyrdeliver)) { echo "Starting......: " . date("H:i:s") . " master.cf adding cyrus\n"; $conf[] = "cyrus\tunix\t-\tn\tn\t-\t-\tpipe\tflags=R user=cyrus argv=/usr/sbin/cyrdeliver -e -m \${extension} \${user}"; } else { $conf[] = "# cyrdeliver no such binary."; } $conf[] = ""; $conf[] = ""; $conf[] = $master_amavis; $conf[] = ""; $conf[] = "127.0.0.1:33559\tinet\tn\t-\tn\t-\t-\tsmtpd"; $conf[] = " -o notify_classes=protocol,resource,software"; $conf[] = " -o header_checks="; $conf[] = " -o content_filter="; $conf[] = " -o smtpd_restriction_classes="; $conf[] = " -o smtpd_delay_reject=no"; $conf[] = " -o smtpd_client_restrictions=permit_mynetworks,reject"; $conf[] = " -o smtpd_helo_restrictions="; $conf[] = " -o smtpd_sender_restrictions="; $conf[] = " -o smtpd_recipient_restrictions=permit_mynetworks,reject"; $conf[] = " -o smtpd_data_restrictions=reject_unauth_pipelining"; $conf[] = " -o smtpd_end_of_data_restrictions="; $conf[] = " -o mynetworks=127.0.0.0/8"; $conf[] = " -o strict_rfc821_envelopes=yes"; $conf[] = " -o smtpd_error_sleep_time=0"; $conf[] = " -o smtpd_soft_error_limit=1001"; $conf[] = " -o smtpd_hard_error_limit=1000"; $conf[] = " -o smtpd_client_connection_count_limit=0"; $conf[] = " -o smtpd_client_connection_rate_limit=0"; $conf[] = " -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks"; $conf[] = " -o smtp_send_xforward_command=yes"; $conf[] = " -o disable_dns_lookups=yes"; $conf[] = " -o local_header_rewrite_clients="; $conf[] = " -o smtp_generic_maps="; $conf[] = " -o sender_canonical_maps="; $conf[] = " -o smtpd_milters="; $conf[] = " -o smtpd_sasl_auth_enable=no"; $conf[] = " -o smtpd_use_tls=no"; if ($ver210) { $conf[] = "\t -o smtpd_upstream_proxy_protocol="; } $q = new mysql(); $sql = "SELECT * FROM sender_dependent_relay_host WHERE enabled=1 \n\t\t\t\tAND `override_transport`=1 \n\t\t\t\tAND `hostname`='master' ORDER by zOrders"; $results = $q->QUERY_SQL($sql, "artica_backup"); echo "Starting......: " . date("H:i:s") . " master.cf sender_dependent_relay_host " . mysql_num_rows($results) . " item(s)\n"; build_progress_sender_routing("{building} master.cf sender_dependent_relay_host", 50); $main = new maincf_multi(); while ($ligne = mysql_fetch_assoc($results)) { $domain = $ligne["domain"]; $md5 = $ligne["zmd5"]; $relay = $ligne["relay"]; $relay_port_text = null; $relay_port = $ligne["relay_port"]; $lookups = $ligne["lookups"]; $relay_text = $main->RelayToPattern($relay, $relay_port, $lookups); $conf[] = ""; $conf[] = "{$md5}\tunix\t-\t-\tn\t-\t-\tsmtp"; if ($ligne["smtp_bind_address"] != null) { $conf[] = " -o smtp_bind_address={$ligne["smtp_bind_address"]}"; } if ($ligne["smtp_helo_name"] != null) { $conf[] = " -o smtp_helo_name={$ligne["smtp_helo_name"]}"; } if ($ligne["syslog_name"] != null) { $ligne["syslog_name"] = str_replace(" ", "-", $ligne["syslog_name"]); $conf[] = " -o syslog_name={$ligne["syslog_name"]}"; } if ($ligne["directmode"] == 0) { if ($ligne["relay"] != null) { $conf[] = " -o relayhost={$relay_text}"; if ($ligne["enabledauth"] == 0) { $conf[] = " -o smtp_sasl_password_maps=hash:/etc/postfix/smtp_sasl_password"; $conf[] = " -o smtp_sasl_auth_enable=yes"; } } } else { $conf[] = " -o relayhost="; $conf[] = " -o smtp_host_lookup=dns"; } // 04 -o syslog_name=postfix-customer1 } $conf[] = ""; $conf[] = ""; build_progress_sender_routing("{building} master.cf {done}", 55); @file_put_contents("/etc/postfix/master.cf", @implode("\n", $conf)); echo "Starting......: " . date("H:i:s") . " master.cf done\n"; if ($GLOBALS["RELOAD"]) { shell_exec("/usr/sbin/postfix reload >/dev/null 2>&1"); } if ($restart_service) { build_progress_sender_routing("{restarting_service}", 60); shell_exec("{$GLOBALS["postfix"]} stop"); shell_exec("{$GLOBALS["postfix"]} start"); } }