Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Courier IMAP] + MySQL authentication not working
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Bart B
n00b
n00b


Joined: 01 Jul 2002
Posts: 20
Location: Netherlands

PostPosted: Thu Jul 11, 2002 11:57 am    Post subject: [Courier IMAP] + MySQL authentication not working Reply with quote

Hi all,
I've been working on my Postfix+Courier+MySQL config for a couple of day's, but i still have problems.

Postfix now puts the mail in the right directory, Courier IMAP however is not working :'( . When I connect with it using kmail it give's an error that the login failed.

My relevant config files are:

authmysqlrc.dist
Code:

MYSQL_SERVER      localhost
MYSQL_USERNAME      postfix
MYSQL_PASSWORD      ***plain password***

MYSQL_SOCKET      /var/mysql/mysql.sock

#MYSQL_PORT      0

MYSQL_OPT      0

MYSQL_DATABASE      SERV_mailconfig

MYSQL_USER_TABLE   users
#MYSQL_CRYPT_PWFIELD   crypt
MYSQL_CLEAR_PWFIELD   password
DEFAULT_DOMAIN      bart-workstation
MYSQL_UID_FIELD      uid
MYSQL_GID_FIELD      gid
MYSQL_LOGIN_FIELD   id
MYSQL_HOME_FIELD   home
MYSQL_NAME_FIELD   realname
MYSQL_MAILDIR_FIELD   maildir
# MYSQL_QUOTA_FIELD   quota
MYSQL_WHERE_CLAUSE   'imapon=1'


authdeamonrc
Code:

authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=5
version=""
authdaemonvar=/var/lib/courier-imap/authdaemon


the database
Code:

mysql> USE SERV_mailconfig
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_SERV_mailconfig |
+---------------------------+
| users                     |
+---------------------------+
1 row in set (0.00 sec)

mysql> describe users;
+----------+----------------------+------+-----+---------+----------------+
| Field    | Type                 | Null | Key | Default | Extra          |
+----------+----------------------+------+-----+---------+----------------+
| idnr     | int(11)              |      | MUL | NULL    | auto_increment |
| id       | varchar(128)         |      | PRI |         |                |
| password | varchar(128)         |      |     |         |                |
| realname | varchar(128)         |      |     |         |                |
| uid      | smallint(5) unsigned |      |     | 8       |                |
| gid      | smallint(5) unsigned |      |     | 208     |                |
| home     | varchar(128)         |      |     | /       |                |
| maildir  | varchar(255)         |      |     |         |                |
| imapon   | tinyint(3) unsigned  |      |     | 1       |                |
+----------+----------------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)


in my log-files I see the following when I tried to connect:
mail.info
Quote:

Jul 11 13:15:45 bart-workstation imapd: Connection, ip=[::ffff:127.0.0.1]
Jul 11 13:15:50 bart-workstation imapd: LOGIN FAILED, ip=[::ffff:127.0.0.1]
Jul 11 13:15:52 bart-workstation imapd: DISCONNECTED, ip=[::ffff:127.0.0.1], headers=0, body=0


I don't understand why it is going wrong. Can someone help me :'(
_________________
deskktop: AMD64 X2 +3800, 2GB MEM, MSI K8N Neo4, nVidia 7600GT running 64-bit gentoo.
server: DUAL PIII-733Mhz, 1,5GB Kingston CAS2 @133Mhz, MSI6321 VIA Apollo Chipset.
Back to top
View user's profile Send private message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Thu Jul 11, 2002 12:03 pm    Post subject: Reply with quote

Can you establish a connection to mysql using courier's credentials? (to make sure that the password, etc. work?)

--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
Bart B
n00b
n00b


Joined: 01 Jul 2002
Posts: 20
Location: Netherlands

PostPosted: Thu Jul 11, 2002 12:10 pm    Post subject: Reply with quote

klieber wrote:
Can you establish a connection to mysql using courier's credentials? (to make sure that the password, etc. work?)
--kurt

I can. It's the same user&pass I use for Postfix
_________________
deskktop: AMD64 X2 +3800, 2GB MEM, MSI K8N Neo4, nVidia 7600GT running 64-bit gentoo.
server: DUAL PIII-733Mhz, 1,5GB Kingston CAS2 @133Mhz, MSI6321 VIA Apollo Chipset.
Back to top
View user's profile Send private message
Nitro
Bodhisattva
Bodhisattva


Joined: 08 Apr 2002
Posts: 661
Location: San Francisco

PostPosted: Thu Jul 11, 2002 12:33 pm    Post subject: Reply with quote

I have this setup on my box at home. Postfix and courier-imap look to mysql for all the info.

Try tail -f /var/log/mysql/<you log>.log. My inital problems were that it wasn't connecting to MySQL. I recompiled and it worked fine <shurg>.

I'm in a hurry, (gotta go like -10 mins ago). I can help you more when I get home like around 12:30 central US time.
_________________
- Kyle Manna

Please, please SEARCH before posting.

There are three kinds of people in the world: those who can count, and those who can't.
Back to top
View user's profile Send private message
Bart B
n00b
n00b


Joined: 01 Jul 2002
Posts: 20
Location: Netherlands

PostPosted: Thu Jul 11, 2002 12:51 pm    Post subject: Reply with quote

It seems mine isn't connecting as well... so... I recompile... something :'(

[edit]
YEE!!! IT's WORKING FINALLY!!!! thanks!
the PID file (or something) was stated incorrect.
Now I can die peacefully ;)
_________________
deskktop: AMD64 X2 +3800, 2GB MEM, MSI K8N Neo4, nVidia 7600GT running 64-bit gentoo.
server: DUAL PIII-733Mhz, 1,5GB Kingston CAS2 @133Mhz, MSI6321 VIA Apollo Chipset.
Back to top
View user's profile Send private message
cbrese
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jul 2002
Posts: 126
Location: San Diego, CA

PostPosted: Tue Aug 06, 2002 10:09 pm    Post subject: Reply with quote

I'm having a very simular problem, when I try to login with telnet I just get this
Code:

1 login jason test
1 NO Login failed.


If I tail /var/log/mail/current I get
Code:

Aug  6 14:52:29 [imapd] Connection, ip=[::ffff:127.0.0.1]
Aug  6 14:52:43 [imapd] LOGIN FAILED, ip=[::ffff:127.0.0.1]


I think courier isn't able to talk to mysql, but I don't know why. I can connect to mysql with the courier user/password and select data.

configs:

Code:

egrep ^[^#] authmysqlrc
MYSQL_SERVER            localhost
MYSQL_USERNAME          courier
MYSQL_PASSWORD          test
MYSQL_SOCKET            /tmp/mysql.sock
MYSQL_DATABASE          maildb
MYSQL_USER_TABLE        users
MYSQL_CRYPT_PWFIELD     crypt
MYSQL_CLEAR_PWFIELD     clear
MYSQL_UID_FIELD         uid
MYSQL_GID_FIELD         gid
MYSQL_LOGIN_FIELD       id
MYSQL_HOME_FIELD        home
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     maildir

egrep ^[^#] authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authcustom authcram authuserdb authmysql authpam"
daemons=5
version="authdaemond.mysql"
authdaemonvar=/var/lib/courier-imap/authdaemon



this is what I got when I started the services
Code:

# /etc/init.d/courier-imapd start
 * Starting courier-imapd...                                                                                        [ ok ]

# /etc/init.d/authdaemond start
 * Starting authdaemond.mysql...                                                                                    [ ok ]


I had to create /tmp/mysql.sock by doing this:
Code:

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

Was that the correct thing to do?

I'm running out of things to try and I realy want this to work.
Back to top
View user's profile Send private message
cbrese
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jul 2002
Posts: 126
Location: San Diego, CA

PostPosted: Tue Aug 06, 2002 10:31 pm    Post subject: Reply with quote

I just realized that the link I made to mysql.sock was wrong so I deleted it and did this:
Code:

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock


That didn't fix my problem though.
Back to top
View user's profile Send private message
cbrese
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jul 2002
Posts: 126
Location: San Diego, CA

PostPosted: Tue Aug 06, 2002 11:27 pm    Post subject: Reply with quote

I have some more information...

I can see that courier is connecting to mysql by looking in /var/log/mysql/mysql.log.

I'm still not able to connect though, I think the problem may have something to do with how I'm setting the password in mysql. This is what I did
Code:

update maildb.users set crypt=PASSWORD('test');

Is that the correct way?

If I set crypt to null then courier ends my telnet session.
Back to top
View user's profile Send private message
cbrese
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jul 2002
Posts: 126
Location: San Diego, CA

PostPosted: Tue Aug 06, 2002 11:52 pm    Post subject: Fixed Reply with quote

The password was the problem. I need to do this:
Code:

update maildb.users set crypt = encrypt('test');
Back to top
View user's profile Send private message
Beavis
n00b
n00b


Joined: 22 May 2002
Posts: 24
Location: Dirty Jersey

PostPosted: Thu Aug 08, 2002 1:05 pm    Post subject: Reply with quote

One problem I ran into was having too many spaces in the authmysqlrc file between the variables & settings

e.g.
MYSQL_SERVER localhost
instead of
MYSQL_SERVER localhost

apparently, you can only have one space/tab between them
Back to top
View user's profile Send private message
cbrese
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jul 2002
Posts: 126
Location: San Diego, CA

PostPosted: Thu Aug 08, 2002 3:28 pm    Post subject: Reply with quote

I have a few tabs/spaces between my variable names and values and it works fine, but you can't have any trailing spaces/tabs.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum