steps to website setup ( apache 2.2.8 )


A. Steps to set up a website for name1.com

create system user
now we add a ftp user
chang the permission
create the directory structure
change the permission and ownnership
edit the httpd-vhost.conf
how to rotate the logs
mod_rewrite
alias for his domain
add custom error page
deny certain IP
add certin mime type
redirect visitors to another page

B. Steps for building awstats for name1.com

see bellow


C . Steps to delete website name1.com
see bellow





Steps to set up a website for name1.com

1 create system user

useradd -d /websites/name1.com -s /sbin/nologin name1

2. now we adda ftp user

/usr/local/pureftpd/bin/pure-pw useradd name1 -f /usr/local/pureftpd/etc/pureftpd.passwd -u name1 -d /websites/name1.com -m
enterpassword
retype password

3. we chang the permission for the the user name1 ( 711 )

chmod 711 /websites/name1.com

4. we create the directory structure for the doamin name1.com

mkdir /websites/name1.com/web /websites/name1.com/logs /websites/name1.com/private /websites/name1.com/data /websites/name1.com/cgi-bin

5.we change the permission and ownnership of the directories we jsut created

chmod 711 /websites/name1.com/*
chown name1:name1 /websites/name1.com/*
6. Now we edit the httpd-vhost.conf ( /usr/local/apache2/conf/extra/httpd-vhosts.conf )
we the add the vhsot directive for name1.com

###########vhost for name1.com.com ############################
<VirtualHost 192.168.0.244:80>
ServerAdmin admin@name1.sys.qualiproj.com
ServerName name1.sys.qualiproj..com
ServerAlias www.name1.sys.qualiproj..com
DocumentRoot /websites/name1.com/web
<Directory /websites/name1.com/web>
Options -MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
AllowOverride FileInfo AuthConfig Limit
Order allow,deny
Allow from all
</Directory>
ErrorLog /websites/name1.com/logs/name1.sys.qualiproj.error_log
CustomLog /websites/name1.com/logs/name1.sys.qualiproj.access_log common
ScriptAlias /cgi-bin/ "/websites/nokia.com/cgi-bin/"
<Directory "/websites/nokia.com/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


8 . now we need to rotate the logs so we edit /etc/logrotate.conf

"/websites/name1.com/logs/name1.sys.qualiproj.access_log" /websites/name1.com/logs/name1.sys.qualiproj.error_log {
rotate 5
size=100k
sharedscripts
postrotate
/sbin/killall -HUP httpd
endscript
}


7 . Now if the client want to use mod_rewrite ( URL rewritting ) then add the folloing in the /usr/local/apache2/conf/extra/httpd-vhosts.conf

<Directory /websites/nokia.com/web>
RewriteEngine On
RewriteRule ^index.html$ bob.html
</Directory>


8. if client wants to add one omre alias for his domain Eg: www.name1.com and ftp.name1.com

ServerAlias www.name1.com ftp.name1.com


9 if client want to add custom error page then we need to add the followin in the http-vhost.conf within the vhost directive

ErrorDocument 500 http://www.devshed.com/c/a/Apache/Custom-Error-Pages-with-Apache
ErrorDocument 404 /cgcraft.gif

10. If client wants to deny certain IP from accessing his website then change the following in the vhost directive

<Directory /websites/name1.com/web>
Options -MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
AllowOverride FileInfo AuthConfig Limit
Order allow,deny
#Allow from all
Deny from 192.168.0.247
</Directory>


11. If client wants to add certin mime type for his domain wedi the vhost directive again and add the following ( eg: enables php )

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

12. if client wants to redirect visitors to another page or url then we edit the vhost directive again and add the following

Redirect /service http://www.google.com



Steps todelete website name1.com

1. delet the system user
userdel -r name1
2. delete the ftpuser
/usr/local/pureftpd/bin/pure-pw userdel name1 -f /usr/local/pureftpd/etc/pureftpd.passwd -m
3. remove move the log rotation script frm /etc/logrotate.comf for the doamin name1.com

"/websites/name1.com/logs/name1.sys.qualiproj.access_log" /websites/name1.com/logs/name1.sys.qualiproj.error_log {
rotate 5
size=100k
sharedscripts
postrotate
/sbin/killall -HUP httpd
endscript
}
5. remove the cron job ( if any ) for awstats in
/etc/cron.daily/awstatsupdate perl /websites/name1.com/webstats/tools/awstats_buildstaticpages.pl -awstatsprog=/websites/name1.com/webstats/wwwroot/cgi-bin/awstats.pl -update -config=name1.sys.qualiproj.com -dir=/websites/name1.com/web/awstats/






Steps for building awstats for name1.com

1. cp -R /usr/local/src/awstats.6.7 /webistes/name1.com/webstats
2. cp /websites/name1.com/webstats/wwwroot/cgi-bin/awstats.model.conf /websites/name1.com/webstats/wwwroot/cgi-bin/awstats.name1.sys.qualiproj.com.conf
3. mkdir /websites/name1.com/web/awstats
5 chown name1:name1 /websites/name1.com/web/awstats
4. cp -R /websites/name1.com/webstats/wwwroot/icon /websites/name1.com/web/awstats/
5 . Edit the conf file ( awstats.name1.sys.qualiproj.com.conf )

LogFile="/websites/name1.com/logs/name1.sys.qualiproj.access_log"
SiteDomain="name1.sys.qualiproj.com"
HostAliases="www.name1.sys.qualiproj.com name1.sys.qualiproj.com localhost 127.0.0.1 "
DirData="/websites/name1.com/webstats"
DirIcons="/web/awstats/icon"
DNSLookup=1

6 Run the perl script to generate /update the webstats
perl /websites/name1.com/webstats/tools/awstats_buildstaticpages.pl -awstatsprog=/websites/name1.com/webstats/wwwroot/cgi-bin/awstats.pl -update -config=name1.sys.qualiproj.com -dir=/websites/name1.com/web/awstats/
8. now we add a cron job to run this every day !
add in /etc/cron.daily/awstatsupdate

perl /websites/name1.com/webstats/tools/awstats_buildstaticpages.pl -awstatsprog=/websites/name1.com/webstats/wwwroot/cgi-bin/awstats.pl -update -config=name1.sys.qualiproj.q.com -dir=/websites/name1.com/web/awstats/


7. To add advenced browser security to this folder ( /websites/name1.com/web/awstats ) we first generatea password for the user

/usr/local/apache2/bin/htpasswd -c /websites/privatefolderpasswd/name1.com/htpasswd name1

enter a new password
8. Then we edit the vhost file for name1.com located in /usr/local/apache2/conf/extra/httpd-vhosts.conf
In the Vhost directive we add the following

<vhost>
.
.
.<Directory /websites/nokia.com/web/awstats>
AllowOverride AuthConfig
AuthName "MyPrivateStuff"
AuthType Basic
AuthGroupFile /dev/null
AuthUserFile /websites/privatefolderpasswd/name1.com/htpasswd
AuthName Enterpassword
Require valid-user
</Directory>
</vhost>

done !!
-------------------
Regards
Agnello

installing awstats for virtual domains

installing awstats for virtual domains


download awstats  ina seperate folder

cd /usr/local/src

wget wget http://jaist.dl.sourceforge.net/sourceforge/awstats/awstats-6.7.tar.gz

tar -xzvf awstats-6.7.tar.gz

cd awstats-6.7/

cp -R * /websites/nokia.com/webstats

cd  /websites/nokia.com/webstats

perl tools/awstats_configure.pl

Do you want to continue setup from this NON standard directory [yN] ? y
Config file path ('none' to skip web server setup): none
Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ? y
Your web site, virtual server or profile name: SITE_NAME.COM
Directory path to store config file(s): /websites/nokia.com/webstats/wwwroot/cgi-bin/

edi the config files located in /websites/nokia.com/webstats/wwwroot/cgi-bin/

LogFile="/websites/nokia.com/log/access.log"
SiteDomain="SITE_NAME.COM"
HostAliases="SITE_NAME.COM www.SITE_NAME.COM 127.0.0.1 localhost"
DNSLookup=1
DirData="/websites/nokia.com/webstats/"
DirIcons="/web/awstats/icon"


mkdir /websites/nokia.com/web/awstats

cp -R /websites/nokia.com/webstats/wwwroot/icon/ /websites/nokia.com/web/awstats/


this perl files will update the web staticts

perl /websites/nokia.com/webstats/tools/awstats_buildstaticpages.pl -awstatsprog=/websites/nokia.com/webstats/wwwroot/cgi-bin/awstats.pl -update -config=nokia.sys.qualiproj.qualispace.com -dir=/websites/nokia.com/web/awstats/


To add advanced security  to this  folder - awstats we add a htacces type authentication.

<Directory /websites/nokia.com/web/awstats>
AllowOverride  AuthConfig
AuthName "MyPrivateStuff"
AuthType Basic
AuthGroupFile /dev/null
AuthUserFile /websites/privatefolderpasswd/nokia.com/htpasswd
AuthName Enterpassword
Require valid-user
 </Directory>


now view http://nokia.sys.qualiproj.qualispace.com/awstats/awstats.nokia.sys.qualiproj.qualispace.com.html

it will prompt you fro user name password

now you can view you site stats



--

how to compile mod_rewrite from source


download the apache 2.XX file frm source
 
untar the package
 
cd /apache 2.xx
 
./configure --prefix=/usr/local/apache2 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-mods-shared='rewrite ssl' --enable-ssl --with-ssl
 
make && make install
 
in httpd.conf remove the # in forn to LoadModules

LoadModule ssl_module modules/mod_ssl.so
LoadModule rewrite_module modules/mod_rewrite.so
 
restart apache !!
--

how to compile mod_rewrite from source

download the apache 2.XX file frm source untar the package cd /apache 2.xx ./configure --prefix=/usr/local/apache2 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-mods-shared='rewrite ssl' --enable-ssl --with-ssl make && make install in httpd.conf remove the # in forn to LoadModules LoadModule ssl_module modules/mod_ssl.soLoadModule rewrite_module modules/mod_rewrite.so restart apache !!

Installation of BackupPC on Cent OS 5

Following are the packages to be installed
install httpd

start httpd

via CPAN insaql the following per file

perl-MCPN -e shell

install Compress::Zlib

install Archive::Zip

File::RsyncP

Install the following packages

yum install perl-suidperl

Now we add a user for the backupPC with its group being apache useradd -g apache backuppc

Now we download the backupPC source file

cd /usr/local/src wget http://nchc.dl.sourceforge.net/sourceforge/backuppc/BackupPC-3.1.0.tar.gz

tar -xzvf BackupPC-3.1.0.tar.gz
cd BackupPC-3.1.0
make Makefile.pl
this will be the location of the config file -----------> /etc/BackupPC/config.pl
this will be the locatino where we add host( clients to be backed up ) ---------> /etc/BackupPC/hosts ths is the location where the bin doc lib files are ---------> /usr/local/BackupPC] this is the location where the data will be abcked up -----------> /home/backuppc
this is the location of your cCGI bin directory -----------------> /var/bin/cgi-bin
this the location of the image /var/www/html/backuppc same --------------------------------------> /backuppc

now we will copy the init scritp to the right location

cp /usr/local/src/BackupPC-3.1.0/init.d/linux-backuppc /etc/rc.d/init.d/backuppc
chmod +x /etc/rc.d/init.d/backuppc

(A) Now backing up frm Linux clinet to linux BackupPC

Passwordless login frm linux clinet and from Linux BackupPC server

1. on the Linux BackupPC server
su - backuppc
ssh-keygen -t rsa -------------> this will generate the id_rsa and id_rsa.pub keys in /home/backuppc/.ssh/
once that is done we scp the id_rsa.pb key to the Linux client machine scp ~/.ssh/id_rsa.pub root@linuxclinetIP:/tmp
now we log into the linux clinte Pc and copy the /tmp/id_rsa.pub to ~/.ssh/authorized_keys
cp /tmp/id_rsa.pub ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys

now on the Linux BackupPC server ( su - backuppc ) try to login in ( ssh root@linuxclinet ) , it should log you in without a password You can append as many public keys

2. On the Linux clinet PC
ssh-keygen -t rsa -------------> this will generate the id_rsa and id_rsa.pub keys in /root/.ssh/
once that is done we scp the id_rsa.pb key to the Linux BackupPC server
scp ~/.ssh/id_rsa.pub root@LinuxBackupPCIP:/tmp
now we log into the linux BackupPC server and log in a backuppc user and copy the /tmp/id_rsa.pub to ~/.ssh/authorized_keys
cp /tmp/id_rsa.pub ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
now on the Linux client PC try to login in ( ssh backuppc@linuxBackupPC IP ) , it should log you in woithout a password
Now, so that we want security to access the cgi script we careate htaccess password file

htpasswd -c /etc/BackupPC/htpasswd client1 ( unix system user ) ---------> enter the password as prompted

now we will add our clinet to the host file located in /etc/BackupPC/hosts

# host dhcp user moreUsers # <--- do not edit this line #farside 0 craig jill,jeff # <--- example static IP host entry #larson 1 bill # <--- example DHCP host entry 192.168.0.244 0 linuxclient1 # <--- where only linuxclinet1 user can acces this system back up frm webinterfce 192.168.0.209 0 backuppc # <--- where only backuppc user can acces this system back up frm webinterfce

we will create/edit a congif file in /etc/BackupPC/pc/linuxclientPCIP.pl

$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+'; $Conf{RsyncClientCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+'; $Conf{XferMethod} = 'rsync'; $Conf{RsyncShareName} = ['/home','/var/log']; now we will edit he httpd.conf so that only the prticulat user assigned to the particular clinet gets access to the cgi script

<Directory "/var/www/cgi-bin"> # AllowOverride None # Options None # Order allow,deny # Allow from all Options ExecCGI FollowSymlinks AddHandler cgi-script .cgi DirectoryIndex index.cgi AuthGroupFile /etc/backuppc/htgroup AuthUserFile /etc/backuppc/htpasswd AuthType basic AuthName "backuppc" require valid-user

</Directory>

now we restart httpd and backuppc

/etc/init.d/httd restart /etc/init.d/backuppc restart

now we will try to take a back up of the of the Linux clinet Pc

add the user name and password .... this should gvive u access to the particular clinet

(B) Now backing up frm Windows clinet to linux BackupPC

we unzip it in C:/rsyncd/
we edit the rsyncd.conf file
use chroot = false
max connections = 4
pid file = c:/rsyncd/rsyncd.pid
lock file = c:/rsyncd/rsyncd.lock

#this is frm where all your data will be backed up.

[cDrive0] path = c:/rsyncd comment = agnello's documents auth users = agnello secrets file = c:/rsyncd/rsyncd.secrets # hosts allow = 172.16.0.17 strict modes = false read only = false list = false

[cDrive1] path = c:/var comment = agnello's documents auth users = agnello secrets file = c:/rsyncd/rsyncd.secrets # hosts allow = 172.16.0.17 strict modes = false read only = false list = false

[cDrive2] path = c:/Documents and Settings/All Users/Documents/My Music comment = agnello's documents auth users = agnello secrets file = c:/rsyncd/rsyncd.secrets # hosts allow = 172.16.0.17 strict modes = false read only = false list = false

Now save the file and run the service.bat file make sure that your windows PC has not blocked 873

Now edit the rsync.secret add the following lines

agnello:agnello123

now on the Linux BackuPC server we create a config file for the windows client

eg : vi /etc/BackupPC/pc/windowsclentip.pl $Conf{XferMethod} = 'rsyncd'; $Conf{RsyncdUserName} = 'agnello'; $Conf{RsyncdPasswd} = 'agnello123'; $Conf{RsyncShareName} = ['cDrive0','cDrive1','cDrive2']; $Conf{ClientCharset} = 'cp1252'

maker sure that the user and password is tha same as rsync.secret file

now we will add our windows clinet to the host file located in /etc/BackupPC/hosts on the lINUX bACKUPpc SERVER

# host dhcp user moreUsers # <--- do not edit this line #farside 0 craig jill,jeff # <--- example static IP host entry #larson 1 bill # <--- example DHCP host entry 192.168.0.244 0 linuxclient1 # <--- where only linuxclinet1 user can acces this system back up frm webinterfce 192.168.0.209 0 winclient1 # <--- where only backuppc user can acces this system back up frm webinterfce

now we restart backuppc

/etc/init.d/backuppc restart

now try browser in the the http://linuxBackupPCserverIP/cgi-bin/backupc

add the user name and password .... this should gvive u access to the particular clinet ( ref /etc/BackupPC/hosts file )

Now take your regular backups
--

installing pure ftpd with mysql virtual users & unix users

mysql virtual users with unix users

Now in case we need to store the password of the user in the mysql database then we need to add the following steps

step 1: we copy the pureftpd-mysql.conf from /usr/local/src/pureftpd-msql.conf ====> to /usr/local/pureftpd/etc/.

the pureftpd-mysql.conf has the following details: 


#MYSQLServer     localhost
#MYSQLPort       3306
MYSQLSocket     /tmp/mysql.sock
MYSQLUser       root
MYSQLPassword   agnello
MYSQLDatabase   pureftpd
MYSQLCrypt      MD5
MYSQLGetPW      SELECT Password FROM ftpd WHERE User="\L"
MYSQLGetUID     SELECT Uid FROM ftpd WHERE User="\L"
MYSQLGetGID     SELECT Gid FROM ftpd WHERE User="\L"
MYSQLGetDir     SELECT Dir FROM ftpd WHERE User="\L"

step 2 : we create a data base in mysql ( pureftpd )

mysql -u root -password

create database pureftpd;

use pureftpd;

CREATE TABLE ftpd (
  User VARCHAR(16) BINARY NOT NULL,
  Password VARCHAR(64) BINARY NOT NULL,
  Uid VARCHAR(11) NOT NULL default '-1',
  Gid VARCHAR(11) NOT NULL default '-1',
  Dir VARCHAR(128) BINARY NOT NULL,
  PRIMARY KEY  (User)
);

quit;

step 3: we create a directory where all our domains will be stored say  /etc/website
        the permission  i wll be as follows ( these are just the basic )


       [root@linux-test pure-ftpd-1.0.21]# ll /home/
       drwxr-xr-x 5 root     root     4096 May 20 17:30 website

step 4 : now suppose we have to creat a user for a domain called silly .com

         1. lets create a unix user

         useradd -d /home/website/silly.com -s /sbin/nologin silly

         2. then we add the virtual user ( with password ) in the the mysql database ( usning phpmyadmin )

         user: silly
         password ( MD5 ): silly123
         uid : silly
         gid : sil ly
         dir: /home/website/silly.com     
 
step 5: now we start the ftpd daemon

/usr/local/pureftpd/sbin/pure-ftpd   -lmysql:/usr/local/pureftpd/etc/pureftpd-mysql.conf -l unix  -j /home/websites &

can view the log with tail -f /var/log/messages

now try to log in ftp://192.168.0.244 with username and password

--

installation of Pure FTPD with virtual user and system user

Installation of pureftpd
 
cd  /usr/local/src
 

./configure --prefix /usr/local/pureftpd  --with-mysql=/usr/local/mysql --with-quotas --with-altlog=/var/log/pureftpd --with-puredb

make  && make install

###################################################################

we have enable virtual user , this means that we can have 1000 of users with out having the /etc/passwd fle touched . So  create a system user.


mkdir /usr/local/pureftpd/etc
touch  /usr/local/pureftpd/etc/pureftpd.passwd

####################################################################

now lets the create the a user

step 1 : creat a unix user

useradd -d /home/website/nokia.com -s /sbin/nologin nokia


step 2: now to add a  ftp user ( the passwor of this suer will be in a seperate file )

/usr/local/pureftpd/bin/pure-pw useradd nokia -f /usr/local/pureftpd/etc/pureftpd.passwd  -u nokia -d /home/website/nokia.com -m


step 3: now to start the pureftpd daemond

/usr/local/pureftpd/sbin/pure-ftpd   -l puredb:/usr/local/pureftpd/etc/pureftpd.pdb -j /home/websites &


---------------
few extra tips
---------------
...bin/pure-pw passwd nokia -f /usr/local/pureftpd/etc/pureftpd.passwd  ---> this will change password for nokia !!

...bin/pure-pw list -f /usr/local/pureftpd/etc/pureftpd.passwd ----> this will list all the ftp-users


The  logging  facaility is done in the  /etc/syslog.conf add the folloing ftp.*    /var/log/pureftpd

################################################################



--

set correct time stamp for mails on postfix mailserver

The problem is that Postfix doesn't know what timezone you are in.
It's compounded by the fact that Postfix, for security reasons,
doesn't want to read things outside of it's directory. However you can
fix this by copying the timezone files to a directory in
/var/spool/postfix/

cd /var/spool/postfix/
sudo mkdir etc

now, take a look at /etc/localtime:

ls -la /etc/localtime
lrwxr-xr-x 1 root wheel 36 6 Aug 20:05 /etc/localtime ->
/usr/share/zoneinfo/America/New_York

copy /usr/share/zoneinfo/country/state to /var/spool/postfix/etc/

sudo cp -p /usr/share/zoneinfo/America/New_York \
/var/spool/postfix/etc/localtime

postfix check
postfix reload

Now take a look at your mail.log and see if all the times line up.


--

Installation of system local users using virtualmin

installation of system local users using virtualmin

you should have webmin already installed

Virtualmin can be downloaded in Webmin module format from:
http://download.webmin.com/download/virtualmin/virtual-server-3.55.gpl.wbm.gz
(764 kB)

The new Virtualmin framed theme in Webmin module format can be downloaded from:
http://download.webmin.com/download/virtualmin/virtual-server-theme-5.5.wbt.gz
(2.2 MB)

You can install it by going to the Webmin Configuration module,
clicking on Webmin Modules and use the first form on the page to
install the downloaded .wbm.gz file. Or install it directly from the
above URL. After installation the module will show up in the Servers
category.

To install the theme,
go to the Webmin Configuration module,
click on Webmin Themes and install the downloaded .wbt.gz file.

Once this is done, you should use the Webmin Themes page to make the
new theme the default, if your system is to be primarily used for
virtual hosting.

The same theme file can be used with Usermin too, to provide a similar
user interface style and a better framed interface for reading email.
To install it, go the Usermin Configuration module, click on Usermin
Themes and install from the .wbt.gz file.

yum install postfix ( make sure you have sasl enabled )

postfix configureation details !!

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = eshanews.com
mydomain = eshanews.com
myhostname = mail.eshanews.com
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
recipient_delimiter = +
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks
permit_sasl_authenticated reject_unauth_destination
reject_unauth_pipelining reject_invalid_hostname
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
canonical_maps = hash:/etc/postfix/canonical
sender_canonical_maps = hash:/etc/postfix/canonical
recipient_canonical_maps = hash:/etc/postfix/canonical

make sure that the u creat db file for

virtual_alias_maps = hash:/etc/postfix/virtual
canonical_maps = hash:/etc/postfix/canonical
sender_canonical_maps = hash:/etc/postfix/canonical
recipient_canonical_maps = hash:/etc/postfix/canonical

then is install squirrel mail !!

making psot fix scan incoming mails for spam

yum install spamassassin

groupadd -g 5001 spamd
#useradd -u 5001 -g spamd -s /sbin/nologin -d /var/lib/spamassassin spamd
#mkdir /var/lib/spamassassin
#chown spamd:spamd /var/lib/spamassassin

local.cf sample

rewrite_header Subject [***** SPAM _SCORE_ *****]
required_score 2.0
#to be able to use _SCORE_ we need report_safe set to 0
#If this option is set to 0, incoming spam is only modified by adding
some "X-Spam-" headers and no changes will be made to the body.
report_safe 0

# Enable the Bayes system
use_bayes 1
use_bayes_rules 1
# Enable Bayes auto-learning
bayes_auto_learn 1

# Enable or disable network checks
skip_rbl_checks 0
use_razor2 0
use_dcc 0
use_pyzor 0


restart spamassassin

Now, we need to tell postfix to use spamassassin. In our case,
spamassassin will be invoked only once postfix has finished with the
email.

To tell postfix to use spamassassin, we are going to edit
/etc/postfix/master.cf and change the line:

smtp inet n - - - - smtpd
-o content_filter=spamassassin


and then, at the end of master.cf, let's add:

pamassassin unix - n n - - pipe
user=spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}


we restart postfix

/etc/init.d/postfix reload

thats it !!!!!!


--

set up postfix - only SMTP from source

groupadd -r postfix
useradd -r -g postfix -d /no/where -s /no/shell postfix
groupadd -r postdrop


make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL
-I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL
-I/usr/include/sasl -DUSE_TLS -I/usr/include/openssl'
'AUXLIBS=-L/usr/local/mysql/lib/mysql -lssl -lmysqlclient -lz -lm
-lsasl2 -lcrypto'

make

make install

netstat -tap


to start postfix

postfix start

OR

vi /etc/rc.d/init/postfix

#!/bin/bash
#
# postfix This script controls the postfix daemon.
#

# description: Postfix MTA
# processname: postfix

case "$1" in
start)
/usr/sbin/postfix start
;;
stop)
/usr/sbin/postfix stop
;;
reload)
/usr/sbin/postfix reload
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|reload|restart}"
exit 1
esac
exit 0


--

Other Articles

Enter your email address: