Dedicated Mail & Web (nginx, roundcube)

Discussion in 'Installation/Configuration' started by mmdollar, Aug 25, 2016.

  1. mmdollar

    mmdollar New Member

    Hello everyone I have a problem with setting up 2 Debian 8 Jessie servers (one for the websites and all web applications + mysql and another one only for a mail server) I am using nginx on the web server. I have followed this guilde for multiserver setup, this guilde and this one to install roundcube (added backport) and I added the nginx directives:

    Code:
    client_max_body_size 100M;
    
    location /roundcube {
             root /var/lib/;
             index index.php index.html index.htm;
             location ~ (.+\.php)$ {
                        try_files $uri =404;
                        include /etc/nginx/fastcgi_params;
                        # To access SquirrelMail, the default user (like www-data on Debian/Ubuntu) must be used
                        #fastcgi_pass 127.0.0.1:9000;
                        fastcgi_pass unix:/var/run/php5-fpm.sock;
                        fastcgi_index index.php;
                        fastcgi_intercept_errors on;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        fastcgi_buffer_size 128k;
                        fastcgi_buffers 256 4k;
                        fastcgi_busy_buffers_size 256k;
                        fastcgi_temp_file_write_size 256k;
             }
             location ~* /.svn/ {
                         deny all;
             }
             location ~* /README|INSTALL|LICENSE|SQL|bin|CHANGELOG$ {
                         deny all;
             }
    }
    location /webmail {
             rewrite ^ /roundcube last;
    }
    When I try to access server.example.com/roundcube I get 403 Forbidden

    Thanks in advance for the help!
     
    Last edited: Aug 25, 2016
  2. mmdollar

    mmdollar New Member

    Ok, so I managed to fix it and now I can see https://mysite.com/roundcube .My error was that I pointed to /var/lib/roundcube where I should had pointed it to /usr/share/roundcube . But now I have another problem, when I enter my [email protected] and password at roundcube nothing happens. I checked my mail server error logs and here there are:
    Mail-Error:
    Code:
    Aug 27 19:30:02 venera dovecot: master: Error: service(auth): command startup failed, throttling for 60 secs
    Aug 27 19:30:02 venera postfix/smtpd[32142]: fatal: no SASL authentication mechanisms
    Aug 27 19:35:01 venera dovecot: auth: Fatal: Unknown database driver 'mysql'
    Aug 27 19:35:01 venera dovecot: master: Error: service(auth): command startup failed, throttling for 2 secs
    Aug 27 19:35:03 venera postfix/smtpd[401]: fatal: no SASL authentication mechanisms
    Aug 27 19:40:01 venera postfix/smtpd[946]: fatal: no SASL authentication mechanisms
    Mail-Warn:
    Code:
    Aug 27 19:55:03 venera postfix/master[1377]: warning: process /usr/lib/postfix/smtpd pid 1468 exit status 1
    Aug 27 19:55:03 venera postfix/master[1377]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
    Aug 27 19:55:38 venera postfix/smtpd[1510]: warning: SASL: Connect to private/auth failed: Connection refused
    Aug 27 19:55:38 venera postfix/smtpd[1510]: fatal: no SASL authentication mechanisms
    Aug 27 19:55:39 venera amavis[22731]: (22731-03) (!)GUSUiYi60HcF FWD from <[email protected]> -> <[email protected]>, 451 4.5.0 From MTA() during fwd-connect (No greeting, dt: 1.040 s): id=22731-03
    Aug 27 19:55:39 venera postfix/master[1377]: warning: process /usr/lib/postfix/smtpd pid 1510 exit status 1
    Aug 27 19:55:39 venera postfix/master[1377]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
    Mail General:
    Code:
    Aug 27 19:55:38 venera postfix/smtpd[1510]: connect from localhost[127.0.0.1]
    Aug 27 19:55:38 venera postfix/smtpd[1510]: warning: SASL: Connect to private/auth failed: Connection refused
    Aug 27 19:55:38 venera postfix/smtpd[1510]: fatal: no SASL authentication mechanisms
    Aug 27 19:55:39 venera amavis[22731]: (22731-03) (!)GUSUiYi60HcF FWD from <[email protected]> -> <[email protected]>, 451 4.5.0 From MTA() during fwd-connect (No greeting, dt: 1.040 s): id=22731-03
    Aug 27 19:55:39 venera postfix/master[1377]: warning: process /usr/lib/postfix/smtpd pid 1510 exit status 1
    Aug 27 19:55:39 venera postfix/master[1377]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
    Aug 27 19:55:39 venera amavis[22731]: (22731-03) Blocked MTA-BLOCKED {TempFailedInbound}, [127.0.0.1] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: GUSUiYi60HcF, Hits: 0, size: 707, 1469 ms
    Aug 27 19:55:39 venera postfix/smtp[1507]: BEE881C001E: to=<[email protected]>, orig_to=<amavis>, relay=127.0.0.1[127.0.0.1]:10024, delay=340649, delays=340647/0.03/0.01/1.5, dsn=4.5.0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451 4.5.0 id=22731-03 - Temporary MTA failure on relaying, From MTA() during fwd-connect (No greeting, dt: 1.040 s): id=22731-03 (in reply to end of DATA command))
    Here is what I am doing if I missed something to say, I am having 2 Servers the first one has: Web,MySQL,DNS1,FTP . The second server has: mailserver + DNS2 (slave) . Only the first server has web interface for ISP Config and I have made server2 to mirror server1 (Is that a problem since I have the mail server enabled on server2 but on server1 is not?). Also when I am at server2 - > monitor -> services I see that POP3-Server & IMAP-Server are offline (DNS and SMTP are online).
     
  3. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    Did you configure roundcube to use the 2nd server?
     
  4. mmdollar

    mmdollar New Member

    I am not really sure how to do that because my main.inc.php (in /etc/roundcube) file was not created when I installed it, I made the file and added the following lines:
    Code:
    $rcmail_config['default_host'] = 'localhost';
    
    // ----------------------------------
    // PLUGINS
    // ----------------------------------
    // List of active plugins (in plugins/ directory)
    //$rcmail_config['plugins'] = array();
    $rcmail_config['plugins'] = array("jqueryui", "ispconfig3_account", "ispconfig3_autoreply", "ispconfig3_pass", "ispconfig3_spam", "ispconfig3_fetchmail", "ispconfig3_filter");
    
    debian-db.php has:
    Code:
    <?php
    ##
    ## database access settings in php format
    ## automatically generated from /etc/dbconfig-common/roundcube.conf
    ## by /usr/sbin/dbconfig-generate-include
    ## Thu, 25 Aug 2016 17:32:35 +0300
    ##
    ## by default this file is managed via ucf, so you shouldn't have to
    ## worry about manual changes being silently discarded.  *however*,
    ## you'll probably also want to edit the configuration file mentioned
    ## above too.
    ##
    $dbuser='roundcube';
    $dbpass='mypassword';
    $basepath='';
    $dbname='roundcubemail';
    $dbserver='';
    $dbport='';
    $dbtype='mysql';
    
    debian-db-roundcube.php has:
    Code:
    <?php
    include_once("/etc/roundcube/debian-db.php");
    
    switch ($dbtype) {
    case "sqlite":
    case "sqlite3":
       $config['db_dsnw'] = "sqlite:///$basepath/$dbname?mode=0640";
       break;
    default:
       if ($dbport != '') $dbport=":$dbport";
       if ($dbserver == '') $dbserver="localhost";
       $config['db_dsnw'] = "$dbtype://$dbuser:$dbpass@$dbserver$dbport/$dbname";
       break;
    }
    ?>
    
    I am sorry, kinda new to this stuff.
     
  5. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You have to define the mail-server in config.inc.php from roundcube:
    $config['default_host'] = 'your mailserver';
    $config['smtp_server'] = 'your mailserver';
    $config['smtp_user'] = '%u';
    $config['smtp_pass'] = '%p';
     
  6. mmdollar

    mmdollar New Member

    I've added them but the problem is still the same and mail error log @ mail server shows only:
    Code:
    Aug 28 12:15:45 venera postfix/smtpd[4587]: fatal: no SASL authentication mechanisms
    Aug 28 12:20:02 venera postfix/smtpd[4670]: fatal: no SASL authentication mechanisms
    Aug 28 12:25:01 venera postfix/smtpd[4777]: fatal: no SASL authentication mechanisms
    Aug 28 12:30:01 venera postfix/smtpd[4896]: fatal: no SASL authentication mechanisms
    Aug 28 12:35:01 venera postfix/smtpd[5004]: fatal: no SASL authentication mechanisms
    Aug 28 12:40:01 venera postfix/smtpd[5137]: fatal: no SASL authentication mechanisms
    Aug 28 12:45:01 venera postfix/smtpd[5248]: fatal: no SASL authentication mechanisms
    Aug 28 12:50:01 venera postfix/smtpd[5356]: fatal: no SASL authentication mechanisms
    When I access the web interface of roundcube I cannot see any error messages or images it looks like this:
    [​IMG]
    Isnt it a problem that my imap and pop3 server @ mailserver are offline? What should I do to start them up? Also I have another question I did MX record mail.mydomain to my IP but I do not have a A record mail.domain pointed to my IP.
     
  7. Jesse Norell

    Jesse Norell Active Member

  8. mmdollar

    mmdollar New Member

    I preinstalled dovecot and postfix on the mail server and updated ISPConfig but again I have a similar problem I googled some stuff and it seems I have problem with my ssl cert files in postfix and I kinda have no idea how to fix it.
    output of dovecot -n:
    Code:
    # 2.2.13: /etc/dovecot/dovecot.conf
    # OS: Linux 3.16.0-4-686-pae i686 Debian 8.5
    auth_mechanisms = plain login
    disable_plaintext_auth = no
    listen = *,[::]
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    mail_privileged_group = vmail
    passdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    plugin {
      quota = dict:user::file:/var/vmail/%d/%n/.quotausage
      sieve = /var/vmail/%d/%n/.sieve
    }
    protocols = imap pop3
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        group = postfix
        mode = 0660
        user = postfix
      }
      unix_listener auth-userdb {
        group = vmail
        mode = 0600
        user = vmail
      }
      user = root
    }
    service imap-login {
      client_limit = 1000
      process_limit = 500
    }
    ssl_cert = </etc/postfix/smtpd.cert
    ssl_key = </etc/postfix/smtpd.key
    ssl_protocols = !SSLv2 !SSLv3
    userdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    protocol imap {
      mail_plugins = quota imap_quota
    }
    protocol pop3 {
      mail_plugins = quota
      pop3_uidl_format = %08Xu%08Xv
    }
    protocol lda {
      mail_plugins = sieve quota
    }
    output of postconf -n:
    Code:
    alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
    append_dot_mydomain = no
    biff = no
    body_checks = regexp:/etc/postfix/body_checks
    broken_sasl_auth_clients = yes
    config_directory = /etc/postfix
    content_filter = amavis:[127.0.0.1]:10024
    dovecot_destination_recipient_limit = 1
    header_checks = regexp:/etc/postfix/header_checks
    html_directory = /usr/share/doc/postfix/html
    inet_interfaces = all
    inet_protocols = all
    mailbox_command = procmail -a "$EXTENSION"
    mailbox_size_limit = 0
    maildrop_destination_concurrency_limit = 1
    maildrop_destination_recipient_limit = 1
    mime_header_checks = regexp:/etc/postfix/mime_header_checks
    mydestination = mail.domain, localhost.domain, , localhost
    myhostname = mail.domain
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    myorigin = /etc/mailname
    nested_header_checks = regexp:/etc/postfix/nested_header_checks
    owner_request_special = no
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks
    readme_directory = /usr/share/doc/postfix
    receive_override_options = no_address_mappings
    recipient_delimiter = +
    relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
    relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
    relayhost =
    smtp_tls_protocols = !SSLv2,!SSLv3
    smtp_tls_security_level = may
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    smtpd_client_message_rate_limit = 100
    smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf
    smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
    smtpd_tls_protocols = !SSLv2,!SSLv3
    smtpd_tls_security_level = may
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtpd_use_tls = yes
    transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    virtual_alias_domains =
    virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_gid_maps = static:5000
    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 = dovecot
    virtual_uid_maps = static:5000
    When I use openssl rsa -in /etc/ssl/private/postfix.pem -check -noout &
    openssl x509 -in /etc/ssl/certs/postfix.pem -text -noout

    I get:
    Code:
    Error opening Private Key /etc/ssl/private/postfix.pem
    3073459900:error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen('/etc/ssl/private/postfix.pem','r')
    3073459900:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400:
    unable to load Private Key
    Code:
    Error opening Certificate /etc/ssl/certs/postfix.pem
    3073939132:error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen('/etc/ssl/certs/postfix.pem','r')
    3073939132:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400:
    unable to load certificate
    System Log:
    Code:
    Sep 1 15:25:01 mail postfix/smtpd[21866]: warning: cannot get RSA certificate from file /etc/postfix/smtpd.cert: disabling TLS support
    Sep 1 15:25:01 mail postfix/smtpd[21866]: warning: TLS library problem: error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen('/etc/postfix/smtpd.cert','r'):
    Sep 1 15:25:01 mail postfix/smtpd[21866]: warning: TLS library problem: error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400:
    Sep 1 15:25:01 mail postfix/smtpd[21866]: warning: TLS library problem: error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system lib:ssl_rsa.c:687:
    Sep 1 15:25:01 mail postfix/smtpd[21866]: connect from localhost[::1]
    Sep 1 15:25:01 mail postfix/smtpd[21866]: warning: SASL: Connect to private/auth failed: No such file or directory
    Sep 1 15:25:01 mail postfix/smtpd[21866]: fatal: no SASL authentication mechanisms
    Mail-Error:
    Code:
    Sep 1 14:50:02 mail postfix/sendmail[15292]: fatal: open /etc/postfix/main.cf: No such file or directory
    Sep 1 15:10:01 mail dovecot: pop3-login: Fatal: Couldn't parse private ssl_key: error:0906D06C:PEM routines:PEM_read_bio:no start line: Expecting: ANY PRIVATE KEY
    Sep 1 15:10:01 mail dovecot: master: Error: service(pop3-login): command startup failed, throttling for 2 secs
    Sep 1 15:10:01 mail dovecot: imap-login: Fatal: Couldn't parse private ssl_key: error:0906D06C:PEM routines:PEM_read_bio:no start line: Expecting: ANY PRIVATE KEY
    Sep 1 15:10:01 mail dovecot: master: Error: service(imap-login): command startup failed, throttling for 2 secs
    Sep 1 15:12:21 mail dovecot: config: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 7: ssl_cert: Can't open file /etc/postfix/smtpd.cert: No such file or directory
    Sep 1 15:12:21 mail dovecot: master: Error: service(config): command startup failed, throttling for 2 secs
    Sep 1 15:15:01 mail postfix/smtpd[21630]: fatal: no SASL authentication mechanisms
    Sep 1 15:20:01 mail postfix/smtpd[21753]: fatal: no SASL authentication mechanisms
    Update:
    I have managed to fix it by going to /etc/postfix and entering:
    Code:
    openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509
    But still I cannot login to my mail user.
    service dovecot status:
    Code:
    dovecot.service - Dovecot IMAP/POP3 email server
       Loaded: loaded (/lib/systemd/system/dovecot.service; enabled)
       Active: active (running) since Thu 2016-09-01 19:17:53 EEST; 29min ago
    Main PID: 27417 (dovecot)
       CGroup: /system.slice/dovecot.service
               ├─27417 /usr/sbin/dovecot -F
               ├─27418 dovecot/anvil
               ├─27419 dovecot/log
               └─28077 dovecot/config
    
    Sep 01 19:17:53 mail.domain dovecot[27417]: master: Dovecot v2.2.13 starting up for imap, pop3 (core dumps disabled)
    Sep 01 19:20:01 mail.domain dovecot[27419]: imap-login: Disconnected (disconnected before auth was ready, waited 0 secs): user=<>, rip=::1, lip=::1, secured, session=<chb1lXQ7kAAAAAAAAAAAAAAAAAAAAAAB>
    Sep 01 19:20:01 mail.domain dovecot[27419]: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=::1, lip=::1, secured, session=<Jkr2lXQ7BAAAAAAAAAAAAAAAAAAAAAAB>
    Sep 01 19:25:02 mail.domain dovecot[27419]: imap-login: Disconnected (disconnected before auth was ready, waited 0 secs): user=<>, rip=::1, lip=::1, secured, session=<yMXep3Q7nQAAAAAAAAAAAAAAAAAAAAAB>
    Sep 01 19:25:02 mail.domain dovecot[27419]: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=::1, lip=::1, secured, session=<l/Lfp3Q7EQAAAAAAAAAAAAAAAAAAAAAB>
    Sep 01 19:30:01 mail.domain dovecot[27419]: imap-login: Disconnected (disconnected before auth was ready, waited 0 secs): user=<>, rip=::1, lip=::1, secured, session=<eJ64uXQ7rAAAAAAAAAAAAAAAAAAAAAAB>
    Sep 01 19:30:01 mail.domain dovecot[27419]: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=::1, lip=::1, secured, session=<1N+5uXQ7IAAAAAAAAAAAAAAAAAAAAAAB>
    Sep 01 19:35:02 mail.domain dovecot[27419]: imap-login: Disconnected (disconnected before auth was ready, waited 0 secs): user=<>, rip=::1, lip=::1, secured, session=<u0Siy3Q7uQAAAAAAAAAAAAAAAAAAAAAB>
     
    Last edited: Sep 1, 2016
  9. mmdollar

    mmdollar New Member

    I've managed to login to my email now, I needed to reinstall roundcube and change the port to 465 in the config. I can receive emails but I cannot send them (Request timeout).
     
  10. Jesse Norell

    Jesse Norell Active Member

    Make sure submission service is enabled in /etc/postfix/master.cf and try port 587.
     
    mmdollar likes this.
  11. mmdollar

    mmdollar New Member

    Now when I try to send a message I am getting the error:
    Code:
    SMTP Error (-1): Connection to server failed.
    My postfix master file:
    Code:
    # Postfix master process configuration file.  For details on the format
    # of the file, see the master(5) manual page (command: "man 5 master" or
    # on-line: http://www.postfix.org/master.5.html).
    #
    # Do not forget to execute "postfix reload" after editing this file.
    #
    # ==========================================================================
    # service type  private unpriv  chroot  wakeup  maxproc command + args
    #               (yes)   (yes)   (yes)   (never) (100)
    # ==========================================================================
    smtp      inet  n       -       -       -       -       smtpd
    #smtp      inet  n       -       -       -       1       postscreen
    #smtpd     pass  -       -       -       -       -       smtpd
    #dnsblog   unix  -       -       -       -       0       dnsblog
    #tlsproxy  unix  -       -       -       -       0       tlsproxy
    submission inet n       -       -       -       -       smtpd
      -o syslog_name=postfix/submission
      -o smtpd_tls_security_level=encrypt
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #  -o smtpd_reject_unlisted_recipient=no
    #  -o smtpd_client_restrictions=$mua_client_restrictions
    #  -o smtpd_helo_restrictions=$mua_helo_restrictions
    #  -o smtpd_sender_restrictions=$mua_sender_restrictions
    #  -o smtpd_recipient_restrictions=
    #  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
    #  -o milter_macro_daemon_name=ORIGINATING
    smtps     inet  n       -       -       -       -       smtpd
      -o syslog_name=postfix/smtps
      -o smtpd_tls_wrappermode=yes
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #  -o smtpd_reject_unlisted_recipient=no
    #  -o smtpd_client_restrictions=$mua_client_restrictions
    #  -o smtpd_helo_restrictions=$mua_helo_restrictions
    #  -o smtpd_sender_restrictions=$mua_sender_restrictions
    #  -o smtpd_recipient_restrictions=
    #  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
    #  -o milter_macro_daemon_name=ORIGINATING
    #628       inet  n       -       -       -       -       qmqpd
    pickup    unix  n       -       -       60      1       pickup
    cleanup   unix  n       -       -       -       0       cleanup
    qmgr      unix  n       -       n       300     1       qmgr
    #qmgr     unix  n       -       n       300     1       oqmgr
    tlsmgr    unix  -       -       -       1000?   1       tlsmgr
    rewrite   unix  -       -       -       -       -       trivial-rewrite
    bounce    unix  -       -       -       -       0       bounce
    defer     unix  -       -       -       -       0       bounce
    trace     unix  -       -       -       -       0       bounce
    verify    unix  -       -       -       -       1       verify
    flush     unix  n       -       -       1000?   0       flush
    proxymap  unix  -       -       n       -       -       proxymap
    proxywrite unix -       -       n       -       1       proxymap
    smtp      unix  -       -       -       -       -       smtp
    relay     unix  -       -       -       -       -       smtp
    #       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
    showq     unix  n       -       -       -       -       showq
    error     unix  -       -       -       -       -       error
    retry     unix  -       -       -       -       -       error
    discard   unix  -       -       -       -       -       discard
    local     unix  -       n       n       -       -       local
    virtual   unix  -       n       n       -       -       virtual
    lmtp      unix  -       -       -       -       -       lmtp
    anvil     unix  -       -       -       -       1       anvil
    scache    unix  -       -       -       -       1       scache
    #
    # ====================================================================
    # Interfaces to non-Postfix software. Be sure to examine the manual
    # pages of the non-Postfix software to find out what options it wants.
    #
    # Many of the following services use the Postfix pipe(8) delivery
    # agent.  See the pipe(8) man page for information about ${recipient}
    # and other message envelope options.
    # ====================================================================
    #
    # maildrop. See the Postfix MAILDROP_README file for details.
    # Also specify in main.cf: maildrop_destination_recipient_limit=1
    #
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/bin/maildrop -d vmail ${extension} ${recipient} ${user} ${nexthop} ${sender}
    #
    # ====================================================================
    #
    # Recent Cyrus versions can use the existing "lmtp" master.cf entry.
    #
    # Recent Cyrus versions can use the existing "lmtp" master.cf entry.
    #
    # Specify in cyrus.conf:
    #   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
    #
    # Specify in main.cf one or more of the following:
    #  mailbox_transport = lmtp:inet:localhost
    #  virtual_transport = lmtp:inet:localhost
    #
    # ====================================================================
    #
    # Cyrus 2.1.5 (Amos Gouaux)
    # Also specify in main.cf: cyrus_destination_recipient_limit=1
    #
    #cyrus     unix  -       n       n       -       -       pipe
    #  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
    #
    # ====================================================================
    # Old example of delivery via Cyrus.
    #
    #old-cyrus unix  -       n       n       -       -       pipe
    #  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
    #
    # ====================================================================
    #
    # See the Postfix UUCP_README file for configuration details.
    #
    uucp      unix  -       n       n       -       -       pipe
      flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    #
    # Other external delivery methods.
    #
    ifmail    unix  -       n       n       -       -       pipe
      flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp     unix  -       n       n       -       -       pipe
      flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
    scalemail-backend unix  -       n       n       -       2       pipe
      flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    mailman   unix  -       n       n       -       -       pipe
      flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
      ${nexthop} ${user}
    
    dovecot   unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
    amavis unix - - - - 2 smtp
            -o smtp_data_done_timeout=1200
            -o smtp_send_xforward_command=yes
    
    127.0.0.1:10025 inet n - - - - smtpd
            -o content_filter=
            -o local_recipient_maps=
            -o relay_recipient_maps=
            -o smtpd_restriction_classes=
            -o smtpd_client_restrictions=
            -o smtpd_helo_restrictions=
            -o smtpd_sender_restrictions=
            -o smtpd_recipient_restrictions=permit_mynetworks,reject
            -o mynetworks=127.0.0.0/8
            -o strict_rfc821_envelopes=yes
            -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
    
    Error from mail server:
    Code:
    postfix/submission/smtpd[5124]: fatal: unexpected command-line argument: smtps
     
  12. mmdollar

    mmdollar New Member

    I've managed to fix it, it was white space before smtp in postfix, but now I still get the same error when sending email but now dovecot shows this:
    Code:
    mail.domain.com dovecot[544]: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=192.168.100.4, lip=192.168.100.5, mpid=3207, session=<1PXE3i88QADAqGQE>
    
    Update:
    I fixed it by adding ssl:// to default_host in roundcube config and tls:// on the smt_server
    Also added:
    Code:
    $config['smtp_auth_type'] = 'PLAIN';
    
    and this because I am using my own created certificate
    Code:
    $config['smtp_conn_options'] = array(
      'ssl'         => array(
         'verify_peer'      => false,
         'verify_peer_name' => false,
      ),
    );
    
    Now it says that the email was send but I am not receiving anything, this is from the warn log on the mail server:
    Code:
    Sep 11 15:01:12 mail amavis[22981]: (22981-01) (!)opVo5a9xG7IK FWD from <[email protected]> -> <[email protected]>, BODY=7BIT 454 4.7.1 from MTA(smtp:[127.0.0.1]:10025): 454 4.7.1 <[email protected]>: Relay access denied
    Sep 11 15:01:13 mail amavis[22982]: (22982-01) (!)NfxZI2QWWE7N FWD from <[email protected]> -> <[email protected]>, BODY=7BIT 454 4.7.1 from MTA(smtp:[127.0.0.1]:10025): 454 4.7.1 <[email protected]>: Relay access denied
    Sep 11 15:01:13 mail amavis[22981]: (22981-02) (!)mjUVY620ClXz FWD from <[email protected]> -> <[email protected]>, BODY=7BIT 454 4.7.1 from MTA(smtp:[127.0.0.1]:10025): 454 4.7.1 <[email protected]>: Relay access denied
    Did I missconfigured something with the networks?
    my web server local ip is: 192.168.100.4 and my mail is: 192.168.100.5 (both of them use the same external IP), do I need to change the places where is says "127.0.0.0/8" to fit my network?
     
    Last edited: Sep 12, 2016
  13. Jesse Norell

    Jesse Norell Active Member

    That sounds like the port 10025 smtpd isn't allowing amavis to pass mail through - what you pasted for
    127.0.0.1:10025 looks good (it has mynetwork set, and permit_mynetworks should allow amavis to send) .. try checking that line in master.cf and make sure there's not a leading whitespace there, too.
     
  14. mmdollar

    mmdollar New Member

    Ok so I preinstalled the mail server and now everything works fine, I can send and receive emails I think one of the problems was that I used the mirror option on the mail server(mail server mirrors my web server/dns server), because I wanted to run a slave dns there too. Thanks for all the help!

    Any idea why my when I send an email to gmail it always goes to spam (unless I say it is not)?
     
    Last edited: Sep 16, 2016
  15. Jesse Norell

    Jesse Norell Active Member

    mmdollar likes this.

Share This Page