LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-11-2010, 12:26 AM   #1
ClinicalDB
LQ Newbie
 
Registered: Apr 2010
Posts: 3

Rep: Reputation: 0
Question SMTP server (pop/imap) interaction with Postfix/MySQL[5.0.51] (Ubuntu Hardy)


Hi,
Newbie here, both to mail and Linux, please move this thread to a more appropriate place if necesary.

The problem: I have postfix installed on this remote server that I have SSH access to, and I believe I can get it (postfix) working by itself. Now, I want to use thunderbird to read/send mail, and extend this capability to other users.

What I have done so far:
-----------------------

Step 1:
------
Installed postfix using apt-install, worked OK. The test: I have 2 user accounts, "a" and "b". I have had a "~b/.forward" file that contained the line "b@gmail.com". Logging in as user "a", I could send e-mail to "b@clinicaldb.com" as well as "b@gmail.com". This said (a) User "a" can send e-mail internally and to external addresses (b) User "b" can receive e-mail and (c) Postfix can read the ".forward" file to forward e-mail to external addresses.

Step 2:
------
Following the instructions/tutorials at the server provider, I installed SASLDauth and Courier; generated a self signed certificate, reconfigured the iptables to allow access to the ports. I already have had MySQL. So I created a "mailadmin" user to access the DB, and a vmail account to save mail. If you want me to go back through this process, I can repeat it and give the details. End result: Thunderbird said "Invalid login". Trying to mail locally failed, logs said MySQL authentication failure. Rolling back the "main.cf" file (to that of Step 1) and restarting postfix starts the mail - but I cannot access it from outside world.

Step 3:
------
I followed the steps outlined at "http://flurdy.com/docs/postfix/", installed all the components. At the very 1st level of testing, postfix is failing. Here is the output while testing with telnet (It worked before, I messed up something and dont know how to fix it)

-----------------------------------
$ telnet clinicaldb.com 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 clinicaldb.com ESMTP Postfix (Ubuntu)
EHLO clinicaldb.com
250-clinicaldb.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM: <cdbuser@clinicaldb.com>
250 2.1.0 Ok
MAIL TO: <sengupta@clinicaldb.com>
503 5.5.1 Error: nested MAIL command
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
-----------------------------------

I cannot figure out how to debug this "nested MAIL command". Checking the aliases, I do not see any circular alias. The files in /var/log/ mail.[log|err|info] does not tell me anything. This is where I need help, to continue.

Here is the output from postconf -n
-----------------------------------
postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
delay_warning_time = 4h
disable_vrfy_command = yes
inet_interfaces = all
inet_protocols = all
local_recipient_maps =
mailbox_size_limit = 51200000
maximal_backoff_time = 8000s
maximal_queue_lifetime = 16d
minimal_backoff_time = 1000s
mydestination =
myhostname = clinicaldb.com
mynetworks = 174.143.208.80/28, 127.0.0.0/8
mynetworks_style = host
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relay_domains =
relayhost =
smtp_helo_timeout = 60s
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.njabl.org
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
smtpd_hard_error_limit = 12
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit
smtpd_recipient_limit = 12
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, permit_sasl_authenticated, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
smtpd_soft_error_limit = 3
unknown_local_recipient_reject_code = 450
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
virtual_gid_maps = mysql:/etc/postfix/mysql_gid.cf
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailboxes.cf
virtual_uid_maps = mysql:/etc/postfix/mysql_uid.cf
-----------------------------------

Oh, TIA for any responses. I am supposed to introduced myself, on this 1st post. So saying Hi to you all. Best wishes, -

M.S. [You could call me "a mess" tonight, too].
 
Old 04-11-2010, 04:48 AM   #2
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
MAIL FROM: is ok
MAIL TO: should be RCPT TO:
 
Old 04-12-2010, 10:53 AM   #3
ClinicalDB
LQ Newbie
 
Registered: Apr 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you, bakdong. That was one silly mistake on my part. I couldnt figure out the error message. I got that one fixed - and hopefully got postfix running. Testing the system, I can send mail outside with postfix, I can receive it, too; I see the folder /home/vmail/sengupta created (vmail is the virtual user, sengupta the real one). A subdirectory "new" contains the mail in a text format.

Here is the problem - I cannot be sure if Courier/SASL/PAM - the whole set up can read any email from thunderbird, I cannot get thunderbird to login and receive mail. From all the set ups and editing I have done, here are the issues I see:

(1) from /etc/var/auth.log:
saslauthd[17788]: do_auth : auth failure: [user=sengupta] [service=smtp] [realm=] [mech=pam] [reason=PAM auth error]

(2) in /var/log/mail.info:
Apr 12 02:22:52 clinicaldb imapd: LOGIN FAILED, method=CRAM-MD5, ip=[::ffff:76.182.249.41]
Apr 12 02:22:52 clinicaldb imapd: authentication error: Input/output error

(3) Contents of file /etc/pam.d/smtp:
auth required pam_mysql.so user=mailadmin passwd=mailadminPW host=127.0.0.1 db=maildb table=users usercolumn=id passwdcolumn=crypt crypt=1
account sufficient pam_mysql.so user=mailadmin passwd=mailadminPW host=127.0.0.1 db=maildb table=users usercolumn=id passwdcolumn=crypt crypt=1

Question: How do I go about debugging this?

An aside: With my limited knowledge of Linux, I was going through the set up - and observed this: MySQL encrypt() function takes an optional 2nd argument - the salt. If not supplied, a random string is used. Now, if I do not supply a salt, MySQL is going to generate pretty much a random string, and PAM has no way of knowing what the salt is - so I do not see a logical way how this authentication is done. May be I am missing something trivial again, any comments on this? Thanks a lot, - M.S.
 
Old 04-13-2010, 02:17 AM   #4
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
I've not done this config myself so can only give you very general pointers I'm afraid. Apart from saying that you've got an authentication problem, which I'm sure you already know, it's a case of having to go through every step again, checking as you go and splitting the process into logical steps.
 
Old 04-14-2010, 01:09 AM   #5
ClinicalDB
LQ Newbie
 
Registered: Apr 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Can you (or any other expert) tell me a config that worked with MySQL 5.+. If I cannot get this going, I have to give up on MySQL and try something else. Any suggestions for a feasible config? Thanks, - M.S.
 
Old 04-15-2010, 05:16 AM   #6
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
Sorry, never used postfix, with or without sql
 
  


Reply

Tags
mailserver, mysql, pam, postfix, sasl


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server configuration for small office server, which smtp, pop imap server and backup whitelinux Linux - Server 4 04-06-2010 11:26 AM
POP SMTP and IMAP virus / spam protection netguy2000 Fedora 1 09-04-2007 04:28 PM
most prefered mail server (pop/imap) and smtp cope Linux - Server 2 04-04-2007 09:15 AM
Postfix or POP/SMTP jmirles Linux - Networking 2 12-16-2003 01:16 PM
Postfix + pop-before-smtp problem Kostko Linux - Software 3 02-19-2003 12:46 PM


All times are GMT -5. The time now is 09:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration