Link to home
Start Free TrialLog in
Avatar of Ashraf Hassanein
Ashraf Hassanein

asked on

Postfix+Dovecot+Squirell mail can not send or recieve

I am new to postfix , I have compiled postfix from scratch to include the pgsql, and tls driver, and I have installed the dovecot and squirrel packages and configured them as far as possible on Centos 6.3 based server, my traget is to be to send and receive emails from my domain using squirell we interface, but I am getting the following:
On regular basis as long as I am logged in the squirell mail I keep having:

    Dec 15 19:23:36 myserver dovecot: auth: pgsql: Connected to postfix
    Dec 15 19:23:36 myserver dovecot: imap-login: Login: user=<me@mydomain.nl>,method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=30914, TLS
    Dec 15 19:23:36 myserver dovecot: imap(me@mydomain.nl): Connection closed bytes=46/364

And when trying to send a message I am getting:

    warning: request to update table btree:/var/spool/postfix/smtpd_tls_session_cache in non-postfi directory /var/spool/postfix
    Dec 15 18:33:37 myserver postfix/tlsmgr[30573]: warning: redirecting the request to postfix-owned data_directory /var/lib/postfix
    Dec 15 18:33:37 myserver postfix/smtpd[30571]: connect from localhost.localdomain[127.0.0.1]
    Dec 15 18:33:37 myserver postfix/smtpd[30571]: lost connection after UNKNOWN from localhost.localdomain[127.0.0.1]
    Dec 15 18:33:37 myserver postfix/smtpd[30571]: disconnect from localhost.localdomain[127.0.0.1]

So I can see that I have the following problems (Until now :-) ):<br>
     1- Not able to send an email for this UNKOWN issue.<br>
     2- Send password in plain and encrypted over TLS.<br>
     3-  Issue in updating the table btree.<br>
     4- Issue in redirecting the request to postfx-owned data directory<br>
I am not sure if they are all related, and if it is ok to post them in one post.<br>
My configurations are:<br>
Main.cf:

    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    html_directory = no
    smtpd_recipient_restrictions = permit_sasl_authenticated
    inet_interfaces = all
    inet_protocols = all
    mail_owner = postfix
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mydestination = localhost mydomain.com
    myhostname = mydomain.com
    mynetworks = <My public IP>/32, $myhostname
    newaliases_path = /usr/bin/newaliases.postfix
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.10.2/README_FILES
    sample_directory = no
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtpd_banner = $myhostname ESMTP $mail_name
    smtpd_recipient_restrictions = permit_mynetworks,  permit_sasl_authenticated,
    reject_unauth_destination, permit
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_exceptions_networks = $mynetworks
    smtpd_sasl_path = private/auth
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_type = dovecot
    smtpd_sender_restrictions = permit_mynetworks,  permit_sasl_authenticated,
    reject_unauth_destination, permit
    smtpd_tls_auth_only = no
    smtpd_tls_cert_file = /etc/ssl/mailserver/myserver_com.pem
    smtpd_tls_key_file = /etc/ssl/mailserver/myserver_com.key
    smtpd_tls_loglevel = 0
    smtpd_tls_received_header = no
    smtpd_tls_session_cache_database = btree:/var/spool/postfix/smtpd_tls_session_cache
    smtpd_use_tls = yes
    tls_random_source = dev:/dev/urandom
    unknown_local_recipient_reject_code = 550
    virtual_alias_maps = pgsql:$config_directory/pgsql_virtual_alias_maps.cf
    virtual_gid_maps = static:500
    virtual_mailbox_base = /var/vmail
    virtual_mailbox_domains = proxy:pgsql:$config_directory/pgsql_virtual_domains_maps.cf
    virtual_mailbox_maps = proxy:pgsql:$config_directory/pgsql_virtual_mailbox_maps.cf
    virtual_minimum_uid = 500
    virtual_transport = dovecot
    virtual_uid_maps = static:500
    #use amavisd as filter on port 10024
    content_filter=amavisfeed:[127.0.0.1]:10024

Master.cf:

    smtp      inet  n       -       n       -       -       smtpd
    submission inet n       -       n       -       -       smtpd
    smtps     inet  n       -       n       -       -       smtpd
    pickup    unix  n       -       n       60      1       pickup
    cleanup   unix  n       -       n       -       0       cleanup
    qmgr      unix  n       -       n       300     1       qmgr
    tlsmgr    unix  -       -       n       1000?   1       tlsmgr
    rewrite   unix  -       -       n       -       -       trivial-rewrite
    bounce    unix  -       -       n       -       0       bounce
    defer     unix  -       -       n       -       0       bounce
    trace     unix  -       -       n       -       0       bounce
    verify    unix  -       -       n       -       1       verify
    flush     unix  n       -       n       1000?   0       flush
    proxymap  unix  -       -       n       -       -       proxymap
    proxywrite unix -       -       n       -       1       proxymap
    smtp      unix  -       -       n       -       -       smtp
    relay     unix  -       -       n       -       -       smtp
    showq     unix  n       -       n       -       -       showq
    error     unix  -       -       n       -       -       error
    retry     unix  -       -       n       -       -       error
    discard   unix  -       -       n       -       -       discard
    local     unix  -       n       n       -       -       local
    virtual   unix  -       n       n       -       -       virtual
    lmtp      unix  -       -       n       -       -       lmtp
    anvil     unix  -       -       n       -       1       anvil
    scache    unix  -       -       n       -       1       scache
    dovecot unix - n n - - pipe flags=DRhu user=vmail:mail argv=/usr/libexec/dovecot/deliver
    -d $(recipient)
    amavisfeed unix    -       -       n        -      2     lmtp
    -o lmtp_data_done_timeout=1200
    -o lmtp_send_xforward_command=yes
    -o lmtp_tls_note_starttls_offer=no
    127.0.0.1:10025 inet n    -       n       -       -     smtpd
    -o content_filter=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_data_restrictions=reject_unauth_pipelining
    -o smtpd_end_of_data_restrictions=
    -o smtpd_restriction_classes=
    -o mynetworks=127.0.0.0/8
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
    -o local_header_rewrite_clients=
    -o smtpd_milters=
    -o local_recipient_maps=
    -o relay_recipient_maps=

 pgsql_virtual_alias_maps.cf

    user = postfix
    password = <Password>
    hosts = localhost
    dbname = postfix
    table = alias
    select_field = goto
    where_field = address
    additional_conditions = and active = '1'
    #query = SELECT goto FROM alias WHERE address='%s' AND active = '1'

pgsql_virtual_domains_maps.cf

    user = postfix
    password = <Password>
    hosts = localhost
    dbname = postfix
    table = domain
    select_field = domain
    where_field = domain
    additional_conditions = and backupmx = '0' and active = '1'
    #query = SELECT domain FROM domain WHERE domain='%s' AND backupmx = '0' AND active = '1'

pgsql_virtual_mailbox_limit_maps.cf

    user = postfix
    password = <Password>
    hosts = localhost
    dbname = postfix
    table = mailbox
    select_field = quota
    where_field = username
    additional_conditions = and active = '1'
    #query = SELECT quota FROM mailbox WHERE username='%s' AND active = '1'

pgsql_virtual_mailbox_maps.cf

    user = postfix
    password = <Password>
    hosts = localhost
    dbname = postfix
    table = mailbox
    select_field = maildir
    where_field = username
    additional_conditions = and active = '1'
    #query = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'

Dovecot.conf

    # 2.0.9: /etc/dovecot/dovecot.conf
    # OS: Linux 2.6.18-028stab101.1 x86_64 CentOS release 6.3 (Final) reiserfs
    base_dir = /var/run/dovecot/
    disable_plaintext_auth = yes
    first_valid_uid = 500
    last_valid_uid = 500
    log_timestamp = "%d-%m-%y %H:%M:%S "
    mail_access_groups = mail
    mail_location = maildir:/home/vmail/%u
    mail_max_userip_connections = 100
    mail_privileged_group = mail
    mbox_write_locks = fcntl
    passdb {
    driver = pam
    }
    passdb {
    args = /etc/dovecot/dovecot-sql.conf
    driver = sql
    }
    protocols = pop3 imap
    protocol pop3 {
    pop3_uidl_format = %08Xu%08Xv
    pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
    }
    service auth-worker {
    user = vmail
    }
    service auth {
    unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
    }
    unix_listener auth-master {
    mode = 0666
    }
    user = $default_internal_user
    }
    service imap-login {
    executable = /usr/libexec/dovecot/imap-login
    inet_listener imap {
    address = *
    port = 143
    }
    inet_listener imaps {
    address = *
    port = 993
    }
    }
    service imap {
    executable = /usr/libexec/dovecot/imap
    }
    service pop3 {
    executable = /usr/libexec/dovecot/pop3
    }
    ssl_cert = </etc/ssl/mailserver/mail.mydomain.com.pem
    ssl_key = </etc/ssl/mailserver/mail.mydomain.com.key
    userdb {
    driver = passwd
    }
    userdb {
    args = /etc/dovecot/dovecot-sql.conf
    driver = sql
    }
    protocol lda {
    auth_socket_path = /var/run/dovecot/auth-master
    postmaster_address = postmaster@mydomain.com
    sendmail_path = /usr/lib/sendmail
    }
    protocol imap {
    imap_max_line_length = 64 k
    }

dovecot-sql.conf

    driver = pgsql
    connect = host=localhost dbname=postfix user=postfix password=<Password>
    password_query =  SELECT username as user, password, '/home/vmail/%n'||'@'||'%d' as userdb_home, 'maildir:/var/vmail/%n'||'@'||'%d' as userdb_mail, 500 as userdb_uid, 500 as userdb_gid FROM mailbox WHERE username = '%n'||'@'||'%d' AND active = '1'
    user_query = select '/home/vmail/%n'  as home, 'maildir:/home/vmail/'||'%n' as mail , 500 As uid , 500 as gid, 'dirsize:storage=' || quota AS quota from mailbox where username=' n'||'@'||'%d'
    # For using doveadm -A:
    iterate_query = SELECT username, domain FROM mailbox where username='%n'||'@'||'%d'

Can someone guide me please?
Avatar of skullnobrains
skullnobrains

i have not digged into other problems, but the warnings concerning file ownerships should be corrected by running "postfix set-permissions" as root

the UNKNOWN issue does not mean much. usually postfix would state after MAIL FROM or after RCPT TO or the likes so you can determine at what step of the smtp transactions things went wrong. in your case, nothing was transmitted so the last command is UNKNOWN

can you send mail without ssl/tls. did you compile with tls or ssl ? is your client using ssl or tls ? mixing both usually ends up not working properly
Avatar of Ashraf Hassanein

ASKER

Yes I comipled Postfix with ssl and tls, if you want please send me the command you want to check the tls.
I configured the squirrelmail to use TLS in config.pl
By the way I am using a self signed certificate for the email which is different than the certificate of the site which a verified one.
Any advie regarding this issue?
I will try the command postfix set-permissions an try again.
ASKER CERTIFIED SOLUTION
Avatar of skullnobrains
skullnobrains

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, I have configured the postfix and dovecot to use TLS, if I configured the squirrelmail to use open ports would that work?
TLS vs ssl is not a config option. it is a compile time option. you can compile it either against libssl or against libtls, both being mutually exclusive (that is as far as i know). on linux, you're most likely using tls. whatever the problem the squirrelmail log should provide the information you cannot find in postfix's log. if you don't need ssl, don't bother.

given the logs, i can tell that the tls negociation fails. i can't guarantee that nothing else will fail along the line if you solve the problem or skip ssl altogether. if your postfix config is correct, it will work. you need to try.

if your postfix setup is correct, you should be able to use port 25.
if you want to use a unix socket, you can clone the line containing port 25 and replace "25" with the path to the desired socket and "inet" with "unix" in your master.cf
Can you please tell me the location of the squirrlmail log? it is installed in /usr/lib/share/squirrelmail
no idea. this depends on your setup, and i do not know much about squirrelmail

assuming you installed it on apache with mod_php,
it is likely that errors are actually php errors that default to be sent to stderr and hence end up in apache's error-log

- squirrelmail may log it's own errors but that is unlikely
- it may raise php errors
- if so, your php.ini determines where these errors go (usually stdout)
- if they are logged to sdtout, apache usually sends them to it's error-log
- they can be just trashed by either of the above

if you can't find it, you can grep for words such as "cyrrus" or "smtp" or your user name recursively in /var/log
I ran postfix set-permissionsbut I still get the error in create (Image attached, it seems it does not like the file name .sent
However the dovecot created its mailbox in /home/vmail/usernma/.xxxxxx
create-error.jpg
I have searched the web, and they said to make sure that your postfix installation has tls or ssl run:
ldd /usr/libexec/postfix/smtpd
And here is my output and I can see that:
        linux-vdso.so.1 =>  (0x00007fff9aff1000)
        libssl.so.10 => /usr/lib64/libssl.so.10 (0x0000003997800000)
        libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x0000003996800000)
        libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x0000003992000000)
        libpcre.so.0 => /lib64/libpcre.so.0 (0x0000003997400000)
        libpq.so.5 => /usr/lib64/libpq.so.5 (0x0000003356a00000)
        libz.so.1 => /lib64/libz.so.1 (0x0000003990400000)
        libm.so.6 => /lib64/libm.so.6 (0x0000003990000000)
        libdb-4.7.so => /lib64/libdb-4.7.so (0x0000003991400000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003992400000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003991000000)
        libc.so.6 => /lib64/libc.so.6 (0x000000398f400000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x0000003996c00000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x0000003995400000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003993400000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x0000003994c00000)
        libdl.so.2 => /lib64/libdl.so.2 (0x000000398f000000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003991800000)
        libldap_r-2.4.so.2 => /lib64/libldap_r-2.4.so.2 (0x0000003356200000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x000000398f800000)
        /lib64/ld-linux-x86-64.so.2 (0x000000398ec00000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x0000003995800000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003995000000)
        libfreebl3.so => /lib64/libfreebl3.so (0x0000003991c00000)
        liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x0000003356e00000)
        libssl3.so => /usr/lib64/libssl3.so (0x0000003356600000)
        libsmime3.so => /usr/lib64/libsmime3.so (0x0000003994800000)
        libnss3.so => /usr/lib64/libnss3.so (0x0000003993800000)
        libnssutil3.so => /usr/lib64/libnssutil3.so (0x0000003993000000)
        libplds4.so => /lib64/libplds4.so (0x0000003994000000)
        libplc4.so => /lib64/libplc4.so (0x0000003993c00000)
        libnspr4.so => /lib64/libnspr4.so (0x0000003992c00000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003990c00000)
        librt.so.1 => /lib64/librt.so.1 (0x000000398fc00000)
And I can see libssl there so I assume that my installation support ssl, correct?
You were indeed correct the tls port is the port created the problem, however when I removed it I got the following:Dec 18 22:21:23 myserver postfix/lmtp[849]: 78106DEBAA: to=<myemail@yahoo.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=2, delays=0.16/0.06/0.05/1.8, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 4B08CDEBB0)
Dec 18 22:21:23 myserver postfix/qmgr[540]: 78106DEBAA: removed
Dec 18 22:21:23 myserver dovecot: imap-login: Login: user=<admin@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=854, secured
Dec 18 22:21:23 myserver dovecot: imap(admin@mydomain.com): Disconnected: Logged out bytes=33/365
Dec 18 22:21:26 myserver dovecot: imap-login: Login: user=<admin@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=856, secured
Dec 18 22:21:26 myserver dovecot: imap(admin@mydomain.com): Connection closed bytes=106/1355
Dec 18 22:21:53 myserver postfix/smtp[853]: connect to mta7.am0.yahoodns.net[63.250.192.45]:25: Connection timed out
Dec 18 22:22:00 myserver dovecot: imap-login: Login: user=<admin@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=860, secured
Dec 18 22:22:00 myserver dovecot: imap(admin@mydomain.com): Connection closed bytes=43/356
Dec 18 22:22:23 myserver postfix/smtp[853]: connect to mta6.am0.yahoodns.net[98.138.112.38]:25: Connection timed out
Dec 18 22:22:53 myserver postfix/smtp[853]: connect to mta5.am0.yahoodns.net[98.136.216.26]:25: Connection timed out
Dec 18 22:23:23 myserver postfix/smtp[853]: connect to mta6.am0.yahoodns.net[63.250.192.46]:25: Connection timed out
Dec 18 22:23:37 myserver postfix/smtpd[869]: connect from localhost.localdomain[127.0.0.1]
Dec 18 22:23:39 myserver postfix/trivial-rewrite[828]: warning: do not list domain mydomain.com in BOTH mydestination and virtual_mailbox_domains
Dec 18 22:23:39 myserver postfix/smtpd[869]: 8BA60DEBAA: client=localhost.localdomain[127.0.0.1], sasl_method=PLAIN, sasl_username=admin@mydomain.com
Dec 18 22:23:39 myserver postfix/cleanup[873]: 8BA60DEBAA: message-id=<138676f41fffc8e0d5965f0ecc1dea11.squirrel@www.mydomain.com>
Dec 18 22:23:39 myserver postfix/qmgr[540]: 8BA60DEBAA: from=<admin@mydomain.com>, size=742, nrcpt=1 (queue active)
Dec 18 22:23:39 myserver postfix/smtpd[869]: disconnect from localhost.localdomain[127.0.0.1]
Dec 18 22:23:39 myserver clamd[2027]: SelfCheck: Database status OK.
Dec 18 22:23:40 myserver postfix/smtpd[882]: connect from localhost.localdomain[127.0.0.1]
Dec 18 22:23:40 myserver postfix/trivial-rewrite[828]: warning: do not list domain mydomain.com in BOTH mydestination and virtual_mailbox_domains
Dec 18 22:23:40 myserver postfix/smtpd[882]: 7F54DDEBB5: client=localhost.localdomain[127.0.0.1]
Dec 18 22:23:40 myserver postfix/cleanup[873]: 7F54DDEBB5: message-id=<138676f41fffc8e0d5965f0ecc1dea11.squirrel@www.mydomain.com>
Dec 18 22:23:40 myserver postfix/qmgr[540]: 7F54DDEBB5: from=<admin@mydomain.com>, size=1186, nrcpt=1 (queue active)
Dec 18 22:23:40 myserver amavis[21345]: (21345-01) Passed CLEAN {RelayedOutbound}, MYNETS LOCAL [127.0.0.1]:47141 [81.68.69.22] <admin@mydomain.com> -> <myself@mycorporatre.com>, Queue-ID: 8BA60DEBAA, Message-ID: <138676f41fffc8e0d5965f0ecc1dea11.squirrel@www.mydomain.com>, mail_id: EY9HrTKSfdVV, Hits: -1, size: 742, queued_as: 7F54DDEBB5, 929 ms
Dec 18 22:23:40 myserver postfix/lmtp[876]: 8BA60DEBAA: to=<myself@mycorporatre.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=1, delays=0.1/0.01/0.04/0.9, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 7F54DDEBB5)
Dec 18 22:23:40 myserver postfix/qmgr[540]: 8BA60DEBAA: removed
Dec 18 22:23:41 myserver dovecot: imap-login: Login: user=<admin@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=884, secured
Dec 18 22:23:41 myserver dovecot: imap(admin@mydomain.com): Disconnected: Logged out bytes=33/365
Dec 18 22:23:44 myserver dovecot: imap-login: Login: user=<admin@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=886, secured
Dec 18 22:23:44 myserver dovecot: imap(admin@mydomain.com): Connection closed bytes=106/1355
Dec 18 22:23:53 myserver postfix/smtp[853]: connect to mta5.am0.yahoodns.net[98.138.112.38]:25: Connection timed out
Dec 18 22:23:53 myserver postfix/smtp[853]: 4B08CDEBB0: to=<myemail@yahoo.com>, relay=none, delay=150, delays=0.07/0.03/150/0, dsn=4.4.1, status=deferred (connect to mta5.am0.yahoodns.net[98.138.112.38]:25: Connection timed out)
Dec 18 22:24:13 myserver postfix/smtp[883]: connect to mail.mycorporatre.com[xxx.xxx.xxx.xxx]:25: Connection timed out
Dec 18 22:24:43 myserver postfix/smtp[883]: connect to mail2.mycorporatre.com[yyy.yyy.yyy.yyy]:25: Connection timed out
Dec 18 22:25:13 myserver postfix/smtp[883]: connect to mail3.mycorporatre.com[zzz.zzz.zzz.zzz]:25: Connection timed out
Dec 18 22:25:43  myserver postfix/smtp[883]: 7F54DDEBB5: to=<myself@mycorporatre.com>, relay=none, delay=123, delays=0.04/0.02/123/0, dsn=4.4.1, status=deferred (connect to mail3.mycorporatre.com[zzz.zzz.zzz.zzz] Connection timed out)
Dec 18 22:26:23  myserver postfix/smtpd[852]: timeout after END-OF-MESSAGE from localhost.localdomain[127.0.0.1]
Dec 18 22:26:59  myserver postfix/anvil[806]: statistics: max connection rate 5/60s for (smtp:127.0.0.1) at Dec 18 22:20:08
Dec 18 22:26:59  myserver postfix/anvil[806]: statistics: max connection count 2 for (smtp:127.0.0.1) at Dec 18 22:20:08
Dec 18 22:26:59  myserver postfix/anvil[806]: statistics: max cache size 1 at Dec 18 22:17:31
Dec 18 22:27:03  myserver dovecot: imap-login: Login: user=<admin@mydomain.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=906, secured
Dec 18 22:27:03  myserver dovecot: imap(admin@mydomain.com): Connection closed bytes=43/356
Dec 18 22:28:40  myserver postfix/smtpd[882]: timeout after END-OF-MESSAGE from localhost.localdomain[127.0.0.1]
Dec 18 22:28:40  myserver postfix/smtpd[882]: disconnect from localhost.localdomain[127.0.0.1]



What do you think?
I have checked my MX records and attached are the results, what do you think?
MX-record.jpg
Now I am trying to send a message back to myserver from yahoo and I am getting the following:
Dec 18 23:13:27 myserver amavis[21345]: (21345-02) Passed CLEAN {RelayedInbound}, [67.195.87.180]:34642 [81.68.69.22] <myself@yahoo.com> -> <admin@mydomain.com>, Queue-ID: 66D87DEBC0, Message-ID: <1387404805.74765.YahooMailNeo@web164003.mail.gq1.yahoo.com>, mail_id: mUo4gURrv_T9, Hits: -0.133, size: 4582, queued_as: 42F0CDEBC1, dkim_sd=s1024:yahoo.com, 601 ms
Dec 18 23:13:27 myserver postfix/lmtp[1324]: 66D87DEBC0: to=<admin@mydomain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.99, delays=0.37/0.01/0.01/0.6, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 42F0CDEBC1)
Dec 18 23:13:27 myserver postfix/qmgr[540]: 66D87DEBC0: removed
Dec 18 23:13:27 myserver postfix/local[1329]: 42F0CDEBC1: to=<admin@mydomain.com>, relay=local, delay=0.11, delays=0.01/0.05/0/0.05, dsn=5.1.1, status=bounced (unknown user: "admin")
Dec 18 23:13:27 myserver postfix/cleanup[1322]: 5F921DEBC0: message-id=<20131218221327.5F921DEBC0@mydomain.com>
Dec 18 23:13:27 myserver postfix/qmgr[540]: 5F921DEBC0: from=<>, size=6950, nrcpt=1 (queue active)
Dec 18 23:13:27 myserver postfix/bounce[1330]: 42F0CDEBC1: sender non-delivery notification: 5F921DEBC0
Dec 18 23:13:27 myserver postfix/qmgr[540]: 42F0CDEBC1: removed
Dec 18 23:13:57 myserver postfix/smtp[1332]: connect to mta5.am0.yahoodns.net[98.136.217.202]:25: Connection timed out
Sorry for too much replies can you please guide me?
One more point I have check for the user admin@mydomain.com and I got this output:

#postmap -q admin@mydomian.com pgsql:/etc/postfix/pgsql_virtual_mailbox_maps.cf
admin@mydomian.com/


So I can see the user is there.
I ran postfix set-permissionsbut I still get the error in create (Image attached, it seems it does not like the file name .sent

you can set the file names used for the sent mail in squirrelmail's config. apparently you are not allowed to use filenames that start with a dot. i see no reasonable reason why you would want to do so anyway. i'm not even sure the imap specifications allow this.
And I can see libssl there so I assume that my installation support ssl, correct?

yes. your problem is probably the self-signed certificate. there should be a way to instruct squirrelmail to ignore the cert validation. this feature is builtin the cyrus imap php extension which i assume squirrelmail uses.

the apache/squirrelmail log should display an explicit error
Dec 18 23:13:27 myserver postfix/local[1329]: 42F0CDEBC1: to=<admin@mydomain.com>, relay=local, delay=0.11, delays=0.01/0.05/0/0.05, dsn=5.1.1, status=bounced (unknown user: "admin")

everything seems ok, (including MXs and mail for your domain is allowed) except that the user does not exist

i'd need to see how you refer to the virtual users map in postfix's config
The Expert was helpful and the answe helped in send emails
i saw this warning i had missed previously by accident

Dec 18 22:23:40 myserver postfix/trivial-rewrite[828]: warning: do not list domain mydomain.com in BOTH mydestination and virtual_mailbox_domains

most likely, postfix checks for mydestination first and assumes the user is a local user of the machine. in this case, it will use aliases.map and not your postgres database to lookup the user.

this can be checked by raising the log level using debug_peer...something in your main.cf. postfix should log each map query with the name of the table, the query and the answer
but I have removed the name already from the main.cf and I do not have this warning any more in the log file, honestly I feel the problem is in dovecot-sql.conf, because even the commands:
       doveadm quota get -a user
       doveadm quota get -a user@mydomain.com
    Are not working as well, the problem I can not find much explanation for this config with postgres and my database structure, what do you think about this file?
virtual_mailbox_maps is used by the virtual delivery manager if the domain is listed in virtual_domains

given the fact that your last log shows  this line

Dec 18 23:13:27 myserver postfix/local[1329]: 42F0CDEBC1: to=<admin@mydomain.com>, relay=local, delay=0.11, delays=0.01/0.05/0/0.05, dsn=5.1.1, status=bounced (unknown user: "admin")

postfix is using the local delivery manager instead of vitual so you probably removed the long line (or should post a more recent log)

if the dovecot commands are not working, most likely there is also a problem in dovecot

also remind that increased logging gives more information