Tuesday, June 26, 2007

Qmail

mkdir /downloads
wget http://www.qmailrocks.org/downloads/qmailrocks.tar.gz
tar -zxvf qmailrocks.tar.gz
cd /downloads/qmailrocks/scripts/install/
./qmr_install_linux-s1.script
--> /var/qmail
--> users and groups
--> /usr/src/qmail
--> untars qmail and ucspi-tcp in /usr/src/qmail
--> untars daemontools in /package
--> /var/log/qmail
--> creates dir qmail-send qmail-smtpd qmail-pop3d under /var/log/qmail
--> /var/qmail/supervise
--> qmail-smtpd/log qmail-send/log qmail-pop3d/log

cd /downloads/qmailrocks/scripts/util/
./qmail_big_patches.script
--> jumbo patches for qmail

=========================
BUILD QMAIL
=========================

hostname --fqdn
cd /usr/src/qmail/qmail-1.03
make man && make setup check
--> populates /var/qmail
./config-fast linux.box.com
--> populates /var/qmail/control

=========================
build ucspi-tcp
=========================

cd /usr/src/qmail/ucspi-tcp-0.88/
patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
output: patching file error.h
make && make setup check

=========================
build daemontools.
=========================
cd /package/admin/daemontools-0.76/src
patch < /downloads/qmailrocks/patches/daemontools-0.76.errno.patch
output: patching file error.h
cd /package/admin/daemontools-0.76
package/install

/command/svscanboot
svscan /service

========================
Autoresponder
========================

cd /downloads/qmailrocks
tar zxvf autorespond-2.0.5.tar.gz
cd autorespond-2.0.5
make && make install

========================
Vpopmail
========================

cd /downloads/qmailrocks
tar zxvf vpopmail-5.4.13.tar.gz
cd vpopmail-5.4.13
./configure --enable-logging=p
make && make install-strip

========================
Vqadmin
========================

cd /downloads/qmailrocks
tar zxvf vqadmin-2.3.6.tar.gz
cd vqadmin-2.3.6
./configure --enable-cgibindir=/var/www/cgi-bin --enable-htmldir=/var/www/html
make && make install-strip

mkdir /var/www/cgi-bin/vqadmin

httpd.conf
-------------------------------------------------------

deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow


vi /var/www/cgi-bin/vqadmin/.htaccess
-------------------------------------------------------
AuthType Basic
AuthUserFile /var/www/vqadmin.passwd
AuthName vQadmin
require valid-user
satisfy any

htpasswd -c /var/www/vqadmin.passwd admin
chmod 644 /var/www/vqadmin.passwd
chown vpopmail:vchkpw /var/www/cgi-bin/vqadmin/vqadmin.cgi

http://10.5.1.100/cgi-bin/vqadmin/vqadmin.cgi

/home/vpopmail/bin/vadddomain anecho.net

========================
Maildrop
========================

cd /downloads/qmailrocks
tar zxvf maildrop-1.6.3.tar.gz
cd maildrop-1.6.3

./configure --prefix=/usr/local --exec-prefix=/usr/local --enable-maildrop-uid=root --enable-maildrop-gid=vchkpw --enable-maildirquota

make && make install-strip && make install-man

========================
Qmailadmin
========================

cd /downloads/qmailrocks
tar zxvf qmailadmin-1.2.9.tar.gz
cd qmailadmin-1.2.9
./configure --enable-cgibindir=/var/www/cgi-bin --enable-htmldir=/var/www/html
make && make install-strip

http://10.5.1.100/cgi-bin/qmailadmin
fpostmaster account and password for the domain that you created a while back using Vqadmin


========================
Finalizing Qmail
========================

/downloads/qmailrocks/scripts/finalize/linux/finalize_linux.script

vi /var/qmail/supervise/qmail-pop3d/run
change "mail.example.com" to linux.box.com

vi /var/qmail/supervise/qmail-smtpd/run
change "mail.example.com" to linux.box.com

qmailctl stop

echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
qmailctl cdb


-----------------------
system aliases
-----------------------
echo mailadm > /var/qmail/alias/.qmail-root
echo mailadm > /var/qmail/alias/.qmail-postmaster
echo mailadm > /var/qmail/alias/.qmail-mailer-daemon
ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
chmod 644 /var/qmail/alias/.qmail*

=========================
Disabling Sendmail
=========================
service sendmail stop
mv /usr/lib/sendmail /usr/lib/sendmail.old
mv /usr/sbin/sendmail /usr/sbin/sendmail.old
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

=========================
Starting qmail
=========================
- checking the installation
/downloads/qmailrocks/scripts/util/qmr_inst_check
you should get "congratulations" message

qmailctl start

=========================
Courier-imap/imaps
=========================

Courier-imap along with Courierpassd, Courier-authlib

Courier IMAP authentication with "vchkpw"
Courierpassd is a utility that allows users to change their mailbox passwords remotely.

-----------------------
courier-authlib
-----------------------
cd /downloads/qmailrocks/
tar jxvf courier-authlib-0.55.tar.bz2
cd courier-authlib-0.55
./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authldap --without-authmysql --disable-root-check --with-ssl --with-authchangepwdir=/usr/local/libexec/authlib --with-redhat

make && make check
make install-strip && make install-configure

vi /etc/rc.local
Add the following line:
/usr/local/sbin/authdaemond start

-----------------------
Courier IMAP
-----------------------
cd /downloads/qmailrocks/
tar jxvf courier-imap-4.0.2.tar.bz2
useradd lino
chown -R lino:root courier-imap-4.0.2
cd /downloads/qmailrocks/courier-imap-4.0.2
su lino
./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authldap --without-authmysql --disable-root-check --with-ssl --with-authchangepwdir=/usr/local/libexec/authlib --with-redhat
make && make check


Now we will exit out of our NON-ROOT USER and go back to being root...
exit
make install-strip && make install-configure

==>
-----------------------
SSL certificate for the IMAP-SSL server
-----------------------

vi /usr/local/etc/imapd.cnf
emailAddress=postmaser@linux.box.com

/usr/local/sbin/mkimapdcert
--> it creates /usr/local/share/imapd.pem

vi /usr/local/etc/imapd
IMAPDSTART=YES

vi /usr/local/etc/imapd-ssl
IMAPDSSLSTART=YES
TLS_CERTFILE=/usr/local/share/imapd.pem

vi /usr/local/etc/authlib/authdaemonrc
# Comment out this line
# authmodulelist="authuserdb authpam authcustom authvchkpw"
# copy the below line
authmodulelist="authvchkpw"

cp /usr/local/libexec/imapd.rc /etc/rc.d/init.d/imap
cp /usr/local/libexec/imapd-ssl.rc /etc/rc.d/init.d/imaps

Now let's start up Authdaemond, IMAP and IMAPS.

/usr/local/sbin/authdaemond stop
/usr/local/sbin/authdaemond start
/etc/rc.d/init.d/imap stop
/etc/rc.d/init.d/imaps stop
/etc/rc.d/init.d/imap start
/etc/rc.d/init.d/imaps start


If you run
# nmap localhost
you should see both 143 and 993 now open and listening.
Now let's test it...

# telnet localhost 143
a login madunix@box.com madunix
a OK LOGIN Ok. (successful login!)
a logout

you can configure a mail client such as Outlook to test both the IMAP and IMAP-SSL connetion to your server.

------------------------------
Courierpassd
------------------------------

Note: Courierpassd will require that port 106 be open to at least local traffic (traffic from 127.0.0.1)

# cd /downloads/qmailrocks
# tar zxvf courierpassd-1.1.0-RC1.tar.gz
# cd courierpassd-1.1.0-RC1
# ./configure
==>
# make && make install

We are going to configure Xinetd to run courierpassd.

# cd /etc/xinetd.d
# vi courierpassd
service courierpassd
{
port = 106
socket_type = stream
protocol = tcp
user = root
server = /usr/local/sbin/courierpassd
server_args = -s imap
wait = no
only_from = 127.0.0.1
instances = 4
disable = no
}


# vi /etc/services
courierpassd 106/tcp #for /etc/xinetd.d/courierpassd

# /etc/rc.d/init.d/xinetd restart

# telnet localhost 106
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
200 courierpassd v0.30 hello, who are you?
user madunix@box.com
200 Your password please.
pass madunix
200 Your new password please.
newpass n0uresh
200 Password changed, thank-you.
quit
200 Bye.
Connection closed by foreign host.

------------------------------
Squirrelmail
------------------------------

--> check whether PHP is installed

# cd /var/www/html
# vi test.php
phpinfo();
?>

http://10.5.1.100/test.php

search for these options:
--enable-track-vars
--enable-force-cgi-redirect
--with-gettext
--with-mysql

vi /etc/php.ini
# search for this string
file_uploads = On

# rpm -evv squirrelmail
# cd /downloads/qmailrocks
# tar -jxvf squirrelmail-1.4.8.tar.bz2
# mv squirrelmail-1.4.8 webmail
# mkdir /var/sqattachements
# chown -R apache:apache /var/sqattachements
# cd webmail
# chown -R apache:apache data
# cd config
# ./conf.pl

--> For 2. Server Settings
Command>> 2

1. Domain : 10.5.1.100
2. Invert Time : false
3. Sendmail or SMTP : SMTP

--> For IMAP settings
Command>> A

4. IMAP Server : localhost
5. IMAP Port : 143
6. Authentication type : login
7. Secure IMAP (TLS) : false
8. Server software : other
9. Delimiter : detect

--> B. Update SMTP Settings
Command>> B

4. SMTP Server : localhost
5. SMTP Port : 25
6. POP before SMTP : false
7. SMTP Authentication : login
8. Secure SMTP (TLS) : false

--> Save data
Command >> S

# mv webmail/ /var/www/html

# http://10.5.1.100/webmail

--> download change_password plugin from squirrelmail.org

# tar -zxvf change_pass-2.7-1.4.x.tar.gz
# cd /var/www/html/webmail/plugins
# cp -r /downloads/qmailrocks/change_pass .
# cd /var/www/html/webmail/config
# ./conf.pl

Choose the option for "plugins".
--> add plugin "change_pass"

=======================
Checking/Installing Perl Modules
=======================

You will need these Perl Modules to work for Spamassassin and Qmail-Scanner
Digest::SHA1
Digest::HMAC
Net::DNS
Time::HiRes
HTML::Tagset
HTML::Parser
Pod::Usage
Parse::Syslog
Statistics::Distributions

You will also need these other packages:
perl-suidperl
unzip

How do I know if my server has these perl modules?
/downloads/qmailrocks/scripts/util/check_perlmods.script


==========================
Clam Anti Virus
==========================
cd /downloads/qmailrocks/
rpm -Uvh clamav-0.87-1.i386.rpm
rpm -Uvh clamav-devel-0.87-1.i386.rpm

# vi /etc/clamd.conf
LogFile /var/log/clamav/clamd.log
"LogTime" - should be uncommmented.
"LogSyslog" - should be uncommented.
#User clamav --> Comment it out, add the below
User qscand
"ScanMail" - should be uncommented.

Now we are going to create the qscand user that ClamAV

# useradd -c "Qmail-Scanner Account" -s /bin/false qscand
# chown -R qscand:qscand /var/log/clamav/
# /etc/init.d/clamd stop
# /etc/init.d/clamd start

--> Update with the latest virus definiations

# touch /var/log/clamav/clam-update.log
# chown -R qscand:qscand /var/log/clamav/
# /usr/bin/freshclam -l /var/log/clamav/clam-update.log

ClamAV update process started at Sun Oct 24 23:36:22 2004
main.cvd is up to date (version: 27, sigs: 23982, f-level: 2, builder: tomek)
daily.cvd is up to date (version: 549, sigs: 1583, f-level: 3, builder: ccordes)


--> run update of virus definitions at 1:25 am
# crontab -e
25 1 * * * /usr/bin/freshclam --quiet -l /var/log/clamav/freshclam.log

--. Clam AV quarantines the e-mail in /var/spool/qmailscan/quarantine
--> Clamd runs on port 3310

==================
Spamassassin
==================
--> Spamassassin utilizes port 783

# rpm -e spamassassin

# cd /downloads/qmailrocks/perlmods/rpms/
# rpm -Uvh perl-Mail-SpamAssassin-3.0.2-1.i386.rpm

--> Now let's install the Spamassassin RPMs
# cd /downloads/qmailrocks/
# rpm -Uvh spamassassin-3.0.2-1.i386.rpm
# rpm -Uvh --nodeps spamassassin-tools-3.0.2-1.i386.rpm

# groupadd spamd
# useradd -g spamd -s /home/spamd spamd

# vi /etc/sysconfig/spamassassin
SPAMDOPTIONS="-x -u spamd -H /home/spamd -d"

# vi /etc/mail/spamassassin/local.cf
required_hits 5

# /etc/rc.d/init.d/spamassassin start
# ps aux | grep spamd

# chkconfig --level 35 clamd on
# chkconfig --level 35 spamassassin on

====================================
qmail-scanner w/qms-analog
====================================

. Qms-analog incorporated the widely used qmail-scanner-st patch but it also adds some cool reporting functionality as well which we will utilize later in this installation guide

# cd /downloads/qmailrocks
# tar zxvf qmail-scanner-1.25.tgz
# tar zxvf qms-analog-0.4.2.tar.gz
# cd qms-analog-0.4.2
# make all

# cp qmail-scanner-1.25-st-qms-20050219.patch /downloads/qmailrocks/qmail-scanner-1.25/
# cd /downloads/qmailrocks/qmail-scanner-1.25
# patch -p1 qmail-scanner-1.25-st-qms-20050219.patch

Monday, June 25, 2007

Adding common MS Windows Fonts to 10g Reports server on UNIX OS

Cross-Platform issues when you develop Reports on Windows AS ,
and deploy it on Linux AS.

Backup the files/direcories before your work with it

$ORACLE_HOME/guicommon/tk/admin/AFM
$ORACLE_HOME/guicommon/tk/admin/TTF
-------------------------------------------------------------------
Modifies the following files:

$ORACLE_HOME/guicommon/tk/admin/uiprint.txt
dummy:PostScript:2:dummy printer for PDF output:default.ppd:
----------------------------------------------------
$ORACLE_HOME/guicommon/tk/admin/uifont.ali
Comment out any font aliases found under the sections [ Global ] , [ Printer:PostScript1 ] and [PDF] e.g.
The order here is important, the plain font alias must be last in the PDF subset list)
[ PDF:Subset ]
Arial..Italic.Bold.. = "arialbi.ttf"
Arial...Bold.. = "arialbd.ttf"
Arial..Italic... = "ariali.ttf"
Arial..... = "arial.ttf"
-----------------------------------------

$ORACLE_HOME/guicommon/tk/admin/PPD/datap462.ppd
*DefaultFont: Arial
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*%Font Arial: Standard "(001.004)" Standard ROM
*%Font Arial-Italic: Standard "(001.004)" Standard ROM
*%Font Arial-Bold: Standard "(001.004)" Standard ROM
*%Font Arial-BoldItalic: Standard "(001.004)" Standard ROM
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*Font Arial: Special "(001.001)" Special ROM
*Font Ariali: Special "(001.001)" Special ROM
*Font Arialbd: Special "(001.001)" Special ROM
*Font Arialbi: Special "(001.001)" Special ROM
----------------------------------------------------

screenprinter.ppd
*DefaultFont: Arial
*Font Arial: Standard "(001.001)" Standard ROM
*Font Ariali: Standard "(001.001)" Standard ROM
*Font Arialbd: Standard "(001.001)" Standard ROM
*Font Arialbi: Standard "(001.001)" Standard ROM

---------------------------------------------------
$ORACLE_HOME/bin/reports.sh
make sure you define REPORTS_PATH=$REPORTS_PATH:$ORACLE_HOME/guicommon/tk/admin/TTF; export REPORTS_PATH

RW=$ORACLE_HOME/reports; export RW
#REPORTS_PATH=$REPORTS_PATH:$ORACLE_HOME/guicommon/tk/admin/TTF:$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo:$ORACLE_HOME/reports/integ:$ORACLE_HOME/reports/printers:${REPORTS_PATH}; export REPORTS_PATH
#REPORTS_PATH=$REPORTS_PATH:$ORACLE_HOME/guicommon/tk/admin/TTF; export REPORTS_PATH
#REPORTS_PATH=$ORACLE_HOME/guicommon/tk/admin/TTF; export REPORTS_PATH
REPORTS_PATH=$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo:/home/oracleas/OraHome_1/guicommon/tk/admin/PPD:/home/oracleas/OraHome_1/guicommon/tk/admin/AFM:$REPORTS_PATH:$ORACLE_HOME/guicommon/tk/admin/TTF:$ORACLE_HOME/reports/integ:$ORACLE_HOME/reports/printers:${REPORTS_PATH}; export REPORTS_PATH
REPORTS_TMP=/tmp; export REPORTS_TMP
REPORTS_NO_DUMMY_PRINTER=TRUE; export REPORTS_NO_DUMMY_PRINTER
REPORTS_TAGLIB_URI=/WEB-INF/lib/reports_tld.jar; export REPORTS_TAGLIB_URI
REPORTS_CLASSPATH=$ORACLE_HOME/reports/jlib/rwbuilder.jar:$ORACLE_HOME/reports/jlib/rwrun.jar:$ORACLE_HOME/jlib/zrclient.jar:$ORACLE_HOME/j2ee/home/oc4j.jar:$ORACLE_HOME/j2ee/home/lib/ojsp.jar; export REPORTS_CLASSPATH
#NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1; export NLS_LANG
#NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256; export NLS_LANG
NLS_LANG=ARABIC_*.AR8MSWIN1256; export NLS_LANG
## Icon variable for Solaris platform
TK_ICON=$ORACLE_HOME/reports/plugins/resource; export TK_ICON
#PRINTER=fontprinter;export PRINTER
#TK_PRINT_STATUS=echo;export TK_PRINT_STATUS
TK_PRINTER=dummy ; export TK_PRINTER
TK_PRINT_STATUS='echo %n is valid'; export TK_PRINT_STATUS
DEBUG_SLFIND=/tmp/reports.log export DEBUG_SLFIND
#PRINTER=fontprinter;export PRINTER
#TK_PRINT_STATUS=echo;export TK_PRINT_STATUS
REPORTS_PATH=$REPORTS_PATH:$ORACLE_HOME/guicommon/tk/admin/TTF:$ORACLE_HOME/guicommon/tk/admin/TTF;export REPORTS_PATH
#PRINTER=fontprinter;export PRINTER
#TK_PRINT_STATUS=echo;export TK_PRINT_STATUS

--------------------------------------------------------------
In the file datap462.ppd Comment the Symbol font by changing

*Font Symbol: Special "(001.001)" Special ROM
*%Font Symbol: Special "(001.001)" Special ROM

in the $ORACLE_HOME/guicommon/tk/admin/AFM Rename file
rename Symbol to Symbol.afm
--------------------------------------------------------------------------
From the MS Windows machine, ftp (in binary mode) the ttf files for the font styles to the target Unix machine e.g.
Arial fonts
----------------------------------------------------------------------
download ttf2pt1 open source tools
http://sourceforge.net/project/showfiles.php?group_id=4594
----------------------------------------------------------------------------
use the ttf2pt1 open source tools to convert AFM
/downloads/ttf2pt1-3.4.4/ttf2pt1 -l plane+0x06 arial.ttf
repeat this for all arial types will be used in the form

-----------------------------------------------------------------------------------------
place the generated AFM files through the ttf files to the AFM folders under Oracle AS /gui.../tk/admin/AFM
/AFM folder should show this
ls -al Ar*
ArabicTransparent
ArabicTransparent-Bold
Arial
Arialbd
Arialbi
Arial-BoldItalicMT
Arial-BoldMT
Ariali
Arial-ItalicMT
ArialMT
ArialNarrow
ArialNarrow-Bold
ArialNarrow-BoldItalic
ArialNarrow-Italic
------------------------------
/TTF folder should show this
$ls -al ar*
arialbd.ttf
arialbi.ttf
ariali.ttf
arial.ttf
ariblk.ttf
artrbdo.ttf
artro.ttf
-------------------------------------------------------