# Postfix simply won´t auth with mysql (SOLVED)

## dodger10k

After installing around for some days now Postfix generally is up and running and receiving and sending just fine. When I check the accounts locally with mutt everything ist ok.

But trying to log in with smtp or pop3 simply isn´t working. I followed the Virtual Mailhosting Guide but still can´t find the reason.

Here´s the maillog:

 *Quote:*   

> Dec  7 17:38:41 [imapd] Connection, ip=[127.0.0.1]
> 
> Dec  7 17:38:46 [imapd] LOGIN FAILED, ip=[127.0.0.1]
> 
> Dec  7 17:38:46 [imapd] DISCONNECTED, ip=[127.0.0.1], headers=0, body=0

 

The mysql-logs are empty, so it looks to my that courier isn´t talking to mysql.

Here´s how I set up the pam.d:

 *Quote:*   

> 
> 
> #%PAM-1.0
> 
> #
> ...

 

Which looks ok to me regarding the howto.

Any ideas about this? Tnx in advance  :Smile: Last edited by dodger10k on Wed Dec 10, 2003 3:55 pm; edited 3 times in total

----------

## ikaro

There are so many posts about that matter, that it would be easier for you to search insted of me replying.

another thing is, that the docs arent correct. there are something missing, and thats why so many people have problems with it.

The solution is to use the search facility of the forums.

----------

## dodger10k

Believe me I have searched the forum for hours. And yes, I found a lot of threads regarding this topic, but none gave me a solution so that´s why I wrote this thread  :Sad: 

----------

## Jaxom

Everything seems to work using the virtual mail guide.  The problems I ran into were they weren't up to date with current Gentoo, and some things weren't clear enough.

$password means you need to enter your password, stuff like that

when a password should be entered I always read it elsewhere like <password> and that's what I came to understand as standard.  I might be wrong in that, but......

And like the thing that was my problem in the main.cf the virtual hosts needing to actually be listed.

----------

## dfuse

I have exactly the same problem, I can send and receive mail with mutt, but I can't login with Squirrelmail, I get the same messages in my logs.

----------

## kashani

Is there anything in the log files from courier? IIRC it should toss out some error about not being able to authenticate.

kashani

----------

## dfuse

No, the only thing that's in /var/log/mail/current is:

```

Dec 7 21:08:16 [imapd] Connection, ip=[127.0.0.1]

Dec 7 21:08:21 [imapd] LOGIN FAILED, ip=[127.0.0.1]

Dec 7 21:08:21 [imapd] DISCONNECTED, ip=[127.0.0.1], headers=0, body=0

```

[/code]

----------

## dodger10k

As posted above within my logs there´s also no further error message.

Maybe someone can look over my postconf:

 *Quote:*   

> 
> 
> alias_maps = mysql:/etc/postfix/mysql-aliases.cf
> 
> broken_sasl_auth_clients = yes
> ...

 

Any other hints would be still helpful  :Smile: 

----------

## dfuse

After browsing through the forum, and checking all my config files 5 times for errors, I just can't believe that authorisation won't work because of an error in following the guide. If you look at the number of posts from people with EXACTLY the same problem (and none of them were resolved). 

The people who've got it working must have changed some settings from the guide, it'd be handy if somebody posted his config files that deal with the authorisation from a working setup.

----------

## dfuse

There is something I'm wondering about, in some posts and in the guide peoply say postfix reload to reload the changes made in postfix conf files and somebody even states that restarting postfix won't pick up the changes made, but when I try /etc/init.d/postfix reload, I get an error message. When checking the man by typing /etc/init.d/postfix, I see that only restart is possible, reload is nowhere mentioned.

----------

## ikaro

my postconf is at least 3 times as big has the one you posted.

2 things , you are missing a lot, or I have added alot more ( which isnt true )

----------

## dfuse

In that case, can  you post your conf file please? Mine has roughly the same size as dodger10k's one. (without all the commented lines that come with the default conf file)

----------

## dodger10k

I´d also like to see your config then, regarding to the Virtual Mailhosting Guide it couldn´t be really that big. And I still got the feeling this might have to do something with this issue.

----------

## dodger10k

I´ve re-emerged courier and pam_mysql and checked all config sections again but still the same problem. 

Can anyone help?

----------

## dodger10k

I´ve turned debug on, maybe someone can find something in this:

 *Quote:*   

> 
> 
> Dec  8 12:51:50 [imapd] Connection, ip=[127.0.0.1]
> 
> Dec  8 12:51:50 [imapd] LOGIN: DEBUG: ip=[127.0.0.1], command=LOGIN
> ...

 

----------

## dodger10k

Anyone, pleeeease?  :Smile: 

----------

## ikaro

Here is my complete 'postconf' i hope this is what  you asked for.

As a side note: this isnt just postfix.

if you dont have this setup dont just copy & paste because that certenally wont fix it, however hope it helps in some way or another.

```

[root@Genbox:ikaro]$postconf

 :-  :)---\----\               \o/

                                ()

                                /\ 
```

----------

## dodger10k

Tnx for posting this, quite interesting  :Smile:  But anyway didn´t solve the problem. From my understanding the problem is courier not talking to mysql when authenticating. Postfix is talking to mysql fine when it comes to receive/send mails. This is working perfectly. So I´ll just check everything regarding the courier config again...

----------

## dodger10k

Checked everything again and still not able to find any mistakes within the configs... What the f*ck could it be? 

Two questions I thought about. How do the permissions of all the included files have to be set? Just in case... 

And I thought maybe it´s because of pam_mysql and just to make sure that this is ok maybe someone can check this:

 *Quote:*   

> 
> 
> www root # find / -name pam_mysql*
> 
> /var/db/pkg/sys-libs/pam_mysql-0.5
> ...

 

And still, I would worship any help to fix this  :Smile: 

----------

## ikaro

```

[root@Genbox:postfix]$locate *pam_mysql*

/lib/security/pam_mysql.so

/usr/share/doc/pam_mysql-0.5

/usr/share/doc/pam_mysql-0.5/Changelog.gz

/usr/share/doc/pam_mysql-0.5/CREDITS.gz

/usr/share/doc/pam_mysql-0.5/Readme.gz

/var/cache/edb/dep/sys-libs/pam_mysql-0.5

/var/cache/edb/dep/sys-libs/pam_mysql-0.4.7

```

```

[root@Genbox:postfix]$la /lib/security/pam_mysql.so

-rwxr-xr-x    1 root     root        17656 Aug 14 05:26 /lib/security/pam_mysql.so

```

----------

## dodger10k

locate gives me similar results (even some more within the distfiles but I guess that´s ok then) and the permissions for pam_mysql also look good here.... So that´s not the reason for this not working  :Sad: 

----------

## ikaro

you have something wrong / missing somewhere.

----------

## dfuse

Same thing here, I have the same settings as the one shown by ikaro. (locate and permissions)

Btw, what happened to the conf file of postfix by ikaro? I remember checking this morning and seeing a huge conf file, and now there's this funny drawing?

----------

## dodger10k

Ok I started over the guide again, reemerged everything, set every config up again but still the same problem... And more and more I simply don´t understand what I´m doing wrong here...

Hmmm some more testing... Is this ok as it is?

 *Quote:*   

> 
> 
> www postfix # ps ax | grep authdaemon
> 
>  2528 ?        S      0:00 /usr/lib/courier-imap/authlib/authdaemond.mysql start
> ...

 

----------

## Paulten

What about your /etc/courier-imap/authmysqlrc ?

----------

## dodger10k

Authmysqlrc looks like:

 *Quote:*   

> 
> 
> MYSQL_SERVER            localhost       
> 
> MYSQL_USERNAME          mailsql 
> ...

 

----------

## dodger10k

Ok I´ve changed "localhost" in authmysqlrc to "127.0.0.1" and now it´s talking to mysql, but:

 *Quote:*   

> 031209 19:12:05      39 Connect     Access denied for user: 'mailsql    @localhost' (Using password: YES)

 

grrrr   :Evil or Very Mad: 

----------

## dodger10k

Ok, when I pop3-connect then a db connect and ini is made:

 *Quote:*   

> 031209 19:22:21       3 Connect     mailsql@localhost on 
> 
>                       3 Init DB     mailsql

 

but no query is made and so login failes.

When I imap then even no connection to mysql is made.

I´d really like to understand what is going on here  :Sad: 

----------

## dfuse

Changing localhost to 127.0.0.1 doesn't do it for me, but I think I see an error in your authmysqlrc.

Does the path /var/run/mysql/mysqld.sock exist with you? Because my path

is /var/run/mysqld/mysqld.sock

I kinda hoped that would resolve our problem but nothing changed   :Sad: 

----------

## dodger10k

Found it, set it up and now everything is working.

Solved  :Smile: 

----------

## dfuse

Really? Good for you! 

Now I really have to get mine working....

Could you post the latest versions of your configs so I can compare mine?

PS: could you please remove the SOLVED after your topic since I have the same problem and mine isn't solved...

----------

## dfuse

I see, your problem got solved so that's it eh, not even a thanks

----------

## dodger10k

Sorry I forgot: THANKS to everyone helping me, especially ikaro  :Smile: 

I just changed two things in the authmysqlrc: MYSQL_SERVER to 127.0.0.1 instead of localhost and then I noticed that I didn´t uncomment the line MYSQL_CLEAR_PWFIELD clear. And then everything was running fine. 

Now even added amavisd+Spamassasin+clamav and it´s running fine  :Smile: 

If the changes to authmysqlrc don´t solve your problem let´s take a closer look to your configs, I´m sure we´ll solve you´re prob too  :Smile: 

----------

## dfuse

Hey,

I'm afraid my problem isn't typo related anymore, I checked all my conf's 5 times yesterday and did indeed find some more errors, but now they should all be solved. I did some debugging and I came to the conclusion that my TLS is not working (don't even know what tls is). 

The guide suggests to telnet to port 25 and test the settings with ELHO, but that is not enough, so I started a new thread:

https://forums.gentoo.org/viewtopic.php?p=697967#697967

If no one replies, I think I'll just re-emerge everything and start from scratch, because it's a really weird error I get (and oh so informative), didn't find much on google either about it.

----------

## dodger10k

I consider this thread as being solved then  :Smile: 

----------

