Tuesday, 26 November 2013

How to add bunch of Subscriber And Moderator to mailing list in qmail vpopmail(EZMLM)


I have an old qmail vpopmail system at my office and here is how to installed it you can refer to http://sylvestre.ledru.info/howto/howto_qmail_vpopmail.php. Okay the problem is that I want to create many subscriber to the qmailadmin. You can manually create a subscriber by go to your qmailadmin -> Mailing Lists -> Show Subscribers. How about if we want to add many subscriber let’s say 500 or 1000 email address? Here is the step. I want to start the step how to create mailing list on qmailadmin.
1. Go to your qmail admin, it usually http://localhost/cgi-bin/qmailadmin/ and click New Mailing List

2. Enter the Mailing List Name , List owner email address and set the other option on the below. And after you finish click Add button


3. Your Mailing list suppose to be added successfully, and if you want to add an subscriber you must add them by clicking Add Subscriber button and add them one by one.



4. Waste of time and energy if you added them one by one right? How about if we have to add 100/ 200 email ? :(. Here is how to add many subscriber on the qmail vpopmail (ezmlm).
Go to your mailing list name
# cd /home/vpopmail/domains/example.net/sample-list/
in my case i am going to /home/vpopmail/domains/test.org/test
# cd /home/vpopmail/domains/test.org/test
I have create the mailing list on list.txt and i create then under /home/vpopmail/domains/test.org/test
# vi list.txt
test@test.com
test@another.com
testing@gmail.com
Now we need to run ezmlm-sub command just run
# /path/to/ezmlm-sub `pwd` < /path/to/file/full/of/addresses
in my case
# /usr/local/bin/ezmlm/ezmlm-sub `pwd`< /home/vpopmail/domains/test.org/test/list.txt
then, confirm the subscription:
# /path/to/ezmlm-list `pwd`
in my case

# /usr/local/bin/ezmlm/ezmlm-list `pwd`
testing@gmail.com
test@another.com
test@test.com
by the way, the default ezmlm path is /usr/local/bin/ezmlm
5. You should see the email on the subscriber
now how to add a bunch of moderator to the ezmlm mailing list?
Same as adding subscriber we need to go to your mailing list name
# cd /home/vpopmail/domains/example.net/sample-list/
in my case i am going to /home/vpopmail/domains/test.org/test
# cd /home/vpopmail/domains/test.org/test
And you ned to go to your moderator subdirectory
# cd /home/vpopmail/domains/example.net/sample-list/mod
in my case i am going to /home/vpopmail/domains/test.org/test/mod
# cd /home/vpopmail/domains/test.org/test/mod
I have create the moderator email on modlist.txt and i create then under /home/vpopmail/domains/test.org/test/mod
# vi modlist.txt
moderatortest@test.com
moderator2@another.com
moderator3@gmail.com
Please remember that the modlist.txt files has root permission you need to change it into vpopmail :vchkpw, if did not changes the ownership you cannot delete the moderator email address from your qmailadmin
# chown vpopmail.vchkpw modlist.txt
Now we need to run ezmlm-sub command on /home/vpopmail/domains/test.org/test/mod  just run
# /path/to/ezmlm-sub `pwd` < /path/to/file/full/of/addresses
in my case
# /usr/local/bin/ezmlm/ezmlm-sub `pwd`< /home/vpopmail/domains/test.org/test/mod/modlist.txt
then, confirm the subscription:
# /path/to/ezmlm-list `pwd`
in my case

# /usr/local/bin/ezmlm/ezmlm-list `pwd`
moderator3@gmail.com
moderator2@another.com
moderatortest@test.com
now you can see it on your qmailadmin -> Mailing Lists  -> Your mailing list name -> Show Moderators
Jan 09

What log files are available?
A qmail system is made up of several different programs, all running at the same time and doing their own little part of the overall "mail server" job. Each of these programs generally has its own log file, although if you are using syslog, the logs may be combined together. By understanding what each program does, you can easily tell which log file to look at when you need to check something.
The qmail-send program (which normally runs as a daemontools service called "qmail-send", or maybe just "qmail") manages the queue, and starts all delivery processes. The delivery programs run as children of qmail-queue, and therefore their output is contained with the qmail-queue output. If you have a problem with messages being "stuck" in the queue, this log file should be the place to look.
The qmail-smtpd program handles incoming SMTP traffic. If you have a problem with messages not being properly accepted or rejected from other machines, this log file should be the first place to look. Note that if you have multiple SMTP services on the machine (for example, a standard SMTP service on port 25, an SSL-enabled service on port 465, and an AUTH-only service on port 587) each service will have its own log file (again, unless they are being combined by the syslog mechanism.)
If you are using qmail-scanner as a way to have your incoming mail scanned for viruses and/or spam content, the qmail-scanner program also generates a log file of its own, which is totally separate from the qmail-smtpd log. You will find this file in your qmail-scanner directory, with the name qmail-queue.log. This will have a line-by-line description of everything the qmail-scanner program does.
If you are using simscan as a way to have your incoming mail scanned for viruses and/or spam content, you will normally find simscan’s logs in the qmail-smtpd service log.
If you are using clamav, the "clamd" program keeps its own log file. The /etc/clamd.conf file should have a "LogFile" line which tells you where the log is being written.
If you are using spamassassin, its "spamd" program also generates logs. By default it sends the logs to the syslog with the "mail" facility code, but by adding a "-s" option to spamd’s command line it is possible to send the log output to a file, or to the "standard error" channel (which makes it easy to run spamd under daemontools.) You should examine the command line for spamd in order to figure out where its log file will be found.
Any POP3 or IMAP servers will also be generating their own log entries. If you or your users are having a problem with POP3 or IMAP, those would be the place to look.

Installation of Apache-Tomcat with SSL


1.   Introduction : -

Tomcat is a Java Servlet container and web server from the Jakarta project of the Apache software foundation. A web server dishes out web pages in response to requests from a user sitting at a web browser. But web servers are not limited to serving up static HTML pages; they can also run programs in response to user requests and return the dynamic results to the users’ browser.  Tomcat is very good at this because it provides both Java servlet and JavaServerPages (JSP) technologies (in addition to traditional static pages and external CGI programming). The result is that Tomcat is good choice for use as a web server for many applications; also if you want a free servlet and JSP engine. It can be used standalone or used behind traditional web servers such as Apache httpd, with the traditional server serving static pages and Tomcat serving dynamic servlet and JSP requests.



2.   Required Packages:-

The packages which are being used in <My Company> for configuration are defined below. The package version of these may vary with coming updated version.

i)              apache-tomcat-6.0.33
ii)             jdk1.6.0_22
iii)            Red Hat Enterprise Linux 5.5


3.   Installation:-

i)              Install the RHEL 5.5 operating system on Hardware as defined by <My Company>  OS installation guide.
ii)             Create a tomcat user on Linux server for ownership of tomcat server. For security reasons we will be working in low privilege user mode instead of root user.

Run:

useradd –c  “Tomcat Web Server Account”  -m –d /home/tomcat –s /bin/bash tomcat

iv)           Download apache-tomcat-6.0.33 & jdk1.6.0_22 packages from Internet .


Move these packages into /home/tomcat directory and change ownership to tomcat user.

Run:-

$ cd /home/tomcat
$ chown –R tomcat.tomcat  /home/tomcat/apache-tomcat-6.0.33
$ chown  -R tomcat.tomcat /home/tomcat/jdk1.6.0_22
$ chmod -R u+x /home/tomcat/jdk1.6.0_22/bin



4.   Tomcat  Server Configuration:-

Set the ENVIROMENTAL VARIABLES in /home/tomcat/.bashrc file as defined below.

$ vi /home/tomcat/.bashrc
EDIT:-

#### JAVA & TOMCAT ENVIROMENT VARIABLE DEFINITIONS ####

JAVA_HOME=/home/tomcat/jdk1.6.0_22
CATALINA_HOME=/home/tomcat/apache-tomcat-6.0.33
CATALINA_BASE=/home/tomcat/apache-tomcat-6.0.33
PATH=$JAVA_HOME/bin:$CATALINA_HOME/bin:$PATH
export JAVA_HOME CATALINA_HOME PATH








5.    SSL Configuration:-

i)              Generate keystore file with self-signed Certificate

Tomcat currently operates only on JKS, PKCS11 or PKCS12 format keystores. The JKS format is Java's standard "Java KeyStore" format, and is the format created by the keytool command-line utility.
To create a new keystore from scratch, containing a single self-signed Certificate, execute the following from a terminal command line:

               $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA \
                -keystore /home/tomcat/.keystore


After executing this command, you will first be prompted for the keystore password. The default password used by Tomcat is "changeit" (all lower case), although you can specify a custom password if you like. You will also need to specify the custom password in the server.xml configuration file, as described later.

Next, you will be prompted for general information about this Certificate, such as company, contact name, and so on. This information will be displayed to users who attempt to access a secure page in your application, so make sure that the information provided here matches what they will expect.
Finally, you will be prompted for the key password, which is the password specifically for this Certificate (as opposed to any other Certificates stored in the same keystore file). You MUST use the same password here as was used for the keystore password itself. This is a restriction of the Tomcat implementation. (Currently, the keytool prompt will tell you that pressing the ENTER key does this for you automatically.)
If everything was successful, you now have a keystore file with a Certificate that can be used by your server.

ii)             Edit the tomcat configuration file
$ vi $CATALINA_BASE/conf/server.xml
Uncomment the following lines and add keystore file path and define keystore certificate password for SSL configuration for tomcat server. 


<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                               maxThreads="150" scheme="https" secure="true"
                               keystoreFile="/home/tomcat/.keystore" keystorePass="changeit"
                               clientAuth="false" sslProtocol="TLS" />


Comment out the following entries in server.xml file to disable the tomcat web server to run on http protocol.

              
            <! --
                   <Connector port="8080" protocol="HTTP/1.1"
                                    connectionTimeout="20000"
                                     redirectPort="8443" />
-- >



6.   Start and stop tomcat service to activate the configuration.


Stop tomcat service:

 $CATALINA_HOME/bin/shutdown.sh

Start tomcat service:

 $CATALINA_HOME/bin/startup.sh


7.   Enable Logging:-

Edit the server.xml file to enable logging for tomcat server.

$ vi $CATALINA_HOME/conf/server.xml

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"   prefix="localhost_access_log." suffix=".txt" pattern="combined" resolveHosts="false"/>

The Logs are generated in $CATALINA_HOME/logs directory which can be analyzed for troubleshooting of tomcat server.







8.   Configure Heap Size in Tomcat 6.0:-

Stop Tomcat server, set environment variable CATALINA_OPTS, and then restart Tomcat. Look at the file tomcat-install/bin/catalina.sh or catalina.bat for how this variable is used. For example,
 Edit $CATALINA_HOME/bin/catalina.sh
export CATALINA_OPTS="-Xms1024m -Xmx1024m -XX:PermSize=256m XX:MaxPermSize=1024m"

9.   Finalization:-


After completing these configuration changes, you must restart Tomcat as you normally do, and you should be in business. You should be able to access any web application supported by Tomcat via SSL. For example, try:

http://tomcat.apache.org/tomcat-6.0-doc/images/void.gif
http://tomcat.apache.org/tomcat-6.0-doc/images/void.gif
http://tomcat.apache.org/tomcat-6.0-doc/images/void.gif
http://tomcat.apache.org/tomcat-6.0-doc/images/void.gif
https://localhost:8443
http://tomcat.apache.org/tomcat-6.0-doc/images/void.gif

Tuesday, 19 November 2013

Creation of Global Address Book in Squirrelmail & Qmail

Qmail Server is running as mail server for my domain example.com. I have to create an address book in which all users mail ids will exist. When I login into squirrelmail web page and go to AddressBook link, by default no entry exist there. I will create Addressbook into this link for all users in domain example.com.  

The “vpasswd” file contains user information for all mail users. I will fetch data from”vpasswd” file and will create address book data using script “Address_Book” below.

[root@qmail ~]# cat /home/vpopmail/domains/example.com/vpasswd

vts:$1$iwli/pnP$6eAKRCs1yf3RdiiRKdGSJ1:1:0:V T Subramanian:/home/vpopmail/domains/example.com/0/vts:524288000S:2yff5cf9lZ
wzo:$1$/Y0lHFfy$a01lFirzDbARvkbASejfY/:1:0:Mumbai RO:/home/vpopmail/domains/example.com/wzo:524288000S:#WIDwxa9Vc
yksingh:$1$8x5rS9zL$i1K8J/ztVK0M52rMxVvpi0:1:0:Y K Singh:/home/vpopmail/domains/example.com/0/yksingh:524288000S:YPdadkN*R
ysaxena:$1$6nEpFJE0$aLB4dQutFy2siPxJX/ZzG1:1:0:Yogesh Saxena:/home/vpopmail/domains/example.com/ysaxena:524288000S:uhd0rjswq.


[root@qmail ~]# vi /scripts/Address_Book

#!/bin/bash

SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

rm -rf default_abook

for i in `cat /home/vpopmail/domains/example.com/vpasswd`
 do
   echo $i > users
   mailid=$(awk -F":" '{print $1}' users)
   nameid=$(awk -F":" '{print $5}' users)

   echo "$mailid|$nameid||$mailid@example.com|" >> default_abook
   cp -f default_abook  /opt/webmail/squirrelmail/data/default_abook
 done

[root@qmail ~]# chmod 755 /scripts/Address_Book

[root@qmail ~]# crontab  -e

00 02 * * *  /scripts/Address_Book

We will set the name of global address book in squirrelmail configuration.


[root@qmail ~]# cd /opt/webmail/squirrelmail
[root@qmail squirrelmail]# ./configure
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 on
S   Save data
Q   Quit

Command >> 6

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Address Books
1.  Change LDAP Servers
2.  Use Javascript Address Book Search          : false
3.  Global file address book                    : default_abook
4.  Allow writing into global file address book : false

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>3
Global file address book: default_abook
And Save and Exit.

The Global Book will be displayed into Squirrelmail webmail like below screen.