星期五, 5月 08, 2009
星期四, 6月 26, 2008
星期五, 4月 25, 2008
星期二, 1月 29, 2008
星期五, 1月 04, 2008
setenv LD_LIBRARY_PATH /usr/sfw/lib:/usr/local/BerkeleyDB.4.2/lib:/usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/dt/lib:/usr/local/db/lib
set path=(/usr/sfw/bin /usr/local/bin /bin /usr/local/apache/bin /usr/bin /usr/ucb /etc /usr/sbin /sbin /usr/ccs/bin /usr/dt/bin /opt/NSCPcom /usr/openwin/bin /usr/local/mysql/bin .)
alias cd 'cd \!* ; set prompt="`hostname`:`pwd` # "'
alias ls ls -aF
if ( $?prompt ) then
set history=32
endif
setenv EDITOR /bin/vi
設程式lib ==> crle -u -l /usr/sfw/lib:/usr/local/lib:/usr/lib:/usr/local/BerkeleyDB.4.2/lib
tar zxvf sendmail.8.13.4.tar.gz
vi devtools/Site/site.config.m4
APPENDDEF(`confLIBDIRS', `-L/usr/local/BerkeleyDB.4.2/lib')
APPENDDEF(`confINCDIRS', `-I/usr/local/BerkeleyDB.4.2/include')
APPENDDEF(`confENVDEF', `-DNEWDB')
APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER_ROOT_UNSAFE')
FEATURE(access_db)dnl
MAILER(smtp)dnl
((((((( 請確定 crle -u -l /usr/local/lib:/usr/lib:/usr/local/BerkeleyDB.4.2/lib 及
有 /usr/local/BerkeleyDB.4.2/lib 及 /usr/local/BerkeleyDB.4.2/include )))))))))))))
./Build -c
(the -c flag is used to signal a change in site.config.m4)
Add the smmsp user and group to your system. This user account is used to submit
mail on the local system under Sendmail 8.12.x (as opposed to a SUID Sendmail binary).
groupadd smmsp
useradd -g smmsp smmsp
passmgmt -m -s /dev/null smmsp
Create man page directories:
mkdir -p /usr/share/man/cat1
mkdir /usr/share/man/cat5
mkdir /usr/share/man/cat8
Install Sendmail:
./Build install
cd cf/cf
vi sendmail.mc
divert(-1)
divert(0)dnl
VERSIONID(`$Id: generic-solaris.mc,v 8.13 2001/06/27 21:46:30 gshapiro Exp $')
OSTYPE(solaris2)dnl
DOMAIN(generic)dnl
FEATURE(access_db)dnl
FEATURE(local_procmail)dnl
FEATURE(blacklist_recipients)dnl
FEATURE(mailertable)dnl
MAILER(local)dnl
MAILER(smtp)dnl
INPUT_MAIL_FILTER(`clamav-milter', `S=local:/var/run/clamav/clamav- milter.sock,T=S:4m;R:4m')
define(`confINPUT_MAIL_FILTER', `clamav-milter')
Build and install the sendmail.cf file.
./Build install-cf
安裝 procmail 到 http://www.procmail.org/ 抓 procmail source
tar zxvf procmail-3.22.tar.gz
cd procmail-3.22.tar.gz
./configure
make
make install
which procmail
/bin/procmail
修改 /etc/mail/sendmail.cf 改 /usr/local/bin/procmail /usr/bin/procmail
修改 /etc/mail/access
163.29.70. RELAY
61.16.65.11 RELAY
211.79.172. RELAY
211.79.173. RELAY
211.79.140. RELAY
211.241.107. RELAY
ricky120@ms54.hinet.net REJECT
0405hou@yahoo.com.tw REJECT
makemap hash /etc/mail/access.db < /etc/mail/access
修改 /etc/mail/local-host-names
mail
mail.tcpb.gov.tw
tcpb.gov.tw
修改 /etc/hosts
172.16.1.5 mail loghost mail.tcpb.gov.tw tcpb.gov.tw
172.16.1.12 imss imss.tcpb.gov.tw
修改 /etc/mail/aliases
MAILER-DAEMON: postmaster
nobody: /dev/null
alluser:":include:/etc/namelist"
newaliases
alluser 程式
awk '{FS=":";print $1}' /etc/passwd > /tmp/alluser
awk '{if($1 != "root") {print }}' /tmp/alluser > /tmp/alluser1
awk '{if($1 != "daemon") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "bin") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "sys") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "adm") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "lp") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "uucp") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "nuucp") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "listen") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "nobody") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "noaccess") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "nobody4") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "mds") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "smmsp") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "ftp") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "bind") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "mdstc") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "postfix") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "src") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "iscan") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "mdseye") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "root:x:0:1:Super-User:\/:\/bin\/csh") {print }}' /tmp/alluser1 >
/tmp/alluser
awk '{print $1"@tcpb.gov.tw"}' /tmp/alluser > /etc/namelist
chmod 777 /etc/namelist
delalluser 程式
rm /etc/namelist
touch /etc/namelist
chmod 700 /etc/namelist
Installing ClamAV with Sendmail on Solaris ---
1. Download ClamAV.
2. Extract the ClamAV tarball.
gzip -cd clamav-0.83.tar.gz | tar xvf -
3. Create a clamav user and group.
groupadd clamav
useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
4. Build ClamAV with milter support.
cd clamav-0.83
./configure --enable-milter
( Sendmail install must install libmilter
/sendmail-8.13.4/libmilter/
./Build
/sendmail-8.13.4/obj.SunOS.5.9.sun4/libmilter
make install
......
to install
)
make
5. Install ClamAV.
make install
6. Configure sendmail to use clamav-milter.
Add the following two lines to sendmail.mc:
INPUT_MAIL_FILTER(`clamav-milter', `S=local:/var/run/clamav/clamav-milter.sock, T=S:4m;R:4m')
define(`confINPUT_MAIL_FILTER', `clamav-milter')
Build and install the sendmail.cf file.
./Build install-cf
7. Configure clamd.
vi /usr/local/etc/clamd.conf
Change:
# Comment or remove the line below.
Example
To:
# Comment or remove the line below.
#Example
Change:
# Run as a selected user (clamd must be started by root).
# Default: disabled
#User clamav
To:
# Run as a selected user (clamd must be started by root).
# Default: disabled
User root
Change:
# Path to a local socket file the daemon will listen on.
# Default: disabled
LocalSocket /tmp/clamd
To:
# Path to a local socket file the daemon will listen on.
# Default: disabled
LocalSocket /var/run/clamav/clamd.sock
Change:
# Use system logger (can work together with LogFile).
# Default: disabled
#LogSyslog
To:
# Use system logger (can work together with LogFile).
# Default: disabled
LogSyslog
8. Configure freshclam.
vi /usr/local/etc/freshclam.conf
Change:
# Comment or remove the line below.
Example
To:
# Comment or remove the line below.
#Example
Change:
# Path to the log file (make sure it has proper permissions)
# Default: disabled
#UpdateLogFile /var/log/freshclam.log
To:
# Path to the log file (make sure it has proper permissions)
# Default: disabled
UpdateLogFile /var/log/freshclam.log
Change:
# Uncomment the following line and replace XY with your country
# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.
# Default: There is no default, which results in an error when running freshclam
#DatabaseMirror db.XY.clamav.net
To:
# Uncomment the following line and replace XY with your country
# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.
# Default: There is no default, which results in an error when running freshclam
DatabaseMirror db.us.clamav.net
9. Create the freshclam.log log file and configure permissions.
touch /var/log/freshclam.log
chown clamav:clamav /var/log/freshclam.log
10. Run freshclam hourly by adding the following entry in the root user's crontab.
7 * * * * /usr/local/bin/freshclam --quiet
11. Create the directory for the clamd and clamav-milter sockets and configure permissions.
mkdir /var/run/clamav
chown clamav:clamav /var/run/clamav
12. Start clamd
/usr/local/sbin/clamd
13. Start clamav-milter
/usr/local/sbin/clamav-milter --max-children=200 -ol /var/run/clamav/clamav-milter.sock
14. Create clamd and clamav-milter startup and shutdown scripts, configure permissions, and create symbolic links.
vi /etc/init.d/clamd
Add:
#!/bin/sh
case $1 in
'start' )
if [ ! -d /var/run/clamav ] ; then
mkdir /var/run/clamav
chown clamav:clamav /var/run/clamav
fi
/usr/local/sbin/clamd
;;
'stop' )
kill `ps -ef | awk '$NF ~ /clamd/ { print $2 }'` > /dev/null 2>&1
;;
'reload' )
# Reload virus databases
kill -USR2 `ps -ef | awk '$NF ~ /clamd/ { print $2 }'` > /dev/null 2>&1
;;
*)
echo "usage: $0 {start|stop|reload}"
esac
vi /etc/init.d/clamav-milter
Add:
#!/bin/sh
CLAMAV_MILTER_SOCKET=/var/run/clamav/clamav-milter.sock
case $1 in
'start' )
[ -r $CLAMAV_MILTER_SOCKET ] && rm $CLAMAV_MILTER_SOCKET
/usr/local/sbin/clamav-milter --max-children=200 $CLAMAV_MILTER_SOCKET
;;
'stop' )
kill `ps -ef | awk '$NF ~ /clamav-milter/ { print $2 }'` > /dev/null 2>&1
;;
*)
echo "usage: $0 {start|stop}"
esac
chmod 755 /etc/init.d/clamd /etc/init.d/clamav-milter
chown root:root /etc/init.d/clamd /etc/init.d/clamav-milter
ln -s /etc/init.d/clamd /etc/rc2.d/S78clamd
ln -s /etc/init.d/clamav-milter /etc/rc2.d/S79clamav-milter
15. Send sendmail a SIGHUP to begin using clamav-milter.
set path=(/usr/sfw/bin /usr/local/bin /bin /usr/local/apache/bin /usr/bin /usr/ucb /etc /usr/sbin /sbin /usr/ccs/bin /usr/dt/bin /opt/NSCPcom /usr/openwin/bin /usr/local/mysql/bin .)
alias cd 'cd \!* ; set prompt="`hostname`:`pwd` # "'
alias ls ls -aF
if ( $?prompt ) then
set history=32
endif
setenv EDITOR /bin/vi
設程式lib ==> crle -u -l /usr/sfw/lib:/usr/local/lib:/usr/lib:/usr/local/BerkeleyDB.4.2/lib
tar zxvf sendmail.8.13.4.tar.gz
vi devtools/Site/site.config.m4
APPENDDEF(`confLIBDIRS', `-L/usr/local/BerkeleyDB.4.2/lib')
APPENDDEF(`confINCDIRS', `-I/usr/local/BerkeleyDB.4.2/include')
APPENDDEF(`confENVDEF', `-DNEWDB')
APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER_ROOT_UNSAFE')
FEATURE(access_db)dnl
MAILER(smtp)dnl
((((((( 請確定 crle -u -l /usr/local/lib:/usr/lib:/usr/local/BerkeleyDB.4.2/lib 及
有 /usr/local/BerkeleyDB.4.2/lib 及 /usr/local/BerkeleyDB.4.2/include )))))))))))))
./Build -c
(the -c flag is used to signal a change in site.config.m4)
Add the smmsp user and group to your system. This user account is used to submit
mail on the local system under Sendmail 8.12.x (as opposed to a SUID Sendmail binary).
groupadd smmsp
useradd -g smmsp smmsp
passmgmt -m -s /dev/null smmsp
Create man page directories:
mkdir -p /usr/share/man/cat1
mkdir /usr/share/man/cat5
mkdir /usr/share/man/cat8
Install Sendmail:
./Build install
cd cf/cf
vi sendmail.mc
divert(-1)
divert(0)dnl
VERSIONID(`$Id: generic-solaris.mc,v 8.13 2001/06/27 21:46:30 gshapiro Exp $')
OSTYPE(solaris2)dnl
DOMAIN(generic)dnl
FEATURE(access_db)dnl
FEATURE(local_procmail)dnl
FEATURE(blacklist_recipients)dnl
FEATURE(mailertable)dnl
MAILER(local)dnl
MAILER(smtp)dnl
INPUT_MAIL_FILTER(`clamav-milter', `S=local:/var/run/clamav/clamav- milter.sock,T=S:4m;R:4m')
define(`confINPUT_MAIL_FILTER', `clamav-milter')
Build and install the sendmail.cf file.
./Build install-cf
安裝 procmail 到 http://www.procmail.org/ 抓 procmail source
tar zxvf procmail-3.22.tar.gz
cd procmail-3.22.tar.gz
./configure
make
make install
which procmail
/bin/procmail
修改 /etc/mail/sendmail.cf 改 /usr/local/bin/procmail /usr/bin/procmail
修改 /etc/mail/access
163.29.70. RELAY
61.16.65.11 RELAY
211.79.172. RELAY
211.79.173. RELAY
211.79.140. RELAY
211.241.107. RELAY
ricky120@ms54.hinet.net REJECT
0405hou@yahoo.com.tw REJECT
makemap hash /etc/mail/access.db < /etc/mail/access
修改 /etc/mail/local-host-names
mail.tcpb.gov.tw
tcpb.gov.tw
修改 /etc/hosts
172.16.1.5 mail loghost mail.tcpb.gov.tw tcpb.gov.tw
172.16.1.12 imss imss.tcpb.gov.tw
修改 /etc/mail/aliases
MAILER-DAEMON: postmaster
nobody: /dev/null
alluser:":include:/etc/namelist"
newaliases
alluser 程式
awk '{FS=":";print $1}' /etc/passwd > /tmp/alluser
awk '{if($1 != "root") {print }}' /tmp/alluser > /tmp/alluser1
awk '{if($1 != "daemon") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "bin") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "sys") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "adm") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "lp") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "uucp") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "nuucp") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "listen") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "nobody") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "noaccess") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "nobody4") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "mds") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "smmsp") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "ftp") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "bind") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "mdstc") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "postfix") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "src") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "iscan") {print }}' /tmp/alluser1 > /tmp/alluser2
awk '{if($1 != "mdseye") {print }}' /tmp/alluser2 > /tmp/alluser1
awk '{if($1 != "root:x:0:1:Super-User:\/:\/bin\/csh") {print }}' /tmp/alluser1 >
/tmp/alluser
awk '{print $1"@tcpb.gov.tw"}' /tmp/alluser > /etc/namelist
chmod 777 /etc/namelist
delalluser 程式
rm /etc/namelist
touch /etc/namelist
chmod 700 /etc/namelist
Installing ClamAV with Sendmail on Solaris ---
1. Download ClamAV.
2. Extract the ClamAV tarball.
gzip -cd clamav-0.83.tar.gz | tar xvf -
3. Create a clamav user and group.
groupadd clamav
useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
4. Build ClamAV with milter support.
cd clamav-0.83
./configure --enable-milter
( Sendmail install must install libmilter
/sendmail-8.13.4/libmilter/
./Build
/sendmail-8.13.4/obj.SunOS.5.9.sun4/libmilter
make install
......
to install
)
make
5. Install ClamAV.
make install
6. Configure sendmail to use clamav-milter.
Add the following two lines to sendmail.mc:
INPUT_MAIL_FILTER(`clamav-milter', `S=local:/var/run/clamav/clamav-milter.sock, T=S:4m;R:4m')
define(`confINPUT_MAIL_FILTER', `clamav-milter')
Build and install the sendmail.cf file.
./Build install-cf
7. Configure clamd.
vi /usr/local/etc/clamd.conf
Change:
# Comment or remove the line below.
Example
To:
# Comment or remove the line below.
#Example
Change:
# Run as a selected user (clamd must be started by root).
# Default: disabled
#User clamav
To:
# Run as a selected user (clamd must be started by root).
# Default: disabled
User root
Change:
# Path to a local socket file the daemon will listen on.
# Default: disabled
LocalSocket /tmp/clamd
To:
# Path to a local socket file the daemon will listen on.
# Default: disabled
LocalSocket /var/run/clamav/clamd.sock
Change:
# Use system logger (can work together with LogFile).
# Default: disabled
#LogSyslog
To:
# Use system logger (can work together with LogFile).
# Default: disabled
LogSyslog
8. Configure freshclam.
vi /usr/local/etc/freshclam.conf
Change:
# Comment or remove the line below.
Example
To:
# Comment or remove the line below.
#Example
Change:
# Path to the log file (make sure it has proper permissions)
# Default: disabled
#UpdateLogFile /var/log/freshclam.log
To:
# Path to the log file (make sure it has proper permissions)
# Default: disabled
UpdateLogFile /var/log/freshclam.log
Change:
# Uncomment the following line and replace XY with your country
# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.
# Default: There is no default, which results in an error when running freshclam
#DatabaseMirror db.XY.clamav.net
To:
# Uncomment the following line and replace XY with your country
# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.
# Default: There is no default, which results in an error when running freshclam
DatabaseMirror db.us.clamav.net
9. Create the freshclam.log log file and configure permissions.
touch /var/log/freshclam.log
chown clamav:clamav /var/log/freshclam.log
10. Run freshclam hourly by adding the following entry in the root user's crontab.
7 * * * * /usr/local/bin/freshclam --quiet
11. Create the directory for the clamd and clamav-milter sockets and configure permissions.
mkdir /var/run/clamav
chown clamav:clamav /var/run/clamav
12. Start clamd
/usr/local/sbin/clamd
13. Start clamav-milter
/usr/local/sbin/clamav-milter --max-children=200 -ol /var/run/clamav/clamav-milter.sock
14. Create clamd and clamav-milter startup and shutdown scripts, configure permissions, and create symbolic links.
vi /etc/init.d/clamd
Add:
#!/bin/sh
case $1 in
'start' )
if [ ! -d /var/run/clamav ] ; then
mkdir /var/run/clamav
chown clamav:clamav /var/run/clamav
fi
/usr/local/sbin/clamd
;;
'stop' )
kill `ps -ef | awk '$NF ~ /clamd/ { print $2 }'` > /dev/null 2>&1
;;
'reload' )
# Reload virus databases
kill -USR2 `ps -ef | awk '$NF ~ /clamd/ { print $2 }'` > /dev/null 2>&1
;;
*)
echo "usage: $0 {start|stop|reload}"
esac
vi /etc/init.d/clamav-milter
Add:
#!/bin/sh
CLAMAV_MILTER_SOCKET=/var/run/clamav/clamav-milter.sock
case $1 in
'start' )
[ -r $CLAMAV_MILTER_SOCKET ] && rm $CLAMAV_MILTER_SOCKET
/usr/local/sbin/clamav-milter --max-children=200 $CLAMAV_MILTER_SOCKET
;;
'stop' )
kill `ps -ef | awk '$NF ~ /clamav-milter/ { print $2 }'` > /dev/null 2>&1
;;
*)
echo "usage: $0 {start|stop}"
esac
chmod 755 /etc/init.d/clamd /etc/init.d/clamav-milter
chown root:root /etc/init.d/clamd /etc/init.d/clamav-milter
ln -s /etc/init.d/clamd /etc/rc2.d/S78clamd
ln -s /etc/init.d/clamav-milter /etc/rc2.d/S79clamav-milter
15. Send sendmail a SIGHUP to begin using clamav-milter.