PDA

View Full Version : Problems with postfix-mysql


Pelle
6th November 2005, 14:26
I have followered the tut:
http://howtoforge.com/virtual_postfix_mysql_quota_courier

I finished the tutorial with no problems, now I'm trying to test the mail system by sending a mail to a given email I have put in to the database!

It looks like there are severel problems, but the first is that postfix can not access the mysql database?

syslog:

Nov 6 05:22:44 houston2 postfix/smtpd[32212]: connect from xproxy.gmail.com[66.249.82.199]
Nov 6 05:22:45 houston2 postfix/proxymap[32213]: warning: connect to mysql server 127.0.0.1: #HY000Host 'gmlitconsultis' is not allowed to connect to this MySQL server
Nov 6 05:22:45 houston2 postfix/proxymap[32213]: warning: connect to mysql server 127.0.0.1: #HY000Host 'gmlitconsultis' is not allowed to connect to this MySQL server
Nov 6 05:22:45 houston2 postfix/trivial-rewrite[32214]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem
Nov 6 05:22:46 houston2 postfix/smtpd[32212]: warning: premature end-of-input on private/rewrite socket while reading input attribute name


How can I solve this, Have tried looking for solutions for the connect problem (found this http://forums.mysql.com/read.php?86,23619,23619#msg-23619 ) but dosent help, because the solution there was to create the database user, but I have.. and the password is correct!

Then the next problem I think I have a solution for:

/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem


If I look at this file then


user = mail_admin
password = mail_admin_password
dbname = mail
table = domains
select_field = 'virtual'
where_field = domain
hosts = 127.0.0.1


but in this table, 'virtual' dosent exist only the collumm "domain" do.
Should this bee domain instead?

falko
6th November 2005, 14:42
The table lookup problem is resulting from the problem that your user is not allowed to connect to the MySQL database.

Did you grant the correct privileges to that user? Did you run
FLUSH PRIVILEGES; afterwards? This is important because the changes become valid only after that command.

Pelle
6th November 2005, 17:33
Yes I used FLUSH PRIVILEGES;

Did it again... But no change...

I tried to logon with the user and pass from the console and it worked

houston2:/etc/postfix# mysql -u pureftpd -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3847 to server version: 4.1.11-Debian_4sarge2-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;

Pelle
6th November 2005, 17:44
Again I have tried to change the hosts with the domain for the server in mysql-*.cf files


Nov 6 08:59:49 houston2 postfix/smtpd[1462]: connect from zproxy.gmail.com[64.233.162.202]
Nov 6 08:59:49 houston2 postfix/proxymap[1463]: warning: connect to mysql server houston2.ustabilserverplads.dk: Can't connect to MySQL server on 'houston2.ustabilserverplads.dk' (111)
Nov 6 08:59:49 houston2 postfix/proxymap[1463]: warning: connect to mysql server houston2.ustabilserverplads.dk: Can't connect to MySQL server on 'houston2.ustabilserverplads.dk' (111)
Nov 6 08:59:49 houston2 postfix/trivial-rewrite[1464]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem
Nov 6 08:59:50 houston2 postfix/smtpd[1462]: warning: premature end-of-input on private/rewrite socket while reading input attribute name
Nov 6 08:59:50 houston2 postfix/smtpd[1462]: warning: problem talking to service rewrite: Success
Nov 6 08:59:50 houston2 postfix/master[1458]: warning: process /usr/lib/postfix/trivial-rewrite pid 1464 exit status 1
Nov 6 08:59:51 houston2 postfix/trivial-rewrite[1465]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,100): table lookup problem
Nov 6 08:59:52 houston2 postfix/smtpd[1462]: warning: premature end-of-input on private/rewrite socket while reading input attribute name
Nov 6 08:59:52 houston2 postfix/smtpd[1462]: warning: problem talking to service rewrite: Success
Nov 6 08:59:52 houston2 postfix/master[1458]: warning: process /usr/lib/postfix/trivial-rewrite pid 1465 exit status 1
Nov 6 08:59:52 houston2 postfix/master[1458]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling


any idea?


I have pureftpd-mysql using the same database, and here there is no problem for this to use the mysql!

falko
6th November 2005, 18:51
From your log file I see that Postfix tries to connect to MySQL on houston2.ustabilserverplads.dk instead of 127.0.0.1. So either you allow remote connections to that MySQL user, or you change the configuration so that Postfix tries to connect on 127.0.0.1.

Pelle
6th November 2005, 20:42
Forgot to mention that I changed the hosts on purpose, to see if it will make anydifferens!

But no, the same log file is being written just with 127.0.0.1 instead of houston2.ustabilserverplads.dk and still having problems.

falko
7th November 2005, 10:30
Please post the output of netstat -tap

Pelle
7th November 2005, 17:18
Here:


Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:imaps *:* LISTEN 20482/couriertcpd
tcp 0 0 *:tcpmux *:* LISTEN 13755/portsentry
tcp 0 0 *:20034 *:* LISTEN 13755/portsentry
tcp 0 0 *:pop3s *:* LISTEN 20393/couriertcpd
tcp 0 0 *:32771 *:* LISTEN 13755/portsentry
tcp 0 0 *:32772 *:* LISTEN 13755/portsentry
tcp 0 0 *:40421 *:* LISTEN 13755/portsentry
tcp 0 0 *:32773 *:* LISTEN 13755/portsentry
tcp 0 0 *:32774 *:* LISTEN 13755/portsentry
tcp 0 0 houston2.ustabils:10024 *:* LISTEN 18883/amavisd (mast
tcp 0 0 houston2.ustabils:10025 *:* LISTEN 27690/master
tcp 0 0 *:31337 *:* LISTEN 13755/portsentry
tcp 0 0 houston2.ustabils:mysql *:* LISTEN 15027/mysqld
tcp 0 0 *:ircd *:* LISTEN 13755/portsentry
tcp 0 0 *:systat *:* LISTEN 13755/portsentry
tcp 0 0 *:pop3 *:* LISTEN 30180/couriertcpd
tcp 0 0 *:5742 *:* LISTEN 13755/portsentry
tcp 0 0 *:imap2 *:* LISTEN 30164/couriertcpd
tcp 0 0 *:sunrpc *:* LISTEN 13755/portsentry
tcp 0 0 *:finger *:* LISTEN 13755/portsentry
tcp 0 0 *:netstat *:* LISTEN 13755/portsentry
tcp 0 0 *:www *:* LISTEN 970/apache2
tcp 0 0 *:54320 *:* LISTEN 13755/portsentry
tcp 0 0 *:sieve *:* LISTEN 13755/portsentry
tcp 0 0 *:27665 *:* LISTEN 13755/portsentry
tcp 0 0 *:ingreslock *:* LISTEN 13755/portsentry
tcp 0 0 *:ftp *:* LISTEN 20841/pure-ftpd (SE
tcp 0 0 170.70-86-143.re:domain *:* LISTEN 7263/named
tcp 0 0 houston2.ustabil:domain *:* LISTEN 7263/named
tcp 0 0 *:ssh *:* LISTEN 1435/sshd
tcp 0 0 *:nntp *:* LISTEN 13755/portsentry
tcp 0 0 *:socks *:* LISTEN 13755/portsentry
tcp 0 0 *:smtp *:* LISTEN 27690/master
tcp 0 0 *:12345 *:* LISTEN 13755/portsentry
tcp 0 0 houston2.ustabilser:953 *:* LISTEN 7263/named
tcp 0 0 *:12346 *:* LISTEN 13755/portsentry
tcp 0 0 *:https *:* LISTEN 970/apache2
tcp 0 0 *:635 *:* LISTEN 13755/portsentry
tcp 0 0 *:49724 *:* LISTEN 13755/portsentry
tcp 0 0 *:uucp *:* LISTEN 13755/portsentry
tcp 0 4096 170.70-86-143.rever:ssh port363.ds1-abc.a:10846 ESTABLISHED27449/1
tcp 0 0 170.70-86-143.rever:ssh port363.ds1-abc.a:10845 ESTABLISHED27447/0

falko
7th November 2005, 18:00
Ok, and what's in /etc/mysql/my.cnf?

Pelle
7th November 2005, 18:21
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
#
# For compatibility to other Debian packages that still use
# libmysqlclient10 and libmysqlclient12.
old_passwords = 1
#
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
#
# * Query Cache Configuration
#
query_cache_limit = 1048576
query_cache_size = 16777216
query_cache_type = 1
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = /var/log/mysql.log
#log = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log-slow-queries = /var/log/mysql/mysql-slow.log
#
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
log-bin = /var/log/mysql/mysql-bin.log
# See /etc/mysql/debian-log-rotate.conf for the number of files kept.
max_binlog_size = 104857600
#binlog-do-db = include_database_name
#binlog-ignore-db = include_database_name
#
# * BerkeleyDB
#
# According to an MySQL employee the use of BerkeleyDB is now discouraged
# and support for it will probably cease in the next versions.
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# If you want to enable SSL support (recommended) read the manual or my
# HOWTO in /usr/share/doc/mysql-server/SSL-MINI-HOWTO.txt.gz
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

falko
7th November 2005, 19:00
Looks ok, too. :confused:

Pelle
8th November 2005, 00:36
Hey,

I have increased it to be something with the postfix-mysql because it gives the same error if I just set the database up on another machine...

Should I remove the programs with the apt-get --purge remove atribute and start over or?

falko
8th November 2005, 09:32
Do you use Debian testing or unstable? Because in the tutorial I use Debian stable...

Pelle
8th November 2005, 20:20
I use stable (sarge)

oaky
9th November 2005, 21:44
I think I have a similar problem, but I am not sure... ;)

Nov 9 19:19:15 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:34:26 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:34:31 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:41:11 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:41:16 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:43:14 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:43:19 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:47:01 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:30 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:35 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:49:37 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:42 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:49:49 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:54 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:49:56 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:50:01 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:50:24 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:50:29 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]

I was thinking if "server=localhost" could be the problem, because it should be "server=127.0.0.1"?!?!

But in my /etc/mysql/my.cnf the "bind-adress" should be ok.

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

Could it be the problem? And if yes, how can I solve it?

Thanks

Michael

till
9th November 2005, 22:37
Have a look in the table mysql.user and mysql.db. Is the host field of the user mail_admin set to "localhost" or "%"? Have you restarted the mysql server after changing the permissions and adding the mail_admin user?

falko
10th November 2005, 00:20
I think I have a similar problem, but I am not sure... ;)

Nov 9 19:19:15 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:34:26 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:34:31 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:41:11 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:41:16 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:43:14 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:43:19 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:47:01 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:30 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:35 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:49:37 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:42 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:49:49 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:49:54 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:49:56 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:50:01 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]
Nov 9 19:50:24 m34s12 authdaemond.mysql: failed to connect to mysql server (server=localhost, userid=mail_admin )
Nov 9 19:50:29 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.187.132]

I was thinking if "server=localhost" could be the problem, because it should be "server=127.0.0.1"?!?!

But in my /etc/mysql/my.cnf the "bind-adress" should be ok.

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

Could it be the problem? And if yes, how can I solve it?

Thanks

Michael

Please check if your MySQL server is running.

oaky
10th November 2005, 07:56
m34s12:~# mysql -u mail_admin -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 159 to server version: 4.0.24_Debian-10sarge1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SELECT * from mail.users;
+--------------------------+---------------+----------+
| email | password | quota |
+--------------------------+---------------+----------+
| michael@m34s12.vlinux.de | mne0b8lAMlBBw | 10485760 |
| markus@m34s12.vlinux.de | Vh3YVzrrnNkRY | 10485760 |
+--------------------------+---------------+----------+
2 rows in set (0.00 sec)


Mysql is running and mail_admin has access to mail.users.

oaky
10th November 2005, 08:40
Have a look in the table mysql.user and mysql.db. Is the host field of the user mail_admin set to "localhost" or "%"? Have you restarted the mysql server after changing the permissions and adding the mail_admin user?
Before it was "localhost" and "localhost.localdomain". (howto)

I change it to "%" and stopped and restartet mysql.

falko
10th November 2005, 09:10
What's in /etc/courier/authmysqlrc? Do you have authmodulelist="authmysql" in /etc/courier/authdaemonrc?

oaky
10th November 2005, 09:28
What's in /etc/courier/authmysqlrc? Do you have authmodulelist="authmysql" in /etc/courier/authdaemonrc?
I tried it also with "MYSQL_SERVER 127.0.0.1". Do I have to restart any program?
MYSQL_SERVER localhost
MYSQL_USERNAME mail_admin
MYSQL_PASSWORD #######
MYSQL_PORT 0
MYSQL_DATABASE mail
MYSQL_USER_TABLE users
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD 5000
MYSQL_GID_FIELD 5000
MYSQL_LOGIN_FIELD email
MYSQL_HOME_FIELD "/home/vmail"
MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
#MYSQL_NAME_FIELD
MYSQL_QUOTA_FIELD quota



#
# The authentication modules that are linked into authdaemond. The
# default list is installed. You may selectively disable modules simply
# by removing them from the following list. The available modules you
# can use are: authcustom authcram authuserdb authldap authmysql authpam

authmodulelist="authmysql"

till
10th November 2005, 09:36
Please check the courier config files if you have any whitespces behind the values. Courier is very picky with that. I had this in one setup and searched for hours until i found the whitespace... Most other programs are ignoring whitespaces behind values in config files.

Example:

This will work:

MYSQL_USERNAME mail_admin

This wont work:

MYSQL_USERNAME mail_admin[WHITESPACE]

falko
10th November 2005, 09:47
I tried it also with "MYSQL_SERVER 127.0.0.1". Do I have to restart any program?

Yes:
/etc/init.d/courier-authdaemon restart

Is the uid/gid of user/group vmail really 5000?

oaky
10th November 2005, 09:52
Please check the courier config files if you have any whitespces behind the values. Courier is very picky with that. I had this in one setup and searched for hours until i found the whitespace... Most other programs are ignoring whitespaces behind values in config files.

Example:

This will work:

MYSQL_USERNAME mail_admin

This wont work:

MYSQL_USERNAME mail_admin[WHITESPACE]

I had whitespaces after mail_admin and password. :o

...but nothing has changed, do I have to restart any program?

till
10th November 2005, 09:58
Yes. Go to /etc/init.d/ and restart everything with courier in the name.

oaky
10th November 2005, 10:40
Yes. Go to /etc/init.d/ and restart everything with courier in the name.

Thank you, that was one problem! :)

But now I get:

"Unable to open the maildir for this account -- the maildir doesn't exist or has incorrect ownership or permissions."

I will search for this problem in the forum.... :confused:

falko
10th November 2005, 11:02
"Unable to open the maildir for this account -- the maildir doesn't exist or has incorrect ownership or permissions."


When does it happen? When you send an email to that account, or when you try to fetch emails with POP3/IMAP? In the latter case you first have to send an email to the account in question - the Maildir will then be created.

oaky
10th November 2005, 11:18
When does it happen? When you send an email to that account, or when you try to fetch emails with POP3/IMAP? In the latter case you first have to send an email to the account in question - the Maildir will then be created.

It happens when I want to fetch emails with sqwebmail.

I wrote allready an email to this account.

Should there be a folder in /home/vmail ? Because there is no folder.

Is there a log where I can see if the mail has arrived at my mailserver because I get no "undeliverable" message from my provider.

Nov 10 10:04:00 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.184.28]
Nov 10 10:04:09 m34s12 courierpop3login: LOGIN FAILED, ip=[::ffff:62.47.184.28]
Nov 10 10:05:25 m34s12 last message repeated 2 times
Nov 10 10:06:07 m34s12 postfix/trivial-rewrite[24810]: warning: do not list domain m34s12.vlinux.de in BOTH mydestination and virtual_mailbox_domains

falko
10th November 2005, 11:47
Is there a log where I can see if the mail has arrived at my mailserver because I get no "undeliverable" message from my provider. Yes, /var/log/mail.log.


Nov 10 10:06:07 m34s12 postfix/trivial-rewrite[24810]: warning: do not list domain m34s12.vlinux.de in BOTH mydestination and virtual_mailbox_domains

You have m34s12.vlinux.de in both mydestination and in the domains table in the database. Remove it from one of them and restart Postfix!

oaky
10th November 2005, 12:01
I removed it and restarted postfix...

mail.log

Nov 10 10:48:16 m34s12 postfix/smtpd[1789]: connect from warsl404pip7.highway.telekom.at[195.3.96.91]
Nov 10 10:48:16 m34s12 postfix/smtpd[1789]: 2B590333D5: client=warsl404pip7.highway.telekom.at[195.3.96.91]
Nov 10 10:48:16 m34s12 postfix/cleanup[1797]: 2B590333D5: message-id=<20051110104816.2B590333D5@m34s12.vlinux.de>
Nov 10 10:48:16 m34s12 postfix/qmgr[1702]: 2B590333D5: from=<michael.eichriedler@aon.at>, size=1030, nrcpt=1 (queue active)
Nov 10 10:48:16 m34s12 postfix/qmgr[1702]: 2B590333D5: to=<office@m34s12.vlinux.de>, relay=none, delay=0, status=deferred (delivery temporarily suspended: connect to 127.0.0.1[127.0.0.1]: server dropped connection without sending the initial SMTP greeting)
Nov 10 10:48:16 m34s12 postfix/smtpd[1789]: disconnect from warsl404pip7.highway.telekom.at[195.3.96.91]

Pelle
10th November 2005, 19:52
Hey!

Thank you very much for the help here! I cant explain the problem, but the solution have been:

Have seperate users for the database and restart!

Of some reason it helped when I created a new user!

I found that, because of some mistake when editing some of the mysql*.cf files I removed the user line! and then the /var/log/mail.log told me that it was the wrong username and password?!

And now my mail server works! thank you for the help!

NOTE! The user for the database I first used worked well and is still in use now, just only for pureftpd-mysql!

gus
12th November 2005, 15:54
Hi all

I've a Debian sarge testing server (i'd tried with stable too) and a month ago i'd to reinstall, but the server never was the same :(

in the past I was running with courier+postfix+mysql but at reinstallation i've the same error every time i try to connect via smtp (courier pop & imap are ok):

Nov <timestamp> lared postfix/trivial-rewrite[9542]: fatal: mysql:/etc/postfix/virtual.cf(0,100): table lookup problem

i've tried using mysql 4.1 and 5.0 (i don't remember what version of mysql-server was running before), it's all ok, all users, all passwords... i tried with root user too!!

any idea??

falko
12th November 2005, 16:13
Hi all

I've a Debian sarge testing server (i'd tried with stable too) and a month ago i'd to reinstall, but the server never was the same :(

in the past I was running with courier+postfix+mysql but at reinstallation i've the same error every time i try to connect via smtp (courier pop & imap are ok):

Nov <timestamp> lared postfix/trivial-rewrite[9542]: fatal: mysql:/etc/postfix/virtual.cf(0,100): table lookup problem

i've tried using mysql 4.1 and 5.0 (i don't remember what version of mysql-server was running before), it's all ok, all users, all passwords... i tried with root user too!!

any idea??

Make sure that the MySQL user and password are correct. Which Postfix version do you use? Run postconf -d | grep mail_version to find that out.

gus
12th November 2005, 17:59
server:/etc/postfix# postconf -d | grep mail_version
mail_version = 2.2.4

user & passwords are ok, i'd tryed loggin directly too:
server:/etc/postfix# mysql -u <user>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 101 to server version: 5.0.13-rc-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

falko
12th November 2005, 19:27
Ok, the format of the MySQL lookups changed from Postfix 2.1 to Postfix 2.2 (in Debian stable you have Postfix 2.1.5). What's in /etc/postfix/virtual.cf?

BTW, is your problem somehow related to this tutorial: http://www.howtoforge.com/virtual_postfix_mysql_quota_courier?

gus
12th November 2005, 22:20
virtual.cf contents:
user = <user_name>
password = -> I left blank password while errors
dbname = maildb
table = virtual
select_field = goto
where_field = address
hosts = server
server = computer name = LAN IP Address... don't rules with localhost and 127.0.0.1 too

My virtual table is:
CREATE TABLE virtual (
address varchar(255) NOT NULL default '',
goto varchar(255) NOT NULL default '',
UNIQUE KEY address (address)
) TYPE=MyISAM;

My guide to config was this (in spanish): http://lared.dsland.org/tmp/Postfix%20Courier%20y%20MySQL%20.txt that i got from http://valenciawireless.net/weblog/vw/staticpages/index.php?page=2003062417002455

My server was running with sarge testing from june to october (postfix was running perfect), stable in october (problems) and testing again three weeks ago (still having problems)

Now... How we name the baby?

falko
13th November 2005, 18:05
Try this in your virtual.cf:

user = <user_name>
password = <password>
hosts = server
dbname = maildb
query = SELECT goto FROM virtual WHERE address='%s' and restart Postfix.

gus
13th November 2005, 20:44
nothing happens

the problem is there yet

no incoming / outgoing mail throught postfix :(

I should change all .cf files 'cause all appears at /var/log/mail.err with a "table lookup problem" message

I think the problem isn't in postfix configuration, is in the postfix-mysql connector.

how could I downgrade postfix with aptitude?

thanks for your help

falko
13th November 2005, 21:50
I think the problem isn't in postfix configuration, is in the postfix-mysql connector.


I don't think it's a problem with the Postfix package (your Postfix package is from testing, not unstable), but rather with the configuration.
Did you have a look at this tutorial: http://www.howtoforge.com/virtual_postfix_mysql_quota_courier?

gus
13th November 2005, 23:25
I'll read it tomorrow after job...

thanks