How To Configure ISP Mail Server With Virtual Users/Domains On Centos 5.0 Using Postfix, Dovecot, MySQL, phpMyAdmin, TLS/SSL - Page 3

Testing and verifying your configuration:

Check for Postfix MySQL support

postconf -m
btree
cidr
environ
hash
ldap
mysql
nis
proxy
regexp
static
unix

If MySQL doesn't appear, check you installation and recompile postfix again.

 

Check for Postfix SMTP AUTH Support

telnet mail.example.co.tz 25

(S: = server, C: = client):

S: 220 mail.example.co.tz ESMTP Postfix
C: EHLO example.co.tz
S: 250-mail.example.co.tz
S: 250-PIPELINING
S: 250-SIZE 10240000
S: 250-VRFY
S: 250-ETRN
S: 250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI
S: 250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI

S: 250-XVERP
S: 250 8BITMIME
C: quit

Notice the two new lines?

250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI
250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI

These are the lines that Postfix issues when it offers the use of SMTP AUTH.

 

Check Postfix for TLS support

telnet mail.example.co.tz 25

This section applies for both NON-RPM and RPM installation.

In our HOWTO the smtpd daemon is in /usr/libexec/postfix/. So we do the following at the command line:

ldd /usr/libexec/postfix/smtpd
libsasl.so.7 => /usr/lib/libsasl.so.7 (0x4001e000)
libssl.so.2 => /lib/libssl.so.2 (0x4002a000)
libcrypto.so.2 => /lib/libcrypto.so.2 (0x40057000)
libdb-3.2.so => /lib/libdb-3.2.so (0x4011a000)
libnsl.so.1 => /lib/libnsl.so.1 (0x401c1000)
libresolv.so.2 => /lib/libresolv.so.2 (0x401d7000)
libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0x401ea000)
libc.so.6 => /lib/i686/libc.so.6 (0x401f1000)
libdl.so.2 => /lib/libdl.so.2 (0x4032c000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x40330000)
libpam.so.0 => /lib/libpam.so.0 (0x4035d000)
libgssapi_krb5.so.2 => /usr/kerberos/lib/libgssapi_krb5.so.2 (0x40365000)
libkrb5.so.3 => /usr/kerberos/lib/libkrb5.so.3 (0x40378000)
libk5crypto.so.3 => /usr/kerberos/lib/libk5crypto.so.3 (0x403d1000)
libcom_err.so.3 => /usr/kerberos/lib/libcom_err.so.3 (0x403e2000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

The smtpd daemon supports TLS. If you cannot find the libssl in the output you either built Postfix with static libraries or building Postfix with TLS didn't work. In this case you'll have to reconfigure your Postfix SOURCE, recompile or rebuild it, backup the data in /etc/postfix/ and reinstall the newly compiled Postfix binaries.

Next we will check if we can initiate a TLS session. We telnet to the server and check, if the string STARTTLS shows up when Postfix advertises it's capabilities. Then we simply type in STARTTLS and wait for Postfix to respond that it is ready to start TLS. This is how our successful telnet session should look like:

telnet mail.example.co.tz 25
S: 220 mail.example.co.tz ESMTP Postfix (1.1.5)
C: EHLO example.co.tz
S: 250-mail.example.co.tz
S: 250-PIPELINING
S: 250-SIZE 10240000
S: 250-VRFY
S: 250-ETRN
S: 250-STARTTLS - -TLS support
S: 250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI
S: 250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5 GSSAPI
S: 250-XVERP
S: 250 8BITMIME
C: STARTTLS
S: 220 Ready to start TLS

 

Sending a test mail from local machine

First we will verify that we are able to send mail on localhost to user test. This is the simpliest testcase that we have. If we succeed we will move on sending mails to test from a Mail client that does not run on our Postfix server.

mail [email protected]
Subject: Test from localhost
Test #1
.
Cc:
[[email protected]]#

 

Check for delivery of test mail on local machine

Telnet to pop3 to view if postfix delivered your mail:

telnet example.co.tz pop3
Trying 192.168.49.81...
Connected to mail.example.co.tz (192.168.49.81).
Escape character is '^]'.
+OK Dovecot ready.
user [email protected]
+OK
pass mwamaLis
+OK Logged in.
list
+OK 1 messages:
1 429
.
retr 1
+OK 429 octets
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: by mail.example.co.tz (Postfix, from userid 500)
id 74408C0AC6; Thu, 19 Jun 2008 10:47:52 +0300 (EAT)
To: [email protected]
Subject: Test from local
Message-Id: <[email protected]>
Date: Thu, 19 Jun 2008 10:47:52 +0300 (EAT)
From: [email protected] (User)
Test #1
.
]^
[[email protected]]$

View Appendix B for further testing test cases.

Finally fire-up the browser and go to http://mail.example.co.tz and enter the username and password and then click on Login. And enjoy playing with your mailserver.

 

phpMyAdmin Installation & Configuration:

PhpMyAdmin is a utility written in PHP which is intended to aid in the administration of a MySQL server, either locally, or over the WWW. It is maintained through the hard work and dedication of the folks at the phpMyAdmin project, and is currently available in 47 different languages.

 

Installation:

Download and extract phpMyAdmin package. Let's move the file to where we need it and change the name to something easier;

mv phpMyAdmin-2.11.6-english /var/www/html/phpadmin

Change directory to phpadmin root directory:

cd phpadmin/

Now, what we need to do is rename and edit the config.sample.inc.php file so it works with your setup.

cp -p config.sample.inc.php config.inc.php

So using vi, or whatever your favorite editor happens to be, open config.inc.php, find the following lines, and edit them as appropriate for your setup;

vi config.inc.php

Edit the following lines:

Enter this line with a password like word or phrase; example:

$cfg['blowfish_secret'] = 'bongo';

$cfg['Servers'][$i]['controluser'] = 'pma'; --MySQL username
$cfg['Servers'][$i]['controlpass'] = 'pmapass'; --MySQL password

Save and exit the file.

Create a virual alias in /etc/httpd/conf/httpd.conf by appending the following lines.

vi /etc/httpd/conf/httpd.conf
Alias /phpadmin /var/www/html/phpadmin
<Directory /var/www/html/phpadmin>
  Order allow,deny
  Allow from all
</Directory>

After this fire up a browser and enter http://127.0.0.1/phpadmin in the address bar. Enter the user name and password and start using it. Enjoy using phpMyAdmin for creating users, domain and aliases.

 

Appendix A:

Compiler options:

Options that Postfix needs in its Makefile are defined in environment variables such as CCARGS.
CCARGS: Provides additional arguments to the compiler. If your compiler allows special options or your supporting files are not located in default directories, indicate those options with this variable. The standard location for header files is the /usr/include directory. If your header files are located somewhere else, you have to tell the compiler where to look for them. The -I compiler option is used to specify additional directories where the compiler might find header files.

CCARGS='-I/usr/local/include/'

Use additional -I options for each additional directory the compiler should search.

Postfix uses conditional compilation during its build, depending on which libraries or other resources are available on your system. It defines certain macros based on what it discovers about your system or based on options you have selected. The -D option provides a way to define macros at the time you compile Postfix. Add-on packages for Postfix require that you define a particular macro to tell Postfix to include it when building.

For example, if you want to include support for MySQL, you define the HAS_MYSQL macro:

CCARGS='-DHAS_MYSQL'

Linker options are set in the AUXLIBS variable. After Postfix has compiled the object files, it links them together with required libraries into executable files. The standard location for system libraries is /usr/lib. To tell the linker to search additional directories for libraries, use the -L option:

AUXLIBS='-L/usr/local/lib'

You must also tell the linker which specific libraries to link in. The -l option is used to name specific libraries. The library files must be in a standard location or a directory indicated with the -L option. Library archive files are named starting with lib, followed by their name, followed by the extension, which is normally .a for static libraries and .so or .sl for shared objects or shared libraries. When you use the -l option, you leave off the initial lib and the extension of the library file. To link with the MySQL client library for example, where the library file is called libmysqlclient.a, the -l option is specified as follows:

AUXLIBS='-L/usr/local/lib -lmysqlclient

 

Appendix B

Delivering mail to a remote user (Relaying)

We telnet mail.example.co.tz 25. From a remote machine, telnet to 192.168.49.81 port 25. On a successful connection, postfix will come up and greats us with its smtpd banner. (If you fail to connect, check your firewall tables rules or if postfix is running.) Once connected, run the following commands.

(S: = server, C: = client):

S: 220 mail.example.co.tz ESMTP Postfix
C: EHLO example.co.tz
S: 250-mail.example.co.tz
S: 250-PIPELINING
S: 250-SIZE 10240000
S: 250-VRFY
S: 250-ETRN
S: 250-XVERP
S: 250 8BITMIME
C: mail from:<[email protected]>
S: 250 Ok
C: rcpt to:<[email protected]>
S: 250 Ok
C: data
S: 354 End data with <CR><LF>.<CR><LF>
C: Testmail relaying mail from [email protected] to [email protected]
C: Test #3
C: .
S: 250 Ok: queued as 84BA64078A
C: quit
S: 221 Bye

Share this page:

3 Comment(s)