Page 47 of 51 FirstFirst ... 374546474849 ... LastLast
Results 461 to 470 of 506

Thread: Howto: set up a mail server in Ubuntu

  1. #461
    Join Date
    Mar 2013
    Beans
    3

    Re: Howto: set up a mail server in Ubuntu

    Try to use 127.0.0.1 for sql_hostname in smtp.conf
    Quote Originally Posted by dakong27 View Post
    Hi All--I followed Flurdy's guide for Ubuntu 12.04, though I have Ubuntu 12.10 64-bit. Everything works but I cannot send from a mail client or Squirrelmail. I've been tweaking and googling and tail-ing logs for a solid week and can't crack it, so I'm hoping you folks can help me out.

    My /etc/postfix/main.cf:

    # See /usr/share/postfix/main.cf.dist for a commented, more complete version


    # Debian specific: Specifying a file name will cause the first
    # line of that file to be used as the name. The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no

    # appending .domain is the MUA's job.
    append_dot_mydomain = no

    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h

    readme_directory = no

    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    #smtpd_use_tls=no
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.

    myhostname = mail.me.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = me.com
    mydestination = mail.me.com, me-main.Datian, localhost.Datian, localhost
    #mydestination =
    #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    relayhost =
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128,192.168.2.0/24
    mailbox_command =
    mailbox_size_limit = 30000000
    recipient_delimiter = +
    inet_interfaces = all

    masquerade_domains = mail.me.com
    local_recipient_maps =

    # how long if undelivered before sending warning update to sender
    delay_warning_time = 4h
    # will it be a permanent error or temporary
    unknown_local_recipient_reject_code = 450
    # how long to keep message on queue before return as failed.
    # some have 3 days, I have 16 days as I am backup server for some people
    # whom go on holiday with their server switched off.
    maximal_queue_lifetime = 7d
    # max and min time in seconds between retries if connection failed
    minimal_backoff_time = 1000s
    maximal_backoff_time = 8000s
    # how long to wait when servers connect before receiving rest of data
    smtp_helo_timeout = 60s
    # how many address can be used in one message.
    # effective stopper to mass spammers, accidental copy in whole address list
    # but may restrict intentional mail shots.
    smtpd_recipient_limit = 16
    # how many error before back off.
    smtpd_soft_error_limit = 3
    # how many max errors before blocking it.
    smtpd_hard_error_limit = 12

    # Requirements for the HELO statement
    smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname,
    reject_invalid_hostname, permit
    # Requirements for the sender details
    smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
    # Requirements for the connecting server
    smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org,
    reject_rbl_client blackholes.easynet.nl,
    reject_rbl_client dnsbl.njabl.org
    # Requirement for the recipient address
    smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_pipelining,
    reject_non_fqdn_recipient, reject_unknown_recipient_domain,
    reject_unauth_destination, permit
    smtpd_data_restrictions = reject_unauth_pipelining

    # require proper helo at connections
    smtpd_helo_required = yes
    # waste spammers time before rejecting them
    smtpd_delay_reject = yes
    disable_vrfy_command = yes

    # not sure of the difference of the next two
    # but they are needed for local aliasing
    alias_maps = hash:/etc/postfix/aliases
    alias_database = hash:/etc/postfix/aliases
    # this specifies where the virtual mailbox folders will be located
    virtual_mailbox_base = /var/spool/mail/virtual
    # this is for the mailbox location for each user
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
    # and this is for aliases
    virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
    # and this is for domain lookups
    virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
    # this is how to connect to the domains (all virtual, but the option is there)
    # not used yet
    # transport_maps = mysql:/etc/postfix/mysql_transport.cf

    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    home_mailbox = Maildir/


    #SASL
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_type = cyrus
    #smtpd_sasl_path=/etc/postfix/sasl:/usr/lib/sasl2
    smtpd_sasl_path= smtpd
    # If your potential clients use Outlook Express or other older clients
    # this needs to be set to yes
    broken_sasl_auth_clients = yes
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_local_domain =

    #SCP: adding this to try to correct ERROR: IMAP dropped the connection
    mailbox_transport = virtual

    my /etc/postfix/master.cf:

    #
    # Postfix master process configuration file. For details on the format
    # of the file, see the master(5) manual page (command: "man 5 master").
    #
    # 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 - n - - smtpd
    #submission inet n - - - - smtpd
    # -o smtpd_tls_security_level=encrypt
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
    # -o milter_macro_daemon_name=ORIGINATING
    #smtps inet n - - - - smtpd
    # -o smtpd_tls_wrappermode=yes
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
    # -o milter_macro_daemon_name=ORIGINATING
    #628 inet n - - - - qmqpd
    pickup fifo n - - 60 1 pickup
    cleanup unix n - - - 0 cleanup
    qmgr fifo n - n 300 1 qmgr
    #qmgr fifo 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 - - y - - smtp -v
    # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
    relay unix - - y - - smtp
    -o smtp_fallback_relay=
    # -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 ${recipient}
    #
    # ================================================== ==================
    #
    # 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}

    submission inet n - y - - smtpd
    -o smtpd_sasl_auth_enable=yes
    # if you do not want to restrict it encryption only, comment out next line<
    -o smtpd_tls_auth_only=yes
    # -o smtpd_tls_security_level=encrypt
    # -o header_checks=
    # -o body_checks=<
    -o smtpd_client_restrictions=permit_sasl_authenticate d,reject_unauth_destination,reject
    -o smtpd_sasl_security_options=noanonymous,noplaintex t
    -o smtpd_sasl_tls_security_options=noanonymous
    # -o milter_macro_daemon_name=ORIGINATING<
    smtps inet n - y - - smtpd
    -o smtpd_tls_wrappermode=yes
    -o smtpd_sasl_auth_enable=yes
    -o smtpd_tls_auth_only=yes
    -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
    -o smtpd_sasl_security_options=noanonymous,noplaintex t
    -o smtpd_sasl_tls_security_options=noanonymous
    # -o milter_macro_daemon_name=ORIGINATING
    #smtp inet n - n - 1 postscreen
    #smtpd pass - - n - - smtpd
    #dnsblog unix - - n - 0 dnsblog
    #tlsproxy unix - - n - 0 tlsproxy

    My /etc/postfix/sasl/smtp.conf:

    pwcheck_method: saslauthd
    #mech_list: plain login pam
    #mech_list: plain login
    mech_list: plain login cram-md5 digest-md5
    #saslauthd_path: /var/run/saslauthd/mux
    #saslauthd_path: /var/spool/postfix/var/run/saslauthd/mux
    #authdaemond_path: /var/spool/authdaemon/socket
    log_level: 7
    allow_plaintext: true
    auxprop_plugin: sql
    #auxprop_plugin: mysql
    sql_engine: mysql
    sql_hostnames: localhost
    #sql_hostnames: 127.0.0.1
    sql_user: mail
    #sql_passw: password
    sql_passwd: password
    sql_database: maildb
    #sql_select: select crypt from users where id='%u@%r' and enabled=1
    sql_select: select crypt from users where id='%u' and enabled=1

    My /var/log/mail.log:

    Apr 15 14:07:18 me-main postfix/smtpd[18339]: connect from dsl081-198-066.nyc2.dsl.isp.net[8.8.8.8]
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: warning: dsl081-198-066.nyc2.dsl.isp.net[8.8.8.8]: SASL PLAIN authentication failed: generic failure
    Apr 15 14:07:25 me-main postfix/smtpd[18339]: disconnect from dsl081-198-066.nyc2.dsl.isp.net[8.8.8.8]
    Apr 15 14:10:45 me-main postfix/anvil[18341]: statistics: max connection rate 1/60s for (submission:8.8.8.8) at Apr 15 14:07:18
    Apr 15 14:10:45 me-main postfix/anvil[18341]: statistics: max connection count 1 for (submission:8.8.8.8) at Apr 15 14:07:18
    Apr 15 14:10:45 me-main postfix/anvil[18341]: statistics: max cache size 1 at Apr 15 14:07:18

    My /var/log/auth.log:

    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin trying to open db 'maildb' on host 'localhost'
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin could not connect to host localhost
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin couldn't connect to any host
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin Parse the username user@me.com
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin try and connect to a host
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin trying to open db 'maildb' on host 'localhost'
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin could not connect to host localhost
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin couldn't connect to any host

    I've read everything I can get my hands on from Falko Timme's threads, explored the possibility chroot being at the source of my troubles, and even tried downgrading sasl per an earlier guide for Ubuntu 11.10, but I'm getting nowhere. I'm really stumped, so any help would be much appreciated.

  2. #462
    Join Date
    Dec 2009
    Location
    Sweden
    Beans
    25
    Distro
    Ubuntu

    Re: Howto: set up a mail server in Ubuntu

    Hi,

    thanks for a very nice guide!
    I have one issue that I can't seem to solve.

    If I log in locally with telnet on my mail server and try to send an email to root@localhost it looks to me like the email address is mapped to root@localhost.mydomain.com. I would have expected that it should be mapped to root@mydomain.com. In my mail log I see this:
    Code:
     Jul  2 09:56:31 mailserver postfix/smtp[8085]: A966FCC046F: to=<root@localhost.mydomin.com>, orig_to=<root@localhost>, relay=127.0.0.1[127.0.0.1]:10024, delay=18, delays=12/0.02/0/5.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as B508ECC1167)
    The mail does not arrive in /var/mail/virtual/root/new.

    My aliases table looks like follows:
    Code:
    mysql> select * from aliases;
    +------+---------------------------------------+---------------------------------+---------+
    | pkid | mail                                  | destination                     | enabled |
    +------+---------------------------------------+---------------------------------+---------+
    |    1 | postmaster@localhost            | root@localhost                  |       1 |
    |    2 | sysadmin@localhost               | root@localhost                  |       1 |
    |    3 | webmaster@localhost             | root@localhost                  |       1 |
    |    4 | abuse@localhost                     | root@localhost                  |       1 |
    |    5 | root@localhost                         | root@mydomain.com |       1 |
    |    6 | @localhost                               | @mydomain.com     |       1 |
    |    7 | @localhost.localdomain           | @localhost                      |       1 |
    |    8 | @mydomain.com                     | postmaster@localhost            |       1 |
    |    9 | postmaster@mydomain.com  | postmaster@localhost            |       1 |
    |   10 | abuse@mydomain.com         | abuse@localhost                 |       1 |
    |   11 | mats@mydomain.com           | mats@mydomain.com |       1 |
    +------+---------------------------------------+---------------------------------+---------+
    My users table:

    Code:
    mysql> select * from users;
    +---------------------------------+------+------+------+-------------------------+---------+---------+-----------------+----------+-------------------------+-------+------------+----------------+
    | id                              | name | uid  | gid  | home                    | maildir | enabled | change_password | clear    | crypt                   | quota | procmailrc | spamassassinrc |
    +---------------------------------+------+------+------+-------------------------+---------+---------+-----------------+----------+-------------------------+-------+------------+----------------+
    | mats@mydomain.com | mats | 5000 | 5000 | /var/spool/mail/virtual | mats/   |       1 |               1 | ChangeMe | *************** |       |            |                |
    | root@mydomain.com | root | 5000 | 5000 | /var/spool/mail/virtual | root/   |       1 |               1 | ChangeMe | ************           |       |            |                |
    +---------------------------------+------+------+------+-------------------------+---------+---------+-----------------+----------+-------------------------+-------+------------+----------------+
    My domains table:
    Code:
    mysql> select * from domains;
    +------+----------------------------+-----------+---------+
    | pkid | domain                     | transport | enabled |
    +------+----------------------------+-----------+---------+
    |    1 | localhost                  | virtual:  |       1 |
    |    2 | localhost.localdomain      | virtual:  |       1 |
    |    3 | mydomain.com | virtual:  |       1 |
    |    4 | mydomain.com | virtual:  |       1 |
    +------+----------------------------+-----------+---------+
    If I try to email to postmaster@localhost it will be mapped to postmaster@localhost.mydomain.com while I would have expected it to be mapped to root@localhost and then to root@mydomain.com.
    An email to mats@localhost will be mapped to mats@localhost.mydomain.com, while an email sent to mats@mydomain.com is delivered to mats@mydomain.com, as I would expect.

    Any idea on what I am doing wrong? Why is "localhost" being added to the addresses?

    Many thanks for any help.

    /Mats

  3. #463
    Join Date
    Apr 2005
    Location
    Oslo
    Beans
    121

    Re: Howto: set up a mail server in Ubuntu

    Quote Originally Posted by m_gustafsson View Post
    Hi,


    My aliases table looks like follows:
    Code:
    mysql> select * from aliases;
    +------+---------------------------------------+---------------------------------+---------+
    | pkid | mail                                  | destination                     | enabled |
    +------+---------------------------------------+---------------------------------+---------+
    |    1 | postmaster@localhost            | root@localhost                  |       1 |
    |    2 | sysadmin@localhost               | root@localhost                  |       1 |
    |    3 | webmaster@localhost             | root@localhost                  |       1 |
    |    4 | abuse@localhost                     | root@localhost                  |       1 |
    |    5 | root@localhost                         | root@mydomain.com |       1 |
    |    6 | @localhost                               | @mydomain.com     |       1 |
    |    7 | @localhost.localdomain           | @localhost                      |       1 |
    |    8 | @mydomain.com                     | postmaster@localhost            |       1 |
    |    9 | postmaster@mydomain.com  | postmaster@localhost            |       1 |
    |   10 | abuse@mydomain.com         | abuse@localhost                 |       1 |
    |   11 | mats@mydomain.com           | mats@mydomain.com |       1 |
    +------+---------------------------------------+---------------------------------+---------+
    If this is your aliases table I think you have some cyclical routing.

    root@localhost goes to root@mydomain.com
    root@mydomain.com is not specified but is caught by catchall @mydomain.com
    @mydomain.com goes to postmaster@localhost
    postmaster@localhost goes to root@localhost and round again...
    Cheers,
    Ivar (flurdy.com)

  4. #464
    Join Date
    Dec 2009
    Location
    Sweden
    Beans
    25
    Distro
    Ubuntu

    Re: Howto: set up a mail server in Ubuntu

    Quote Originally Posted by flurdy View Post
    If this is your aliases table I think you have some cyclical routing.

    root@localhost goes to root@mydomain.com
    root@mydomain.com is not specified but is caught by catchall @mydomain.com
    @mydomain.com goes to postmaster@localhost
    postmaster@localhost goes to root@localhost and round again...
    Thanks for the reply . I see your point and I will correct this.

    By the way, do you have any clue to my other question, see below:
    An email to mats@localhost will be mapped to mats@localhost.mydomain.com, while an email sent to mats@mydomain.com is delivered to mats@mydomain.com, as I would expect.
    Any idea on what I am doing wrong? Why is "localhost" being added to the addresses?
    I could only think of my /etc/mailname, /etc/hosts and /etc/hostname being involved here, and they looks like this:
    Code:
    $ cat /etc/mailname 
    server4.mydomain.com
    
     $ cat /etc/hosts
    127.0.0.1    localhost.localdomain localhost
    192.168.0.13    server4.mydomain.com server4
    
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    
    $ cat /etc/hostname
    server4.mydomain.com
    Best regards, Mats

  5. #465
    Join Date
    Jul 2013
    Beans
    1

    Re: Howto: set up a mail server in Ubuntu

    Hello setting up my first email server using the awesome HowTo. I'm setting it up on a vanilla Ubuntu machine on Amazon AWS. I ran into a problem during testing. I can receive OK but when I try to send I see this error message in the mail log:

    Jul 9 18:37:10 ip-172-31-45-190 postfix/smtp[10432]: D5DD56DAAA: to=<xxxxxx@gmail.com>, relay=email-smtp.us-east-1.amazonaws.com[107.21.238.216]:25, delay=87, delays=86/0.01/0.38/0.08, dsn=5.0.0, status=bounced (host email-smtp.us-east-1.amazonaws.com[107.21.238.216] said: 530 Authentication required (in reply to MAIL FROM command)).

    This is what appears in the terminal window:

    ubuntu@ip-172-31-45-190:~/121mailr$ openssl s_client -crlf -quiet -connect email-smtp.us-east-1.amazonaws.com:465
    depth=2 C = US, O = "VeriSign, Inc.", OU = VeriSign Trust Network, OU = "(c) 2006 VeriSign, Inc. - For authorized use only", CN = VeriSign Class 3 Public Primary Certification Authority - G5
    verify error:num=20:unable to get local issuer certificate
    verify return:0
    220 email-smtp.amazonaws.com ESMTP SimpleEmailService-376766033
    421 Timeout waiting for data from client.

    This isn't mentioned in the How To. I've googled it but haven't found anything helpful. It pauses briefly at the "220" line, before displaying the "421 line so I'm guessing it's waiting for my SMTP credentials or something? This isn't mentioned in the How To so I'm wondering if I missed a configuration step or if there's one missing? Thanks in advance for the help.

    UPDATE: I just realized why it's not covered in the How To. I'm using Amazon SES for outbound mail. Anyone know how to configure for this? Thanks.

    UPDATE2: SOLVED OK figured it out myself. Sometimes it helps to go do something else for a while and come back to it : )
    Here's where I found the info about configuring postfix to use SES for outgoing mail
    Last edited by wmellema; July 10th, 2013 at 12:17 AM. Reason: SOLVED

  6. #466
    Join Date
    Dec 2009
    Location
    Sweden
    Beans
    25
    Distro
    Ubuntu

    Re: Howto: set up a mail server in Ubuntu

    Quote Originally Posted by m_gustafsson View Post
    An email to mats@localhost will be mapped to mats@localhost.mydomain.com, while an email sent to mats@mydomain.com is delivered to mats@mydomain.com, as I would expect.
    Any idea on what I am doing wrong? Why is "localhost" being added to the addresses?
    I can now send emails to mats@mydomain.com, mats@localhost, root@localhost and postmaster@localhost. What I did was to set my domains, aliases and users tables as below:
    Code:
    mysql> select * from domains;
    +------+----------------------------+-----------+---------+
    | pkid | domain                     | transport | enabled |
    +------+----------------------------+-----------+---------+
    |    9 | mydomain.com               | virtual:  |       1 |
    +------+----------------------------+-----------+---------+
    
    mysql> select * from aliases;
    +------+---------------------------------------+-----------------------------+---------+
    | pkid | mail                                  | destination                 | enabled |
    +------+---------------------------------------+-----------------------------+---------+
    |    8 | @localhost.mydomain.com               | @mydomain.com               |       1 |
    |    9 | postmaster@mydomain.com               | root@localhost              |       1 |
    
    mysql> select * from users;
    +---------------------------------+------+------+------+-------------------------+---------+---------+-----------------+----------+-------------------------+-------+------------+----------------+
    | id                              | name | uid  | gid  | home                    | maildir | enabled | change_password | clear    | crypt                   | quota | procmailrc | spamassassinrc |
    +---------------------------------+------+------+------+-------------------------+---------+---------+-----------------+----------+-------------------------+-------+------------+----------------+
    | mats@mydomain.com               | mats | 5000 | 5000 | /var/spool/mail/virtual | mats/   |       1 |               1 | ChangeMe | *********************** |       |            |                |
    | root@mydomain.com               | root | 5000 | 5000 | /var/spool/mail/virtual | root/   |       1 |               1 | ChangeMe | *******************     |       |            |                |
    +---------------------------------+------+------+------+-------------------------+---------+---------+-----------------+----------+-------------------------+-------+------------+----------------+
    So, as I understand it, everything sent to "xxx@localhost" gets mapped to "xxx@localhost.mydomain.com" (do not know why). Thus an email sent to postmaster@localhost will, through the aliases tables, get mapped to: postmaster@mydomain.com -> root@localhost -> root@localhost.mydomain.com -> root@mydomain.com. root@mydomain.com will then be delivered to the user root.

    Don't know if I am totally at lost now, but it seems to work like this.

    /Mats

  7. #467
    Join Date
    Dec 2009
    Location
    Sweden
    Beans
    25
    Distro
    Ubuntu

    Re: Howto: set up a mail server in Ubuntu

    Hi,
    I have decided to go for RoundCube for my webmail.
    When configuring RoundCube I understand that it sets up its own database and that that database does not match with the one set up in this guide, e.g. the users tables.
    Is there a "recommended" way to deal with this? Do you use the database created by RoundCube and put it into use for postfix through the main.cf file, or is there a way to get RoundCube to use another database, for example the database set up in this guide?
    Or, have I done a mistake configuring RoundCube, when using (in Ubuntu):
    Code:
    # dpkg-reconfigure roundcube-core
    Mats

  8. #468
    Join Date
    Dec 2009
    Location
    Sweden
    Beans
    25
    Distro
    Ubuntu

    Re: Howto: set up a mail server in Ubuntu

    Quote Originally Posted by m_gustafsson View Post
    Hi,
    I have decided to go for RoundCube for my webmail.
    When configuring RoundCube I understand that it sets up its own database and that that database does not match with the one set up in this guide, e.g. the users tables.
    Is there a "recommended" way to deal with this? Do you use the database created by RoundCube and put it into use for postfix through the main.cf file, or is there a way to get RoundCube to use another database, for example the database set up in this guide?
    Or, have I done a mistake configuring RoundCube, when using (in Ubuntu):
    Code:
    # dpkg-reconfigure roundcube-core
    Mats
    The reason for my question above was that I could not log in to roundcube using my "mail" user. When looking into the mail log I saw that there was a mismatch in the field name of the users table, i.e. the field name carrying my email address was "id" while roundcube was asking for "username". I then misunderstood the way the databases are used, hence my question.
    Anyway, tonight I modified the field name of my users table:
    Code:
    mysql> alter table users change id username varchar (128);
    After that I was able to log in.

    /Mats

  9. #469
    Join Date
    Dec 2009
    Location
    Sweden
    Beans
    25
    Distro
    Ubuntu

    Re: Howto: set up a mail server in Ubuntu

    Dakong27,

    did you find a solution to your problem?
    I believe that I have a similar issue.
    If I remove the line:
    Code:
     -o smtpd_client_restrictions=permit_sasl_authenticated,reject 
    from my master.cf I am able to send emails (from RoundCube). Is it the same in your case?
    Btw, I think it should be "permit_sasl_authenticated", it looks like you have "permit_sasl_authenticate d", with a space before "d".

    /M

    Quote Originally Posted by dakong27 View Post
    Hi All--I followed Flurdy's guide for Ubuntu 12.04, though I have Ubuntu 12.10 64-bit. Everything works but I cannot send from a mail client or Squirrelmail. I've been tweaking and googling and tail-ing logs for a solid week and can't crack it, so I'm hoping you folks can help me out.

    My /etc/postfix/main.cf:

    # See /usr/share/postfix/main.cf.dist for a commented, more complete version


    # Debian specific: Specifying a file name will cause the first
    # line of that file to be used as the name. The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no

    # appending .domain is the MUA's job.
    append_dot_mydomain = no

    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h

    readme_directory = no

    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    #smtpd_use_tls=no
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.

    myhostname = mail.me.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = me.com
    mydestination = mail.me.com, me-main.Datian, localhost.Datian, localhost
    #mydestination =
    #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    relayhost =
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128,192.168.2.0/24
    mailbox_command =
    mailbox_size_limit = 30000000
    recipient_delimiter = +
    inet_interfaces = all

    masquerade_domains = mail.me.com
    local_recipient_maps =

    # how long if undelivered before sending warning update to sender
    delay_warning_time = 4h
    # will it be a permanent error or temporary
    unknown_local_recipient_reject_code = 450
    # how long to keep message on queue before return as failed.
    # some have 3 days, I have 16 days as I am backup server for some people
    # whom go on holiday with their server switched off.
    maximal_queue_lifetime = 7d
    # max and min time in seconds between retries if connection failed
    minimal_backoff_time = 1000s
    maximal_backoff_time = 8000s
    # how long to wait when servers connect before receiving rest of data
    smtp_helo_timeout = 60s
    # how many address can be used in one message.
    # effective stopper to mass spammers, accidental copy in whole address list
    # but may restrict intentional mail shots.
    smtpd_recipient_limit = 16
    # how many error before back off.
    smtpd_soft_error_limit = 3
    # how many max errors before blocking it.
    smtpd_hard_error_limit = 12

    # Requirements for the HELO statement
    smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname,
    reject_invalid_hostname, permit
    # Requirements for the sender details
    smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
    # Requirements for the connecting server
    smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org,
    reject_rbl_client blackholes.easynet.nl,
    reject_rbl_client dnsbl.njabl.org
    # Requirement for the recipient address
    smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_pipelining,
    reject_non_fqdn_recipient, reject_unknown_recipient_domain,
    reject_unauth_destination, permit
    smtpd_data_restrictions = reject_unauth_pipelining

    # require proper helo at connections
    smtpd_helo_required = yes
    # waste spammers time before rejecting them
    smtpd_delay_reject = yes
    disable_vrfy_command = yes

    # not sure of the difference of the next two
    # but they are needed for local aliasing
    alias_maps = hash:/etc/postfix/aliases
    alias_database = hash:/etc/postfix/aliases
    # this specifies where the virtual mailbox folders will be located
    virtual_mailbox_base = /var/spool/mail/virtual
    # this is for the mailbox location for each user
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
    # and this is for aliases
    virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
    # and this is for domain lookups
    virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
    # this is how to connect to the domains (all virtual, but the option is there)
    # not used yet
    # transport_maps = mysql:/etc/postfix/mysql_transport.cf

    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    home_mailbox = Maildir/


    #SASL
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_type = cyrus
    #smtpd_sasl_path=/etc/postfix/sasl:/usr/lib/sasl2
    smtpd_sasl_path= smtpd
    # If your potential clients use Outlook Express or other older clients
    # this needs to be set to yes
    broken_sasl_auth_clients = yes
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_local_domain =

    #SCP: adding this to try to correct ERROR: IMAP dropped the connection
    mailbox_transport = virtual

    my /etc/postfix/master.cf:

    #
    # Postfix master process configuration file. For details on the format
    # of the file, see the master(5) manual page (command: "man 5 master").
    #
    # 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 - n - - smtpd
    #submission inet n - - - - smtpd
    # -o smtpd_tls_security_level=encrypt
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
    # -o milter_macro_daemon_name=ORIGINATING
    #smtps inet n - - - - smtpd
    # -o smtpd_tls_wrappermode=yes
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
    # -o milter_macro_daemon_name=ORIGINATING
    #628 inet n - - - - qmqpd
    pickup fifo n - - 60 1 pickup
    cleanup unix n - - - 0 cleanup
    qmgr fifo n - n 300 1 qmgr
    #qmgr fifo 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 - - y - - smtp -v
    # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
    relay unix - - y - - smtp
    -o smtp_fallback_relay=
    # -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 ${recipient}
    #
    # ================================================== ==================
    #
    # 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}

    submission inet n - y - - smtpd
    -o smtpd_sasl_auth_enable=yes
    # if you do not want to restrict it encryption only, comment out next line<
    -o smtpd_tls_auth_only=yes
    # -o smtpd_tls_security_level=encrypt
    # -o header_checks=
    # -o body_checks=<
    -o smtpd_client_restrictions=permit_sasl_authenticate d,reject_unauth_destination,reject
    -o smtpd_sasl_security_options=noanonymous,noplaintex t
    -o smtpd_sasl_tls_security_options=noanonymous
    # -o milter_macro_daemon_name=ORIGINATING<
    smtps inet n - y - - smtpd
    -o smtpd_tls_wrappermode=yes
    -o smtpd_sasl_auth_enable=yes
    -o smtpd_tls_auth_only=yes
    -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
    -o smtpd_sasl_security_options=noanonymous,noplaintex t
    -o smtpd_sasl_tls_security_options=noanonymous
    # -o milter_macro_daemon_name=ORIGINATING
    #smtp inet n - n - 1 postscreen
    #smtpd pass - - n - - smtpd
    #dnsblog unix - - n - 0 dnsblog
    #tlsproxy unix - - n - 0 tlsproxy

    My /etc/postfix/sasl/smtp.conf:

    pwcheck_method: saslauthd
    #mech_list: plain login pam
    #mech_list: plain login
    mech_list: plain login cram-md5 digest-md5
    #saslauthd_path: /var/run/saslauthd/mux
    #saslauthd_path: /var/spool/postfix/var/run/saslauthd/mux
    #authdaemond_path: /var/spool/authdaemon/socket
    log_level: 7
    allow_plaintext: true
    auxprop_plugin: sql
    #auxprop_plugin: mysql
    sql_engine: mysql
    sql_hostnames: localhost
    #sql_hostnames: 127.0.0.1
    sql_user: mail
    #sql_passw: password
    sql_passwd: password
    sql_database: maildb
    #sql_select: select crypt from users where id='%u@%r' and enabled=1
    sql_select: select crypt from users where id='%u' and enabled=1

    My /var/log/mail.log:

    Apr 15 14:07:18 me-main postfix/smtpd[18339]: connect from dsl081-198-066.nyc2.dsl.isp.net[8.8.8.8]
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: warning: dsl081-198-066.nyc2.dsl.isp.net[8.8.8.8]: SASL PLAIN authentication failed: generic failure
    Apr 15 14:07:25 me-main postfix/smtpd[18339]: disconnect from dsl081-198-066.nyc2.dsl.isp.net[8.8.8.8]
    Apr 15 14:10:45 me-main postfix/anvil[18341]: statistics: max connection rate 1/60s for (submission:8.8.8.8) at Apr 15 14:07:18
    Apr 15 14:10:45 me-main postfix/anvil[18341]: statistics: max connection count 1 for (submission:8.8.8.8) at Apr 15 14:07:18
    Apr 15 14:10:45 me-main postfix/anvil[18341]: statistics: max cache size 1 at Apr 15 14:07:18

    My /var/log/auth.log:

    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin trying to open db 'maildb' on host 'localhost'
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin could not connect to host localhost
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin couldn't connect to any host
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin Parse the username user@me.com
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin try and connect to a host
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin trying to open db 'maildb' on host 'localhost'
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin could not connect to host localhost
    Apr 15 14:07:23 me-main postfix/smtpd[18339]: sql plugin couldn't connect to any host

    I've read everything I can get my hands on from Falko Timme's threads, explored the possibility chroot being at the source of my troubles, and even tried downgrading sasl per an earlier guide for Ubuntu 11.10, but I'm getting nowhere. I'm really stumped, so any help would be much appreciated.

  10. #470
    Join Date
    Aug 2013
    Beans
    3

    Re: Howto: set up a mail server in Ubuntu

    I can send mail from local Squaremail but i cant send mail from thunderbird / other remote mail client.

    in /var/log/mail.log:
    Aug 1 01:41:41 mail postfix/smtpd[6729]: warning: SASL authentication failure: incorrect digest response
    Aug 1 01:41:41 mail postfix/smtpd[6729]: warning: ******[***.***.***.***]: SASL CRAM-MD5 authentication failed: authentication failure
    in /var/log/auth.log:
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin Parse the username mydomain@mydomain.com
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin try and connect to a host
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin trying to open db 'maildb' on host '127.0.0.1'
    Aug 1 01:41:41 mail postfix/smtpd[6729]: begin transaction
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin create statement from userPassword mydomain mydomain.com
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin doing query select crypt from users where id='mydomain@mydomain.com' and enabled = 1;
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin create statement from cmusaslsecretCRAM-MD5 mydomain mydomain.com
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin doing query select crypt from users where id='mydomain@mydomain.com' and enabled = 1;
    Aug 1 01:41:41 mail postfix/smtpd[6729]: commit transaction
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin Parse the username mydomain@mydomain.com
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin try and connect to a host
    Aug 1 01:41:41 mail postfix/smtpd[6729]: sql plugin trying to open db 'maildb' on host '127.0.0.1'

    cfgs:
    /etc/postfix/main.cf
    http://paste.ubuntu.com/5934610/
    /etc/postfix/master.cf
    http://paste.ubuntu.com/5934613/
    /etc/postfix/sasl/smtpd.conf
    http://paste.ubuntu.com/5934617/
    /etc/pam.d/smtp
    http://paste.ubuntu.com/5934623/
    /etc/courier/imapd
    http://paste.ubuntu.com/5954496/
    Last edited by gidden2; August 6th, 2013 at 10:54 AM.

Page 47 of 51 FirstFirst ... 374546474849 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •