LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   [Ubuntu Server 11.10]Problem with mail server (https://www.linuxquestions.org/questions/linux-server-73/%5Bubuntu-server-11-10%5Dproblem-with-mail-server-939786/)

MarkoSan 04-14-2012 09:54 AM

[Ubuntu Server 11.10]Problem with mail server
 
Dear Sirs and Madams!

I've setup mail server with Postfix+Dovecot combination. Now, from linux bash shell (logged on to server from Windows 7 Ultimate via putty) I can receive and send email without problems. Then I installed on Windows 7 machine Mozilla Thunderbird and when I try to send email to some gmail account, I get following error (from Mozilla Thunderbird):
Quote:

An error occurred while sending mail. The mail server responded: 5.7.1 <user@gmail.com>: Relay access denied. Please check the message recipient user@gmail.com and try again.
What is wrong, can someone help me please?

Sincerely,
Marko

bathory 04-14-2012 12:51 PM

Hi,

You should add the IP of your windows box in mynetworks option in main.cf

Regards

MarkoSan 04-15-2012 06:35 AM

Well, I did and I still get error (this one is from server log):
Quote:

Apr 15 13:29:01 kilimanjaro postfix/master[6072]: daemon started -- version 2.8.5, configuration /etc/postfix
Apr 15 13:29:32 kilimanjaro postfix/smtpd[6076]: connect from lk.xxx.xxx.xxx.xxx.dc.cable.static.lj-kabel.net[xxx.xxx.xxx.xxx]
Apr 15 13:29:32 kilimanjaro postfix/smtpd[6076]: NOQUEUE: reject: RCPT from lk.xxx.xxx.xxx.xxx.dc.cable.static.lj-kabel.net[xxx.xxx.xxx.xxx]: 554 5.7.1 <user@gmail.com>: Relay access denied; from=<user@mydomain.com> to=<user@gmail.com> proto=ESMTP helo=<[192.168.100.120]>
Apr 15 13:29:39 kilimanjaro postfix/smtpd[6076]: disconnect from lk.xxx.xxx.xxx.xxx.dc.cable.static.lj-kabel.net[xxx.xxx.xxx.xxx]
And my main.cf looks like:
Quote:

# 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_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 = kilimanjaro.my-domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = my-domain.com, kilimanjaro.my-domain.com, localhost.my-domain.com, localhost
relayhost =
#mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetwors = 192.168.1.1/16
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4

Noway2 04-15-2012 07:21 AM

What do you have in your "smtpd_recipient_restrictions"? This is the block that determines who is allowed to send. Normally it contains things like "permit_sasl_authenticated" and "permit_mynetworks", either of wich could be used to authenticate your Thunderbird client. According to the error message:
Quote:

connect from lk.xxx.xxx.xxx.xxx.dc.cable.static.lj-kabel.net[xxx.xxx.xxx.xxx]
the host is identifying itself as xxx.xxx.xxx.xxx, which appears to be a public IP address and not as a LAN address in the range of 192.168.0.0/16 as declared by "mynetwors". The alternative is SASL authentication.

MarkoSan 04-15-2012 10:52 AM

Quote:

Originally Posted by Noway2 (Post 4653201)
What do you have in your "smtpd_recipient_restrictions"? This is the block that determines who is allowed to send. Normally it contains things like "permit_sasl_authenticated" and "permit_mynetworks", either of wich could be used to authenticate your Thunderbird client. According to the error message: the host is identifying itself as xxx.xxx.xxx.xxx, which appears to be a public IP address and not as a LAN address in the range of 192.168.0.0/16 as declared by "mynetwors". The alternative is SASL authentication.

Thanks for your tip, but, can you please tell me the reason why host is identifying with public, not LAN address? How do I fix this?

MarkoSan 04-15-2012 11:35 AM

Ok, I've setup Mozilla account server settings from "mail.my-domain.com" to "192.168.100.101" which is LAN server's address and I can send email. But, if I return from google to newly created email, I get it on server via "mail" command, but in Thunderbird there is no new email. Why??

Noway2 04-15-2012 12:04 PM

Quote:

Originally Posted by MarkoSan (Post 4653307)
Thanks for your tip, but, can you please tell me the reason why host is identifying with public, not LAN address? How do I fix this?

This will depend on the host configuration, including it's assigned IP address, it's hostname, and how traffic is routed to the server, and (as I suspect is the cause) whether you are pointing it to your mail server's public IP or private IP.

Quote:

if I return from google to newly created email, I get it on server via "mail" command, but in Thunderbird there is no new email. Why??
There are two portions of a typical mail server, the SMTP server and the POP/IMAP server. Are you using a POP/IMAP server such as Dovecot or Courier and how do you have your mail delivery configured? The default in Postfix is local mail delivery, which puts mail in a mailbox under each user's home folder. In thunderbird, this is usually seen under the local folders (see this link for details), as compared to the normal Inbox which looks at your POP/IMAP server.

MarkoSan 04-16-2012 01:15 AM

I am using dovecot, and my /etc/dovecot.conf is:
Code:

protocols = pop3 pop3s imap imaps
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u # (for mbox)


Noway2 04-16-2012 04:19 AM

The configuration looks correct, meaning Dovecot should be able to find the mailboxes (see the following link). What are you using for your delivery agent in Postfix? Are you using Dovecot delivery, which would be configured in both main.cf and master.cf? The reason for using Dovecot delivery is that Dovecot creates indexes of what messages are stored where. I found this page gives a pretty good explaination of this. In particular please check the Postfix section, which will go into detail about how to configure Dovecot + Postfix with local mailboxes.

MarkoSan 04-16-2012 08:24 AM

Quote:

Originally Posted by Noway2 (Post 4653868)
The configuration looks correct, meaning Dovecot should be able to find the mailboxes (see the following link). What are you using for your delivery agent in Postfix? Are you using Dovecot delivery, which would be configured in both main.cf and master.cf? The reason for using Dovecot delivery is that Dovecot creates indexes of what messages are stored where. I found this page gives a pretty good explaination of this. In particular please check the Postfix section, which will go into detail about how to configure Dovecot + Postfix with local mailboxes.

Here is my /etc/postfix/master.cf 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").
#
# 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 smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,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_authenticated,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  -      -      -      -      -      smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay    unix  -      -      -      -      -      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}

Where do I check if postfix is using Dovecot delivery?

Noway2 04-16-2012 08:51 AM

No, your not using Dovecot for your delivery agent. If you were, master.cf would have a line like the following:
Code:

dovecot unix - n n - - pipe flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/deliver -d $(recipient)
and in main.cf:
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

Note that this is almost identical to the maildrop entries, which is the normal local mail account delivery agent.

MarkoSan 05-23-2012 04:40 PM

Quote:

Originally Posted by Noway2 (Post 4654108)
No, your not using Dovecot for your delivery agent. If you were, master.cf would have a line like the following:
Code:

dovecot unix - n n - - pipe flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/deliver -d $(recipient)
and in main.cf:
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

Note that this is almost identical to the maildrop entries, which is the normal local mail account delivery agent.

So I replace your entry with maildrop entries, or I add your post into file (at the end of it)?

Sincerely,
Marko

Noway2 05-24-2012 04:57 AM

Quote:

Originally Posted by MarkoSan (Post 4685869)
So I replace your entry with maildrop entries, or I add your post into file (at the end of it)?

Just add it. It should be picked up with the following additions to your main.cf, which tell Postfix to call the dovecot line in master.
Code:

virtual_transport = dovecot
smtpd_sasl_type = dovecot



All times are GMT -5. The time now is 03:36 PM.