Linux
Certification, System Administration, Programming, Networking Books
Installation of perl
module Sendmail Milter in RedHat Linux 7.3
1. Introduction
1.1 Description
This is a cookbook for the installation
of Sendmail::Milter in RedHat 7.3 using .rpm
It will help you get a working setup of
Sendmail and Sendmail::Milter perl package.
To get this working, we need to compile
perl with support for threads. Also, sendmail must be compiled
because Sendmail::Milter makefile need
its files. Then, Sendmail::Milter is compiled once the new version
of perl is installed and sendmail compiled
1.2 Conventions:
Commands:
# echo "command" # this is a command excuted
as root
$ echo "command" # this is a command excuted
as a normal user
Files:
this is a line
that should be edited in a file
2. Prerequisites
2.1 You will need to have this rpm files
installed:
cyrus-sasl-devel-1.5.24-25.i386.rpm
db1-devel-1.85-8.i386.rpm
db3-devel-3.3.11-6.i386.rpm
openldap-devel-2.0.23-4.i386.rpm
tcp_wrappers-7.6-19.i386.rpm
sendmail-8.11.6-15.i386.rpm
2.2 You will need to have this rpm files:
sendmail-8.11.6-15.src.rpm
perl-5.6.1-34.99.6.src.rpm
2.3 You will need this .tar.gz files:
Sendmail-Milter-0.18.tar.gz
3. Compile and Install Perl
3.1 Install the .src.rpm
# rpm -ivh perl-5.6.1-34.99.6.src.rpm
3.2 Edit the perl.spec file
Edit this file:
/usr/src/redhat/SPECS/perl.spec
the first lines should look like this:
%define build_rawhide 1
%if %{build_rawhide}
%define threading 1
3.3 Build Perl
Now, compile perl:
# cd /usr/src/redhat/SPECS
# rpm -ba --clean perl.spec
3.4 Install Perl
Once rpm finishes compiling perl, you
need to install it:
# rpm -ev perl --no-deps
# rpm -ivh /usr/src/redhat/RPMS/i386/perl-5.6.1-34.99.6.i386.rpm
3.5 Test the new perl rpm package
To see if threads are build-in into perl,
do this:
$ perl -V | grep usethreads=
You should see something like this:
usethreads=define use5005threads=undef
useithreads=define usemultiplicity=undef
4. Compile Sendmail
Now we need to have a compiled version
of sendmail. We will just compile sendmail,
not build a rpm nor install a new version
of it.
4.1 Install the .src.rpm
Install the .src.rpm package of sendmail:
# rpm -ivh sendmail-8.11.6-15.src.rpm
4.2 Compile Sendmail
For compile only sendmail, do this:
# cd /usr/src/redhat/SPECS
# rpm -bc sendmail.spec
Optionally, you can build the rpm like
this if you have an i686 platform:
# rpm -bc --target i686 sendmail.spec
5. Compile and Install Sendmail::Milter
Now that we have perl installed and sendmail
compiled, we can compile Sendmail::Milter.
5.1 Compile Sendmail::Milter
Uncompress the source file:
# tar xzf Sendmail-Milter-0.18.tar.gz
-C /tmp
# cd /tmp/Sendmail-Milter-0.18
# perl Makefile.PL /usr/src/redhat/BUILD/sendmail-8.11.6/
/usr/src/redhat/BUILD/sendmail-8.11.6/obj.Linux.2.4.18-10.i686/
Please note that the directory:
/usr/src/redhat/BUILD/sendmail-8.11.6/obj.Linux.2.4.18-10.i686/
can be diferent in your computer, for
example, something like this:
/usr/src/redhat/BUILD/sendmail-8.11.6/obj.Linux.2.4.18-10.i386/
or
/usr/src/redhat/BUILD/sendmail-8.11.6/obj.Linux.2.4.18-10.athlon/
# make
# make install
6. Configure Sendmail to work with your
filter
6.1 edit your .mc file
# cd /etc/mail/cf
# cp redhat.mc my-redhat.mc
edit /etc/mail/cf/my-redhat.mc and put
this lines:
dnl # Sendmail::Milter --------------------------------
define(`_FFR_MILTER', `1')dnl
INPUT_MAIL_FILTER(`myfilter', `S=local:/var/run/perl.sock')dnl
6.2 compile your .mc file
# cd /etc/mail/cf
# m4 ../m4/cf.m4 my-redhat.mc > my-redhat.cf
6.3 install you new .cf file
# cd /etc/mail/cf
# mv my-redhat.cf /etc/sendmail.cf
6.4 restart sendmail
# service sendmail restart
6.5 start you perl Milter filter
To run your perl filter, use the socket
defined in the .mc file.
For example, using the sample.pl file
from the Sendmail::Milter distribution:
# perl -w sample.pl myfilter /etc/sendmail.cf
2>filter.log 1>filterl.log &
The output file should not content the output of the filter processing instanainly because some data is buffered. But when you exit the perl filter(with SIGINT) all the output content will be saved to the output file.
Now is time for some testing.
Quick Links:
Do you have a
Linux Question?
Linux Home: Linux
System Administration Hints and Tips