Postfix Sender Name and Mail Address are default only

Discussion in 'Installation/Configuration' started by Alisnasyon, Feb 11, 2022.

  1. Alisnasyon

    Alisnasyon New Member

    I have a multiserver setup on Centos where Webserver and Mailserver on different machines. Postfix rewrites the Subject and from Address of the Mail. Postfix Sending out mails as [email protected] (ex: [email protected]) instead of [email protected] ([email protected])

    Example via PHP mail function:

    PHP:
    <?php
        mail
    ('[email protected]''PHP Mail test''Testing PHP mail and Postfix', array('From' => '[email protected]','Reply-To' => '[email protected]'));
        echo 
    "Test email sent";
    ?>
    On Weserver (w1.webdomain.net):
    Code:
    [...]
    Feb 11 14:14:31 w1 postfix/smtpd[15704]: error: open database /etc/aliases.db: No such file or directory
    Feb 11 14:14:31 w1 postfix/smtpd[15704]: connect from w1.webdomain.net[x.x.x.1]
    Feb 11 14:14:31 w1 postfix/smtpd[15704]: CC30220CD: client=w1.webdomain.net[x.x.x.1]
    Feb 11 14:14:32 w1 postfix/cleanup[15707]: CC30220CD: message-id=<[email protected]>
    Feb 11 14:14:32 w1 postfix/smtpd[15704]: disconnect from w1.webdomain.net[x.x.x.1]
    Feb 11 14:14:32 w1 sSMTP[15703]: Sent mail for [email protected] (221 2.0.0 Bye) uid=1003 username=web8 outbytes=392
    Feb 11 14:14:32 w1 postfix/qmgr[11584]: CC30220CD: from=<[email protected]>, size=530, nrcpt=1 (queue active)
    Feb 11 14:14:32 w1 postfix/smtp[15708]: CC30220CD: to=<[email protected]>, relay=mx.maildomain.net[x.x.x.2]:25, delay=1.2, delays=1/0.02/0.07/0.06, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as EF34E6C019A)
    Feb 11 14:14:32 w1 postfix/qmgr[11584]: CC30220CD: removed
    
    and on Mailserver (mx.maildomain.net):
    Code:
    [...]
    Feb 11 14:14:32 mx postfix/smtpd[26783]: connect from unknown[x.x.x.1]
    Feb 11 14:14:32 mx postfix/smtpd[26783]: NOQUEUE: filter: RCPT from unknown[x.x.x.1]: <[email protected]>: Sender address triggers FILTER lmtp:[127.0.0.1]:10026; from=<[email protected]> [email protected]> proto=ESMTP helo=<w1.webdomain.net>
    Feb 11 14:14:32 mx postfix/smtpd[26783]: EF34E6C019A: client=unknown[x.x.x.1]
    Feb 11 14:14:32 mx postfix/cleanup[28417]: EF34E6C019A: message-id=<[email protected]>
    Feb 11 14:14:32 mx postfix/smtpd[26783]: disconnect from unknown[x.x.x.1]
    Feb 11 14:14:32 mx postfix/qmgr[24748]: EF34E6C019A: from=<[email protected]>, size=712, nrcpt=1 (queue active)
    Feb 11 14:14:33 mx postfix/smtpd[28420]: connect from mx.maildomain.net[127.0.0.1]
    Feb 11 14:14:33 mx postfix/smtpd[28420]: B564F6C029E: client=mx.maildomain.net[127.0.0.1]
    Feb 11 14:14:33 mx postfix/cleanup[28417]: B564F6C029E: message-id=<[email protected]>
    Feb 11 14:14:33 mx postfix/qmgr[24748]: B564F6C029E: from=<[email protected]>, size=1147, nrcpt=1 (queue active)
    Feb 11 14:14:33 mx postfix/smtpd[28420]: disconnect from mx.maildomain.net[127.0.0.1]
    Feb 11 14:14:33 mx amavis[32235]: (32235-18) Passed CLEAN {RelayedOutbound}, ORIGINATING/MYNETS LOCAL [127.0.0.1] [x.x.x.1] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: 8NZFzlPMp6J1, Hits: 1.266, size: 712, queued_as: B564F6C029E, 758 ms
    Feb 11 14:14:33 mx postfix/lmtp[28418]: EF34E6C019A: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10026, delay=0.82, delays=0.05/0.01/0/0.76, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10027): 250 2.0.0 Ok: queued as B564F6C029E)
    Feb 11 14:14:33 mx postfix/qmgr[24748]: EF34E6C019A: removed
    Feb 11 14:14:34 mx postfix/smtp[28374]: B564F6C029E: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[:::::]:25, delay=0.72, delays=0.01/0/0.4/0.3, dsn=2.0.0, status=sent (250 2.0.0 OK  1644585274 o11si6069890wrq.784 - gsmtp)
    Feb 11 14:14:34 mx postfix/qmgr[24748]: B564F6C029E: removed
    
    the Received Mail has the From address:
    Expected: [email protected]
    Actual: [email protected] [where 'web1' is the Linux user of Client and the Servername is the Webserver]

    and the "From Name" has the From Mailaddress ([email protected]) from above and not "myname"

    main.cf on webserver w1.webdomain.net:
    Code:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
    html_directory = no
    inet_interfaces = all
    inet_protocols = ipv4
    mail_owner = postfix
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    myhostname = w1.webdomain.net
    mynetworks = x.x.x.1, x.x.x.2
    myorigin = $mydomain
    newaliases_path = /usr/bin/newaliases.postfix
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
    relayhost = mx.samadu.net
    sample_directory = /usr/share/doc/postfix-2.10.1/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtpd_banner = $myhostname ESMTP $mail_name
    unknown_local_recipient_reject_code = 550
    
    main.cf on webserver mx.maildomain.net:
    Code:
    address_verify_negative_refresh_time = 60s
    address_verify_sender_ttl = 15686s
    alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    body_checks = regexp:/etc/postfix/body_checks
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    content_filter = amavis:[127.0.0.1]:10024
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
    dovecot_destination_recipient_limit = 1
    enable_original_recipient = yes
    greylisting = check_policy_service inet:127.0.0.1:10023
    header_checks = regexp:/etc/postfix/header_checks
    html_directory = no
    inet_interfaces = all
    inet_protocols = all
    mail_owner = postfix
    mailbox_size_limit = 0
    maildrop_destination_concurrency_limit = 1
    maildrop_destination_recipient_limit = 1
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    message_size_limit = 0
    mime_header_checks = regexp:/etc/postfix/mime_header_checks
    mydestination = $myhostname, localhost, localhost.localdomain
    myhostname = mx.maildomain.net
    mynetworks = 127.0.0.0/8, [::1]/128, x.x.x.1, x.x.x.2
    nested_header_checks = regexp:/etc/postfix/nested_header_checks
    newaliases_path = /usr/bin/newaliases.postfix
    owner_request_special = no
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $virtual_uid_maps $virtual_gid_maps $smtpd_client_restrictions $smtpd_sender_restrictions $smtpd_recipient_restrictions $smtp_sasl_password_maps $sender_dependent_relayhost_maps
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
    receive_override_options = no_address_mappings
    relay_domains = proxy:mysql:/etc/postfix/mysql-virtual_relaydomains.cf
    relay_recipient_maps = proxy:mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
    sample_directory = /usr/share/doc/postfix-2.10.1/samples
    sender_bcc_maps = proxy:mysql:/etc/postfix/mysql-virtual_outgoing_bcc.cf
    sender_dependent_relayhost_maps = proxy:mysql:/etc/postfix/mysql-virtual_sender-relayhost.cf
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = proxy:mysql:/etc/postfix/mysql-virtual_sender-relayauth.cf, texthash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous, noplaintext
    smtp_sasl_tls_security_options = noanonymous
    smtp_sender_dependent_authentication = yes
    smtp_tls_exclude_ciphers = RC4, aNULL
    smtp_tls_protocols = !SSLv2,!SSLv3
    smtp_tls_security_level = may
    smtpd_client_message_rate_limit = 100
    smtpd_client_restrictions = check_client_access proxy:mysql:/etc/postfix/mysql-virtual_client.cf, permit_inet_interfaces, permit_mynetworks, permit_sasl_authenticated, reject_rbl_client zen.spamhaus.org, reject_unauth_pipelining , permit
    smtpd_data_restrictions = permit_mynetworks, reject_unauth_pipelining, reject_multi_recipient_bounce, permit
    smtpd_etrn_restrictions = permit_mynetworks, reject
    smtpd_forbidden_commands = CONNECT,GET,POST,USER,PASS
    smtpd_helo_required = yes
    smtpd_helo_restrictions = permit_mynetworks, check_helo_access regexp:/etc/postfix/helo_access, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, check_helo_access regexp:/etc/postfix/blacklist_helo, , permit
    smtpd_recipient_restrictions = permit_mynetworks, reject_unknown_recipient_domain, reject_unlisted_recipient, check_recipient_access proxy:mysql:/etc/postfix/mysql-verify_recipients.cf, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unauth_destination, check_recipient_access proxy:mysql:/etc/postfix/mysql-virtual_recipient.cf, check_recipient_access mysql:/etc/postfix/mysql-virtual_policy_greylist.cf, check_policy_service unix:private/quota-status
    smtpd_reject_unlisted_sender = no
    smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_restriction_classes = greylisting
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql-virtual_sender_login_maps.cf
    smtpd_sender_restrictions = check_sender_access proxy:mysql:/etc/postfix/mysql-virtual_sender.cf, reject_authenticated_sender_login_mismatch, check_sender_access regexp:/etc/postfix/tag_as_originating.re, permit_mynetworks,reject_sender_login_mismatch,, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unlisted_sender, check_sender_access regexp:/etc/postfix/tag_as_foreign.re
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_exclude_ciphers = RC4, aNULL
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_mandatory_ciphers = medium
    smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
    smtpd_tls_protocols = !SSLv2,!SSLv3
    smtpd_tls_security_level = may
    smtpd_use_tls = yes
    tls_medium_cipherlist = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA
    tls_preempt_cipherlist = yes
    transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    unknown_local_recipient_reject_code = 550
    virtual_alias_domains = proxy:mysql:/etc/postfix/mysql-virtual_alias_domains.cf
    virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_gid_maps = proxy:mysql:/etc/postfix/mysql-virtual_gids.cf
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_transport = lmtp:unix:private/dovecot-lmtp
    virtual_uid_maps = proxy:mysql:/etc/postfix/mysql-virtual_uids.cf
    
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    I've never used sSMTP before, but a quick google search finds this page as the first hit which shows it's quite easy to configure if you don't like the current behavior: https://wiki.debian.org/sSMTP
     

Share This Page