HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Virtual users... Ubuntu 8.04 (http://www.howtoforge.com/forums/showthread.php?t=23797)

spaceuser 31st May 2008 17:01

Virtual users... Ubuntu 8.04
 
I'm running Ubuntu Server 8.04 as guest OS on VMWare server and installed the mailserver, Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Ubuntu 8.04 LTS). On page 4, it says
Quote:

12 Test Postfix

To see if Postfix is ready for SMTP-AUTH and TLS, run

telnet localhost 25

After you have established the connection to your Postfix mail server type

ehlo localhost

If you see the lines

250-STARTTLS

and

250-AUTH LOGIN PLAIN

everything is fine:

root@server1:/usr/local/sbin# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@server1:/usr/local/sbin#
When I do the same, I receive only this:

root@mailserver:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mailserver.vas.net ESMTP Postfix (Ubuntu)
ehlo localhost
250-mailserver.vas.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@mailserver:~#

Therefore I wonder why the 250-STARTTLS and 250-AUTH LOGIN PLAIN wont show up.

I would appreciate any comment on this.

TIA

thecaoticone 1st June 2008 10:19

From what you posted everything is there.

Quote:

When I do the same, I receive only this:

root@mailserver:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mailserver.vas.net ESMTP Postfix (Ubuntu)
ehlo localhost
250-mailserver.vas.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN

250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@mailserver:~#

spaceuser 1st June 2008 15:58

Uh... silly me!! Seem to need new glasses obviously :D

Thanx

spaceuser 1st June 2008 20:52

Since I've received a lot of the same errors that more folks around here, I did check them first to see if they would solve my problem, but they didn't.

When I tried to login using Squirrelmail I receive this in the /var/log/mail.err file:

Jun 1 20:35:01 mailserver imapd: authentication error: Input/output error
Jun 1 20:35:39 mailserver postfix/trivial-rewrite[11518]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:35:39 mailserver postfix/trivial-rewrite[11519]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:36:40 mailserver postfix/trivial-rewrite[11520]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:36:40 mailserver postfix/trivial-rewrite[11521]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:37:41 mailserver postfix/trivial-rewrite[11522]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:37:41 mailserver postfix/trivial-rewrite[11523]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:38:42 mailserver postfix/trivial-rewrite[11524]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:38:42 mailserver postfix/trivial-rewrite[11525]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:39:43 mailserver postfix/trivial-rewrite[11537]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:39:43 mailserver postfix/trivial-rewrite[11538]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:40:44 mailserver postfix/trivial-rewrite[11539]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:40:44 mailserver postfix/trivial-rewrite[11540]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:41:45 mailserver postfix/trivial-rewrite[11543]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:41:45 mailserver postfix/trivial-rewrite[11544]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:42:46 mailserver postfix/trivial-rewrite[11548]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:42:46 mailserver postfix/trivial-rewrite[11549]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:43:47 mailserver postfix/trivial-rewrite[11552]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:43:47 mailserver postfix/trivial-rewrite[11553]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:44:48 mailserver postfix/trivial-rewrite[11556]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:44:48 mailserver postfix/trivial-rewrite[11557]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:45:49 mailserver postfix/trivial-rewrite[11563]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:45:49 mailserver postfix/trivial-rewrite[11564]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:46:46 mailserver authdaemond: failed to connect to mysql server (server=localhost, userid=mail_admin): Access denied for user 'mail_admin'@'localhost' (using password: YES)
Jun 1 20:46:46 mailserver imapd: authentication error: Input/output error
Jun 1 20:46:50 mailserver postfix/trivial-rewrite[11569]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:46:50 mailserver postfix/trivial-rewrite[11570]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:47:51 mailserver postfix/trivial-rewrite[11595]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 20:47:51 mailserver postfix/trivial-rewrite[11596]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem


Anyone that could give me a hint or two?

PS... later. It seems that I may have missunderstood some courier and postfix config files. It says often "=mail_admin" and "=mail_admin_password". Should I replace these with my own of what? In Ubuntu I logged in as with a local user name/password, should I use that? Sorry for that question but I'm a newbie here, so please bare with me ;)

PS... even later! Changed all "mail_admin" to my name, which is a local user on this computer, and the "mail_admin_password" to my local password on all places mentioned in the HowTo article, but with no luck. Still gives me the following in the /var/log/mail.err:

Jun 1 21:20:16 mailserver imapd: authentication error: Input/output error
Jun 1 21:20:27 mailserver authdaemond: failed to connect to mysql server (server=localhost, userid=lars): Access denied for user 'lars'@'localhost' (using password: YES)
Jun 1 21:20:27 mailserver imapd: authentication error: Input/output error
Jun 1 21:20:53 mailserver postfix/trivial-rewrite[12101]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 21:21:54 mailserver postfix/trivial-rewrite[12102]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem
Jun 1 21:22:55 mailserver postfix/trivial-rewrite[12103]: fatal: proxy:mysql:/etc/postfix/mysql-virtual_domains.cf(0,lock|fold_fix): table lookup problem


TIA

thecaoticone 2nd June 2008 02:04

From the error it looks like the first problem is in /etc/postfix/mysql-virtual_domains.cf

I would re-check the entire file for errors. With this setup, voice of experience now talking,
any little typo will cause problems. It is usually the password. It must be identical ( MyPassworD is not the same as mypassword ).


Make sure MySQL is running by issuing the command:


netstat -tap | grep mysql


If it is running you should see something like:


tcp 0 0 localhost.localdo:mysql *:* LISTEN 6177/mysqld



As far as the user and password, you will set that in MySQL, page 1 of the guide. It can be anything you want. This will be your mail adminisrtator.



GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'who_ever_I_choose'@'localhost' IDENTIFIED BY 'My_Secret_PassWord';
GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'who_ever_I_choose'@localhost.localdomain' IDENTIFIED BY 'My_Secret_PassWord';
FLUSH PRIVILEGES;



The user and password you specify here is the same user and password you will need to use throughout the entire setup.

It will need to be indentical in the following files:

/etc/postfix/mysql-virtual_domains.cf

/etc/postfix/mysql-virtual_forwardings.cf

/etc/postfix/mysql-virtual_mailboxes.cf

/etc/postfix/mysql-virtual_email2email.cf

/etc/postfix/mysql-virtual_transports.cf

/etc/postfix/mysql-virtual_mailbox_limit_maps.cf

/etc/pam.d/smtp

/etc/postfix/sasl/smtpd.conf

/etc/courier/authmysqlrc




Also make sure that you changed the line in:


/etc/courier/authdaemonrc



from:

authmodulelist="authpam"


to:

authmodulelist="authmysql"



Hope this helped.

spaceuser 2nd June 2008 21:36

This is strange. I did find an typo, but after restarting everything, it still gives me the same error in Squirrelmail web page, ERROR:
ERROR: Connection dropped by IMAP server.


It's also strange that it says that I have a new mail in /var/mail/lars instead of /home/vmail (See below):

root@mailserver:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 5.0.51a-3ubuntu5.1 (Ubuntu)

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

mysql> INSERT INTO `domains` (`domain`) VALUES ('mydomain.xx.');
mysql> USE mail;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> INSERT INTO `domains` (`domain`) VALUES ('mydomain.xx');
mysql> quit
Bye
You have new mail in /var/mail/lars
root@mailserver:~#


When i use mailx to send a message to my domain, the /var/log/mail.log says:
Jun 2 21:27:37 mailserver postfix/pickup[25650]: D85FE122164: uid=0 from=<root>
Jun 2 21:27:37 mailserver postfix/cleanup[25777]: D85FE122164: message-id=<20080602192737.D85FE122164@mailserver.vas.net>
Jun 2 21:27:37 mailserver postfix/qmgr[25652]: D85FE122164: from=<root@mailserver.vas.net>, size=310, nrcpt=1 (queue active)
Jun 2 21:27:45 mailserver postfix/smtpd[25786]: connect from localhost[127.0.0.1]
Jun 2 21:27:45 mailserver postfix/smtpd[25786]: 4CFEE122137: client=localhost[127.0.0.1]
Jun 2 21:27:45 mailserver postfix/cleanup[25777]: 4CFEE122137: message-id=<20080602192737.D85FE122164@mailserver.vas.net>
Jun 2 21:27:45 mailserver postfix/qmgr[25652]: 4CFEE122137: from=<root@mailserver.vas.net>, size=756, nrcpt=1 (queue active)
Jun 2 21:27:45 mailserver postfix/smtpd[25786]: disconnect from localhost[127.0.0.1]
Jun 2 21:27:45 mailserver postfix/virtual[25789]: 4CFEE122137: to=<lars@mydomain.xx>, relay=virtual, delay=0.56, delays=0.04/0.39/0/0.13, dsn=5.1.1, status=bounced (unknown user: "lars@mydomain.xx")
Jun 2 21:27:45 mailserver postfix/cleanup[25777]: D71841221A5: message-id=<20080602192745.D71841221A5@mailserver.vas.net>
Jun 2 21:27:45 mailserver postfix/qmgr[25652]: D71841221A5: from=<>, size=2603, nrcpt=1 (queue active)
Jun 2 21:27:45 mailserver postfix/bounce[25790]: 4CFEE122137: sender non-delivery notification: D71841221A5
Jun 2 21:27:45 mailserver postfix/qmgr[25652]: 4CFEE122137: removed
Jun 2 21:27:45 mailserver amavis[25673]: (25673-03) Passed CLEAN, <root@mailserver.vas.net> -> <lars@mydomain.xx>, Message-ID: <20080602192737.D85FE122164@mailserver.vas.net>, mail_id: YnhavBpMFQn9, Hits: 1.862, size: 310, queued_as: 4CFEE122137, 7793 ms
Jun 2 21:27:46 mailserver postfix/smtp[25780]: D85FE122164: to=<lars@mydomain.xx>, relay=127.0.0.1[127.0.0.1]:10024, delay=8.3, delays=0.17/0.13/0.14/7.9, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 4CFEE122137)
Jun 2 21:27:46 mailserver postfix/qmgr[25652]: D85FE122164: removed
Jun 2 21:27:46 mailserver postfix/local[25792]: D71841221A5: to=<root@mailserver.vas.net>, relay=local, delay=0.23, delays=0.03/0.17/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
Jun 2 21:27:46 mailserver postfix/qmgr[25652]: D71841221A5: removed


The user email "lars@mydomain.xx" is proven to be inside the users table.

No errors in /var/log/mail.err for the above.

TIA

thecaoticone 3rd June 2008 05:47

The "ERROR: Connection dropped by IMAP server" is because there is no mail in /home/vmail/your_domain.com/lars.

For some reason it is not seeing your user.

Check the /etc/postfix/main.cf file for this line:


Code:

virtual_mailbox_base = /home/vmail
This line tells the system where mail should be delivered.


The way it should work is
/home
/vmail
/domain.com
/user





If that is right, check the Mail database for errors.

In the console do:

Code:

mysql -u root -p
(ENTER ROOT PASSWORD)

switch to the mail db
Code:

USE mail;
to display all domains
Code:

SELECT * FROM domains
to display all users
Code:

SELECT * FROM users
if everything is right
Code:

quit
then just to be safe do:

Code:

/etc/init.d/postfix reload

spaceuser 3rd June 2008 20:21

Thank you very much for your effort to help here... but my problem is still here.

My /etc/postfix/main.cf contains
virtual_mailbox_base = /home/vmail

My database looks like:
root@mailserver:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 103
Server version: 5.0.51a-3ubuntu5.1 (Ubuntu)

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

mysql> USE mail;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT * FROM domains
-> \G
*************************** 1. row ***************************
domain: mydomain.xx
1 row in set (0.00 sec)

mysql> SELECT * FROM users
-> \G
*************************** 1. row ***************************
email: lars@mydomain.xx
password: R6RfNRnuy0wDU
quota: 10485760
1 row in set (0.00 sec)

mysql> quit
Bye
root@mailserver:~#


The main problem here seem to be that the mail saves in /var/mail/lars:
lars@udesktop:~$ sudo -s
[sudo] password for lars:
root@udesktop:~# ssh -p 22 lars@192.168.7.40
lars@192.168.7.40's password:
Linux mailserver 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
You have new mail.
Last login: Tue Jun 3 20:05:18 2008
lars@mailserver:~$ sudo -s
[sudo] password for lars:
root@mailserver:~#


/Lars

thecaoticone 4th June 2008 07:58

The /var/mail/user is the Postfix default delivery location for system users.

This means for some reason Postfix is not using the Virtual System.


Below is my /etc/postfix/main.cf file. This is from the 8.04 guide where I updated last week. This config is currently in use on my mail server. Feel free to compare it to yours or copy it to see if it will work for you. There are 2 lines highlighted that will need to be changed if you copy it. The SPAM settings are optional.

Code:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = mail.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.domain.com, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps    $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps    $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings


##SPAM Settings


smtpd_recipient_restrictions =
  reject_unauth_pipelining,
  reject_non_fqdn_recipient,
  reject_unknown_recipient_domain,
  reject_rbl_client bl.spamcop.net,
  reject_rbl_client zen.spamhaus.org,


smtpd_sender_restrictions =
    permit_sasl_authenticated,
    permit_mynetworks,
    permit


smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions =
    permit_mynetworks,
    permit

Hope this helps.

spaceuser 5th June 2008 19:54

I did miss one line...
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf

I restarted postfix, and tried, but I couldn't log in. But then I tried to send a new message with, mailx lars@mydomain.xx, and now it turned up in /home/vmail, and it went ok to log in, but the mail or screen was totally empty. I did add both Subject and a little message.

Anyway this was a huge result anyway. Now I need to find out why the Squirrel mail screen went blank. Not even a menu as I expected.

Thanks a lot so far ;)


All times are GMT +2. The time now is 22:52.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.