Postfix part 6 courier authdaemond,pop/ pops ,imap/imapssl ,Squirrelmail

yum groupinstall  'Development Tools'
yum install expect
yum install gdbm*
yum install libtool-ltdl libtool-ltdl-devel -y

wget ftp://ftp.muug.mb.ca/mirror/redhat/redhat/linux/6.2/en/os/i386/RedHat/RPMS/gdbm-devel-1.8.0-3.i386.rpm

yum install gdbm-devel-1.8.0-3.i386.rpm
yum install gdb

                Download Courier AUTHLIB                   
wget http://cznic.dl.sourceforge.net/project/courier/authlib/0.66.1/courier-authlib-0.66.1.tar.bz2
tar xjvf courier-authlib-0.66.1.tar.bz2
cd /home/salman/courier-authlib-0.66.1
./configure                        #nonroot user
make install                     # root user
make install-configure      # root user

[root@server1 sbin]# pwd
/usr/local/sbin
[root@server1 sbin]# ls -al
total 152
drwxr-xr-x.  2 root root  4096 Jun 21 23:52 .
drwxr-xr-x. 12 root root  4096 Jun 21 23:52 ..
-rwxr-xr-x.  1 root root   433 Jun 21 23:52 authdaemond
-rwxr-xr-x.  1 root root 10933 Jun 21 23:52 authenumerate
-rwxr-xr-x.  1 root root 10806 Jun 21 23:52 authpasswd
-rwxr-xr-x.  1 root root 15304 Jun 21 23:52 authtest
-rwxr-xr-x.  1 root root 29157 Jun 21 23:52 courierlogger
-rwxr-xr-x.  1 root root  3293 Jun 21 23:52 makeuserdb
-rwxr-xr-x.  1 root root  1620 Jun 21 23:52 pw2userdb
-rwxr-xr-x.  1 root root  4792 Jun 21 23:52 userdb
-rwxr-xr-x.  1 root root 48011 Jun 21 23:52 userdbpw
-rwxr-xr-x.  1 root root  2095 Jun 21 23:52 userdb-test-cram-md5

The entire process installs the binaries and configuration files. Binary named “authdaemond” under “/usr/local/sbin” directory is executing as the authlib daemon. This consults the /usr/local/etc/authlib/authdaemonrc configuration file.

Starting the authlib daemon            
  [root@server1 ~]# /usr/local/sbin/authdaemond start
Starting authdaemond at startup     
# ln -s /usr/local/sbin/authdaemond /etc/init.d/
# ln -s /etc/init.d/authdaemond   /etc/rc.d/rc3.d/S24authdaemond

Installing courier imap (Installs the IMAP and POP3 service)
yum install openssl openssl-devel
\\\\\   As   Non Root user
                Download Courier IMAP                   
wget http://cznic.dl.sourceforge.net/project/courier/imap/4.15/courier-imap-4.15.tar.bz2

tar -xjvf courier-imap-4.15.tar.bz2
cd  courier-imap-4.15
./configure
make
# make install
# make install-configure


[root@server1 authlib]# pwd
/usr/local/etc/authlib
[root@server1 authlib]# ls
authdaemonrc  authdaemonrc.dist
The authdaemon consults authdaemonrc file ,we can change values like number of daemons and other performance related values
Starting authdaemond
# /usr/local/libexec/courier-authlib/authdaemond start


[root@server1 libexec]# pwd
/usr/lib/courier-imap/libexec
 [root@server1 libexec]# ./pop3d.rc start

allow necessary ports and disable selinux ,also check mynetworks,inet_interfaces= in main.cf

POP-SSL
Change the file /usr/lib/courier-imap/etc/pop3d.cnf  contents like email, CN etc for certificate
 Run the script:-
#./usr/lib/courier-imap/share/mkpop3dcert
cert file will be in same dir of script
#ls -l /usr/lib/courier-imap/share/
 total 24
drwxr-xr-x. 4 root root 4096 Jun 22 00:25 man
-rwxr-xr-x. 1 root root 1292 Jun 24 22:56 mkdhparams
-rwxr-xr-x. 1 root root 2319 Jun 24 22:56 mkimapdcert
-rwxr-xr-x. 1 root root 2179 Jun 24 22:56 mkpop3dcert
-rw-------. 1 root root 5463 Jun 24 23:00 pop3d.pem

To run pop-ssl we have to run the script /usr/lib/courier-imap/libexec/pop3d-ssl.rc
=>
# ./pop3d-ssl.rc start

TO enable pop3 and pop3ssl at runlevel/ startup we have to create sym-links to /etc/init.d/  and rc.d/
 for   pop
 [root@server1 ~]# ln -s /usr/lib/courier-imap/libexec/pop3d.rc /etc/init.d/
for pop-SSL
[root@server1 ~]# ln -s /usr/lib/courier-imap/libexec/pop3d-ssl.rc  /etc/init.d/
#ls -l /etc/init.d/
 ..
lrwxrwxrwx. 1 root root    38 Jun 24 23:18 pop3d.rc -> /usr/lib/courier-imap/libexec/pop3d.rc 
lrwxrwxrwx. 1 root root    42 Jun 24 23:20 pop3d-ssl.rc -> /usr/lib/courier-imap/libexec/pop3d-ssl.rc
..
...
above will only create shortcut now creating symlink to symlink @ runlevel directory thats /etc/rc.d/
[root@server1 ~]# ls /etc/rc.d/
init.d/     rc0.d/      rc2.d/      rc4.d/      rc6.d/      rc.sysinit 

rc          rc1.d/      rc3.d/      rc5.d/      rc.local 

Running in runlevel 3 :

ln -s /etc/init.d/pop3d-ssl.rc /etc/rc.d/rc3.d/S20pop3dssl
the name should be unique "S20pop3dssl"   , note=>S=start 

Starting pop and pop-ssl
[root@server1 rc3.d]# ./S21pop3d start
[root@server1 rc3.d]# ./S20pop3dssl start
 Check if port is listening by netstat -antpl

Setting up imap and imap ssl to run at runlevel 3 at start up
ln -s /usr/lib/courier-imap/libexec/imapd.rc /etc/init.d/
ln -s /etc/init.d/imapd.rc /etc/rc.d/rc3.d/S22imapd
ln -s /usr/lib/courier-imap/libexec/imapd-ssl.rc /etc/init.d/ln -s /etc/init.d/imapd-ssl.rc /etc/rc.d/rc3.d/S23imapssld



Install squirrel mail
#yum install httpd   mod_ssl
#yum install squirrelmail
To  deal with ERROR: Could not complete request. Query: CREATE "Sent" Reason Given: Invalid mailbox name. Follow below steps:-
      * If you use Courier and SquirrelMail Fedora RPM (1.4.4-2) - remove $default_folder_prefix override from /etc/squirrelmail/config_local.php
#vim /etc/squirrelmail/config_local.php
<?php
/**
 * Local config overrides.
 *
 * You can override the config.php settings here.
 * Don't do it unless you know what you're doing.
 ....
#comment below line if it is not
#$default_folder_prefix         = '';
?>
Configuring squirrel mail :-
cd /usr/share/squirrelmail/config
 [root@server1 config]# ./conf.pl
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages
D.  Set pre-defined settings for specific IMAP servers
C   Turn color off
S   Save data
Q   Quit

Command >> D
SquirrelMail Configuration : Read: config.php
---------------------------------------------------------
Please select your IMAP server:
    bincimap    = Binc IMAP server
    courier     = Courier IMAP server
    cyrus       = Cyrus IMAP server
    dovecot     = Dovecot Secure IMAP server
    exchange    = Microsoft Exchange IMAP server
    hmailserver = hMailServer
    macosx      = Mac OS X Mailserver
    mercury32   = Mercury/32
    uw          = University of Washington's IMAP server
    gmail       = IMAP access to Google mail (Gmail) accounts
    quit        = Do not change anything
Command >>courier    <press enter>

Configuring  SSL for squirrelmail
Generating private key :-
openssl genrsa -des3 -out privatekey22.pem 2048
Generate SSL certificate
openssl req -new -key privatekey22.pem -out self-ssl.csr

Remove passphrase for nginx (optional)

# openssl rsa -in privatekey22.pem -out privatekey.key    


openssl x509 -req -days 365 -in self-ssl.csr -signkey privatekey.key -out selfsign.crt  


#vim /etc/httpd/conf.d/ssl.conf
 ##replace below value with --
SSLCertificateFile   /etc/httpd/ssl/selfsign.crt
SSLCertificateKeyFile /etc/httpd/ssl/privatekey.key


#service httpd start
#chkconfig httpd on


 




No comments:

Post a Comment