Mailjet, Postfix, self-hosted madness :(

Discussion in 'Server Operation' started by mnomasana86, Apr 24, 2015.

  1. mnomasana86

    mnomasana86 New Member

    Hi there, I'm having a problem with postfix setup on my vps with mailjet as the relay server.
    So far, I can send emails from the vps and on command line to other users.
    I cant really figure out how to be able to receive mails to the domain i.e. to the test email addresses (mytest&trial @funvpss.com)
    I can send mails on command line from lets say root@funvpss.com to trial@funvpss.com but when I check under roundcube, the messages are not there.

    so, if I send an email using gmail to trial@funvpss.com I get this under maillog:

    Code:
    # tailf /var/log/maillog
    Apr 24 13:05:20 funvpss postfix/smtpd[4353]: connect from mail-ig0-f172.google.com[209.85.213.172]
    Apr 24 13:05:20 funvpss postfix/smtpd[4353]: setting up TLS connection from mail-ig0-f172.google.com[209.85.213.172]
    Apr 24 13:05:21 funvpss postfix/smtpd[4353]: Anonymous TLS connection established from mail-ig0-f172.google.com[209.85.213.172]: TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)
    Apr 24 13:05:21 funvpss postfix/trivial-rewrite[4360]: warning: do not list domain funvpss.com in BOTH mydestination and virtual_mailbox_domains
    Apr 24 13:05:21 funvpss postfix/smtpd[4353]: 276BA81875: client=mail-ig0-f172.google.com[209.85.213.172]
    Apr 24 13:05:21 funvpss postfix/cleanup[4365]: 276BA81875: message-id=<CAKNzzwLNH2Hq3SCNn+uuHcXLxEUdpU4bncao5z1HxZ6Q@mail.gmail.com>
    Apr 24 13:05:21 funvpss postfix/qmgr[3432]: 276BA81875: from=<funvpss@gmail.com>, size=2071, nrcpt=1 (queue active)
    Apr 24 13:05:21 funvpss postfix/trivial-rewrite[4360]: warning: do not list domain funvpss.com in BOTH mydestination and virtual_mailbox_domains
    Apr 24 13:05:21 funvpss postfix/smtpd[4353]: disconnect from mail-ig0-f172.google.com[209.85.213.172]
    Apr 24 13:05:21 funvpss postfix/local[4366]: 276BA81875: to=<trial@funvpss.com>, relay=local, delay=0.19, delays=0.14/0.01/0/0.04, dsn=4.1.1, status=SOFTBOUNCE (unknown user: "trial")
    
    
    Using command line to gmail:
    Code:
    Apr 24 13:06:42 funvpss postfix/pickup[3431]: 78C7881878: uid=0 from=<trial@funvpss.com>
    Apr 24 13:06:42 funvpss postfix/cleanup[4365]: 78C7881878: message-id=<20150424110642.78C7881878@funvpss.com>
    Apr 24 13:06:42 funvpss postfix/qmgr[3432]: 78C7881878: from=<trial@funvpss.com>, size=316, nrcpt=1 (queue active)
    Apr 24 13:06:42 funvpss postfix/qmgr[3432]: 78C7881878: from=<trial@funvpss.com>, size=316, nrcpt=1 (queue active)
    Apr 24 13:06:43 funvpss postfix/smtp[4458]: 78C7881878: to=<funvpss@gmail.com>, relay=in-v3.mailjet.com[5.196.43.129]:587, delay=1.2, delays=0.09/0.1/0.81/0.16, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 05D751B60ED5)
    Apr 24 13:06:43 funvpss postfix/qmgr[3432]: 78C7881878: removed
    
    Code:
    # /etc/postfix/main.cf
    
    # postfix config file
    # uncomment for debugging if needed
    soft_bounce=yes
    # postfix main
    mail_owner = postfix
    setgid_group = postdrop
    delay_warning_time = 4
    # postfix paths
    html_directory = no
    command_directory = /usr/sbin
    daemon_directory = /usr/libexec/postfix
    queue_directory = /var/spool/postfix
    sendmail_path = /usr/sbin/sendmail.postfix
    newaliases_path = /usr/bin/newaliases.postfix
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    # network settings
    inet_interfaces = all
    mydomain = funvpss.com
    myhostname = funvpss.com
    mynetworks = $config_directory/mynetworks
    mydestination = $myhostname, localhost.$mydomain, localhost
    relay_domains = proxy:mysql:/etc/postfix/mysql-relay_domains_maps.cf
    # mail delivery
    recipient_delimiter = +
    # mappings
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    transport_maps = hash:/etc/postfix/transport
    #local_recipient_maps =
    local_recipient_maps = $alias_maps $virtual_mailbox_maps
    #local_transport = virtual
    # virtual setup
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf,
      regexp:/etc/postfix/virtual_regexp
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains_maps.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_maps.cf
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_minimum_uid = 101
    virtual_uid_maps = static:101
    virtual_gid_maps = static:12
    virtual_transport = dovecot
    dovecot_destination_recipient_limit = 1
    # debugging
    debug_peer_level = 2
    debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
      xxgdb $daemon_directory/$process_name $process_id & sleep 5
    # authentication
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_local_domain = $myhostname
    broken_sasl_auth_clients = yes
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    # tls config
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtpd_tls_security_level = may
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
    # Change mail.example.com.* to your host name
    smtpd_tls_key_file = /etc/pki/tls/private/funvpss.com.key
    smtpd_tls_cert_file = /etc/pki/tls/certs/funvpss.com.crt
    smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
    smtpd_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
    # rules restrictions
    smtpd_client_restrictions =
    smtpd_helo_restrictions =
    smtpd_sender_restrictions =
    smtpd_recipient_restrictions = permit_sasl_authenticated,
      permit_mynetworks,
      reject_unauth_destination,
      reject_non_fqdn_sender,
      reject_non_fqdn_recipient,
      reject_unknown_recipient_domain
    # uncomment for realtime black list checks
    # ,reject_rbl_client zen.spamhaus.org
    # ,reject_rbl_client bl.spamcop.net
    # ,reject_rbl_client dnsbl.sorbs.net
    smtpd_helo_required = yes
    unknown_local_recipient_reject_code = 550
    disable_vrfy_command = yes
    smtpd_data_restrictions = reject_unauth_pipelining
    # Other options
    # email size limit ~20Meg
    message_size_limit = 102400000
    mailbox_size_limit = 2048000000
    #mailbox_size_limit = 0
    # mailjet
    relayhost = [in-v3.mailjet.com]:587
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_tls_security_level = encrypt
    
    here are the files in the main.conf:

    Code:
    # cat /etc/postfix/mysql-relay_domains_maps.cf
    hosts = localhost
    user = postfix
    password = password
    dbname = postfix
    query = SELECT domain FROM domain WHERE domain='%s' and backupmx = '1'
    
    Code:
    # cat sasl_passwd
    in-v3.mailjet.com 7...:...
    

    Code:
    mysql> select username, password,name,maildir,quota,local_part,domain from mailbox;
    +-----------------------------+---------------------------------------------+------+------------------------------+-------+------------+------------------+
    | username  | password  | name | maildir  | quota | local_part | domain  |
    +-----------------------------+---------------------------------------------+------+------------------------------+-------+------------+------------------+
    | trial@funvpss.com  | {PLAIN-MD5}abc... |  | funvpss.com/trial/  |  0 | trial  | funvpss.com |
    | mytest@funvpss.com  | {PLAIN-MD5}abc... |  | funvpss.com/mytest/  |  0 | mytest  | funvpss.com |
    +-----------------------------+---------------------------------------------+------+------------------------------+-------+------------+------------------+
    
    mysql> select * from domain;
    +------------------+-------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+
    | domain  | description | aliases | mailboxes | maxquota | quota | transport | backupmx | created  | modified  | active |
    +------------------+-------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+
    | funvpss.com |  |  0 |  0 |  0 |  0 |  |  0 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |  1 |
    +------------------+-------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+
    1 row in set (0.00 sec)
    
    **only listed tables' content which I thought relevant
    
    My DNS Zone file:
    Code:
    ; Domain: funvpss.com
    ; SOA Record
    funvpss.com.   3600   IN   SOA   ns75.domaincontrol.com.   dns.jomax.net (
             2015042406
             28800
             7200
             604800
             600
             )
    
    ; A Records
    @   1800   IN   A   85.xxx.xxx.xxx
    
    ; CNAME Records
    ftp   3600   IN   CNAME   @
    mail   600   IN   CNAME   @
    www   3600   IN   CNAME   @
    
    ; MX Records
    @   600   IN   MX   0   mail.funvpss.com
    
    ; TXT Records
    @   600   IN   TXT   "v=spf1 mx include:spf.mailjet.com ~all"
    mailjet._domainkey   600   IN   TXT   "k=rsa; p=3Y+hvERDocGfMA0GCS..
    
    ; SRV Records
    _sip._tls.@   1800   IN   SRV   100   1   443   sipdir.online.lync.com
    _sipfederationtls._tcp.@   1800   IN   SRV   100   1   5061   sipfed.online.lync.com
    
    ; NS Records
    @   3600   IN   NS   ns75.domaincontrol.com
    @   3600   IN   NS   ns76.domaincontrol.com
    
    
    I know, it's too long but I just wanted to make sure that all the relevant files are here :D. Thanks for your help in advance
     

Share This Page