LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-27-2011, 02:52 AM   #1
badihi
LQ Newbie
 
Registered: Feb 2010
Posts: 29

Rep: Reputation: 0
Problem in logging of dovecot2


Hello there.
I'm using dovecot pop3 server in my website. I tried to create a virtual user system with mysql. But it didn't work.
Next I tried to debug my work with reading of dovecot log. I enabled logging in it by changing this values in /etc/dovecot/conf.d/10-logging.conf:

Code:
log_path=/var/log/dov
auth_verbose = yes
auth_debug = yes
auth_debug_passwords = yes
After that I tried to login to the pop3 via telnet and it failed as usual.
After I checked the log file (/var/log/dov), but it does not contain any information about that failed login. Only there was some information about starting up of dovecot!
Does any body know that what is the problem and why dovecot doesn't log that?

Thaks so much!
 
Old 05-27-2011, 06:07 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Normally, dovecot logs to /var/log/syslog, or /var/log/mail.log. Unfortunately, it sounds like you may have several errors in your setup. I can certainly understand the frustration you are feeling with this, but in order to try to help you, we would need more information than "it didn't work" and "failed as usual". I assume that you are trying to build a mail server, of which Dovecot is a part. What is the status of your mail server as a whole? What applications are you running (e.g. Postfix). Obviously without Dovecot you won't be receiving mail into an MUA like Thunderbird or Evolution, but can get you mail delivery to a virtual mailbox? Are you able to send mail? Please provide output from your logs, including the error messages.
 
Old 05-27-2011, 09:25 AM   #3
badihi
LQ Newbie
 
Registered: Feb 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hello and thanks for your reply. Yes, I'm trying to build a mail server. I use Postfix MTA to receive emails. And I think every thing is ready. My problem is dovecot!
I'm trying to build a virtual user mail system. So I saw the dovecot documentation and I had some good information. I changed the configuration of dovecot to working with mysql database. Here is the file that I changed:

/etc/dovecot/dovecot-sql.conf.ext:
Code:
# This file is opened as root, so it should be owned by root and mode 0600.
#
# http://wiki2.dovecot.org/AuthDatabase/SQL
#
# For the sql passdb module, you'll need a database with a table that
# contains fields for at least the username and password. If you want to
# use the user@domain syntax, you might want to have a separate domain
# field as well.
#
# If your users all have the same uig/gid, and have predictable home
# directories, you can use the static userdb module to generate the home
# dir based on the username and domain. In this case, you won't need fields
# for home, uid, or gid in the database.
#
# If you prefer to use the sql userdb module, you'll want to add fields
# for home, uid, and gid. Here is an example table:
#
# CREATE TABLE users (
#     username VARCHAR(128) NOT NULL,
#     domain VARCHAR(128) NOT NULL,
#     password VARCHAR(64) NOT NULL,
#     home VARCHAR(255) NOT NULL,
#     uid INTEGER NOT NULL,
#     gid INTEGER NOT NULL,
#     active CHAR(1) DEFAULT 'Y' NOT NULL
# );

# Database driver: mysql, pgsql, sqlite
driver = mysql

# Database connection string. This is driver-specific setting.
#
# HA / round-robin load-balancing is supported by giving multiple host
# settings, like: host=sql1.host.org host=sql2.host.org
#
# pgsql:
#   For available options, see the PostgreSQL documention for the
#   PQconnectdb function of libpq.
#   Use maxconns=n (default 5) to change how many connections Dovecot can
#   create to pgsql.
#
# mysql:
#   Basic options emulate PostgreSQL option names:
#     host, port, user, password, dbname
#
#   But also adds some new settings:
#     client_flags        - See MySQL manual
#     ssl_ca, ssl_ca_path - Set either one or both to enable SSL
#     ssl_cert, ssl_key   - For sending client-side certificates to server
#     ssl_cipher          - Set minimum allowed cipher security (default: HIGH)
#     option_file         - Read options from the given file instead of
#                           the default my.cnf location
#     option_group        - Read options from the given group (default: client)
#
#   You can connect to UNIX sockets by using host: host=/var/run/mysql.sock
#   Note that currently you can't use spaces in parameters.
#
# sqlite:
#   The path to the database file.
#
# Examples:
#   connect = host=192.168.1.1 dbname=users
#   connect = host=sql.example.com dbname=virtual user=virtual password=blarg
#   connect = /etc/dovecot/authdb.sqlite
#
connect = host=localhost dbname=mail user=root password=***


# Default password scheme.
#
# List of supported schemes is in
# http://wiki2.dovecot.org/Authentication/PasswordSchemes
#
default_pass_scheme = MD5

# passdb query to retrieve the password. It can return fields:
#   password - The user's password. This field must be returned.
#   user - user@domain from the database. Needed with case-insensitive lookups.
#   username and domain - An alternative way to represent the "user" field.
#
# The "user" field is often necessary with case-insensitive lookups to avoid
# e.g. "name" and "nAme" logins creating two different mail directories. If
# your user and domain names are in separate fields, you can return "username"
# and "domain" fields instead of "user".
#
# The query can also return other fields which have a special meaning, see
# http://wiki2.dovecot.org/PasswordDatabase/ExtraFields
#
# Commonly used available substitutions (see http://wiki2.dovecot.org/Variables
# for full list):
#   %u = entire user@domain
#   %n = user part of user@domain
#   %d = domain part of user@domain
#
# Note that these can be used only as input to SQL query. If the query outputs
# any of these substitutions, they're not touched. Otherwise it would be
# difficult to have eg. usernames containing '%' characters.
#
# Example:
#   password_query = SELECT userid AS user, pw AS password \
#     FROM users WHERE userid = '%u' AND active = 'Y'
#
password_query = \
  SELECT username, domain, password \
  FROM users WHERE username = '%n' AND domain = '%d'

# userdb query to retrieve the user information. It can return fields:
#   uid - System UID (overrides mail_uid setting)
#   gid - System GID (overrides mail_gid setting)
#   home - Home directory
#   mail - Mail location (overrides mail_location setting)
#
# None of these are strictly required. If you use a single UID and GID, and
# home or mail directory fits to a template string, you could use userdb static
# instead. For a list of all fields that can be returned, see
# http://wiki2.dovecot.org/UserDatabase/ExtraFields
#
# Examples:
#   user_query = SELECT home, uid, gid FROM users WHERE userid = '%u'
#   user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u'
#   user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u'
#
user_query = \
  SELECT home, uid, gid \
  FROM users WHERE username = '%n' AND domain = '%d'

# If you wish to avoid two SQL lookups (passdb + userdb), you can use
# userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll
# also have to return userdb fields in password_query prefixed with "userdb_"
# string. For example:
#password_query = \
#  SELECT userid AS user, password, \
#    home AS userdb_home, uid AS userdb_uid, gid AS userdb_gid \
#  FROM users WHERE userid = '%u'

# Query to get a list of all usernames.
iterate_query = SELECT username AS user FROM users
And I created a database named mail that contained a tables like this:

Code:
CREATE TABLE users (
    username VARCHAR(128) NOT NULL,
    domain VARCHAR(128) NOT NULL,
    password VARCHAR(64) NOT NULL,
    home VARCHAR(255) NOT NULL,
    uid INTEGER NOT NULL,
    gid INTEGER NOT NULL,
    active CHAR(1) DEFAULT 'Y' NOT NULL
);
And I added a record to this table and now the table is like this:
Code:
+----------+-------------------+----------------------------------+------+-------+-------+--------+
| username | domain            | password                         | home | uid   | gid   | active |
+----------+-------------------+----------------------------------+------+-------+-------+--------+
| info     | khanemashroote.ir | 61243c7b9a4022cb3f8dc3106767ed12 |      | 10000 | 10000 | Y      |
+----------+-------------------+----------------------------------+------+-------+-------+--------+
At the end, I tried to login via telnet(from my pc):

telnet khanemashroote.ir pop3:
Code:
+OK <7636.1306506194@mail.khanemashroote.ir>
user info@khanemashroote.ir
+OK
pass ahmad
-ERR authorization failed
And my logging configuration is in first post. Now the system doesn't work and dovecot doesn't log any thing for debug!

Now what is the problem?!!

Thanks!

Last edited by badihi; 05-27-2011 at 09:29 AM.
 
Old 05-27-2011, 01:13 PM   #4
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
I am not sure what is wrong from the output of your dovecot.conf. Have you tried turning on password debugging in Dovecot? It will provide you a lot more information as far as what it is trying to match and what it is pulling out of your SQL database as well as what is happening with the password match (note the password is an md5 of the password)

Below, I have provided the postfix-mysql-dovecot lookup statements that IO am using. I noticed that you are using the default ones. The only caveat with these is that when you log in it is username@domain, not just username, however these will support multiple, virtual domains.

Code:
user_query = SELECT '/var/vmail/%d/%n' as home, 'maildir:/var/vmail/%d/%n' as mail, 5000 AS uid, 8 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
# If you wish to avoid two SQL lookups (passdb + userdb), you can use
# userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll
# also have to return userdb fields in password_query prefixed with "userdb_"
# string. For example:
#password_query = \
#  SELECT userid AS user, password, \
#    home AS userdb_home, uid AS userdb_uid, gid AS userdb_gid \
#  FROM users WHERE userid = '%u'
password_query = SELECT username as user, password, '/var/vmail/%d/%n' as userdb_home, 'maildir:/var/vmail/%d/%n' as userdb_mail, 5000 as userdb_uid, 8 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
 
Old 05-27-2011, 03:05 PM   #5
badihi
LQ Newbie
 
Registered: Feb 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Hello there.
I think that you couldn't understand the problem completely. I changed the configuration to enable logging and finding a clue to solve the problem. Read the first post again please. But nothing is logged in the log file after the failing of login process.
I configured dovecot for logging but it doesn't do that. The problem is it. What's wrong here?
Thanks.
 
Old 05-27-2011, 03:32 PM   #6
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

Rep: Reputation: 73
Try to set the log_path = /tmp/dovecot.log
Its possible that dovecot can't create the log file /var/log/dovecot.log.

The other idea is to remove log_path and check only /var/log/messages or /var/log/mail.log, meaning to allow dovecot to use the normal logging system.
 
Old 05-27-2011, 05:01 PM   #7
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
robertjinx's post gave me the thought to make sure you check the permissions. The user, under which dovecot is operating, (mail?) needs to be able to write to the folder and file for your logs.
 
Old 05-28-2011, 01:13 AM   #8
badihi
LQ Newbie
 
Registered: Feb 2010
Posts: 29

Original Poster
Rep: Reputation: 0
Problem solved. Another program was running instead of dovecot!
Thanks to all!

Last edited by badihi; 05-28-2011 at 02:36 AM.
 
Old 05-28-2011, 05:29 AM   #9
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

Rep: Reputation: 73
LOL!!!!
 
  


Reply



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
problem in logging in. deepraj92 Linux - Newbie 1 10-29-2009 01:25 AM
logging out problem Cl0ud Linux - Newbie 2 12-07-2007 05:15 AM
Problem when logging RodPinar Linux - Software 1 05-11-2006 12:52 AM
Problem Logging In BigSAR Mandriva 8 03-11-2005 11:37 PM
problem logging in gchua Linux - General 3 10-11-2001 03:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration