需求: Windows WebServer 要備份至Linux Server
建立folder 就叫backup
置放rar.exe
至backup folder 內
建立一Backup.bat
內容如下:
@echo off
rar a -ag[YYYYMMDD] backup @backup.lst
ftp -n -s:myfile.scr
del backup[*].rar
建立backup.lst 檔案
內容為你要備份的完整路徑
如D:\IWANNABACKUPTHISFOLDER
建立myfile.scr
內容:
open YourLinuxServerIP
user backup ->You must create before use
backup -> passwd about accout backup
hash
prompt
mput backup[*].rar
bye
建立完成後,即可使用m$內的排程工作定期執行該任務
這部份就不多賛敘了
P.s 由於這樣做對安全上是有一定的影響
iptables 要設定限制
另外
記得要/sbin/modprobe ip_conntrack_ftp
2009年2月20日 星期五
mutt db to gmail
#!/bin/sh
DATESTR=`date "+%Y%m%d%H"`
/usr/bin/mysqldump --add-locks btwoe > /root/tmp/backupb2e.$DATESTR.sql
/bin/tar -zcvf /root/tmp/etcbackup$DATESTR.tar.gz /etc
/bin/tar -zcvf /tmp/mybackup.tgz /root/tmp
echo "etc and sql backup" | mutt -a /tmp/mybackup.tgz yourgmailaccout@gmail.com "etc and sql backup"
DATESTR=`date "+%Y%m%d%H"`
/usr/bin/mysqldump --add-locks btwoe > /root/tmp/backupb2e.$DATESTR.sql
/bin/tar -zcvf /root/tmp/etcbackup$DATESTR.tar.gz /etc
/bin/tar -zcvf /tmp/mybackup.tgz /root/tmp
echo "etc and sql backup" | mutt -a /tmp/mybackup.tgz yourgmailaccout@gmail.com "etc and sql backup"
iptables block ssh attempt attack
iptables block ssh attempt 適用於RedHat,Fedora
#容忍值可以調高一點(粗體字)
#! /bin/bash
VAL=`grep Failed /var/log/secure | awk '{print $(NF-3)}' |cut -d: -f4 | sort | uniq -c |awk '{print $1"="$2}'`
for i in $VAL
do
NUM=`echo $i|awk -F= '{print $1}'`
IP=`echo $i|awk -F= '{print $2}'`
if [ $NUM -gt 5 ] && [ -z "`iptables -vnL INPUT|grep $IP`" ]
then
iptables -I INPUT -p tcp -s $IP -j REJECT --reject-with tcp-reset
echo "platinum log: `date` $IP($NUM)" >> /var/log/val.log
fi
done
iptables block ssh attempt 適用於Debian
#容忍值可以調高一點(粗體字)
#!/bin/bash
VAL=`grep Illegal /var/log/auth.log | awk '{print $10}' | sort | uniq -c | awk '{print $1"="$2}'`
for i in $VAL
do
NUM=`echo $i|awk -F= '{print $1}'`
echo $NUM
IP=`echo $i|awk -F= '{print $2}'`
echo $IP
if [ $NUM -gt 5 ] && [ -z "`iptables -vnL INPUT|grep $IP`" ]
then
iptables -I INPUT -p tcp -s $IP -j REJECT --reject-with tcp-reset
echo "platinum log: `date` $IP($NUM)" >> /var/log/val.log
fi
done
#容忍值可以調高一點(粗體字)
#! /bin/bash
VAL=`grep Failed /var/log/secure | awk '{print $(NF-3)}' |cut -d: -f4 | sort | uniq -c |awk '{print $1"="$2}'`
for i in $VAL
do
NUM=`echo $i|awk -F= '{print $1}'`
IP=`echo $i|awk -F= '{print $2}'`
if [ $NUM -gt 5 ] && [ -z "`iptables -vnL INPUT|grep $IP`" ]
then
iptables -I INPUT -p tcp -s $IP -j REJECT --reject-with tcp-reset
echo "platinum log: `date` $IP($NUM)" >> /var/log/val.log
fi
done
iptables block ssh attempt 適用於Debian
#容忍值可以調高一點(粗體字)
#!/bin/bash
VAL=`grep Illegal /var/log/auth.log | awk '{print $10}' | sort | uniq -c | awk '{print $1"="$2}'`
for i in $VAL
do
NUM=`echo $i|awk -F= '{print $1}'`
echo $NUM
IP=`echo $i|awk -F= '{print $2}'`
echo $IP
if [ $NUM -gt 5 ] && [ -z "`iptables -vnL INPUT|grep $IP`" ]
then
iptables -I INPUT -p tcp -s $IP -j REJECT --reject-with tcp-reset
echo "platinum log: `date` $IP($NUM)" >> /var/log/val.log
fi
done
SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised)
在某些硬體spam 設備做將被隔離的信件撈回動作時, 會被exim 擋掉
錯誤訊息如下
SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised)
可以將exim 的檢查選項關閉
default 是開啟的
在main configure 內
加入
smtp_enforce_sync = false
可避免再發生上敘問題
錯誤訊息如下
SMTP protocol synchronization error (next input sent too soon: pipelining was not advertised)
可以將exim 的檢查選項關閉
default 是開啟的
在main configure 內
加入
smtp_enforce_sync = false
可避免再發生上敘問題
exim with DNS SPF
在exim 配置DNS SPF 檢查
在EXIM 上的應用在exim configure acl sector 加入
acl_check_rcpt:
#...
# Use spfquery to perform a pair of SPF checks (for details, see
# http://www.openspf.org/)
#
# This is quite costly in terms of DNS lookups (~6 lookups per mail). Do not
# enable if that's an issue. Also note that if you enable this, you must
# install "libmail-spf-query-perl" which provides the spfquery command.
# Missing libmail-spf-query-perl will trigger the "Unexpected error in
# SPF check" warning.
deny
message = [SPF] $sender_host_address is not allowed to send mail from \
${if def:sender_address_domain {$sender_address_domain}{$sender_helo_name}}. \
Please see http://www.openspf.org/why.html?sender=$sender_address&ip=$sender_host_address
log_message = SPF check failed.
condition = ${run{/usr/bin/spfquery --ip \"$sender_host_address\" \
--mail-from \"$sender_address\" --helo \"$sender_helo_name\"} \
{no}{${if eq {$runrc}{1}{yes}{no}}}}
defer
message = Temporary DNS error while checking SPF record. Try again later.
condition = ${if eq {$runrc}{5}{yes}{no}}
warn
message = Received-SPF: ${if eq {$runrc}{0}{pass}{${if eq {$runrc}{2}{softfail}\
{ ${if eq {$runrc}{3}{neutral}{${if eq {$runrc}{4}{unknown}\
{${if eq {$runrc}{6}{none}{error}}}}}}}}}}
condition = ${if le {$runrc}{6}{yes}{no}}
warn
log_message = Unexpected error in SPF check.
condition = ${if gt {$runrc}{6}{yes}{no}}
# Support for best-guess (see http://www.openspf.org/developers-guide.html)
warn
message = X-SPF-Guess: ${run{/usr/bin/spfquery --ip \"$sender_host_address\" \
--mail-from \"$sender_address\" \ --helo \"$sender_helo_name\" --guess true}\
{pass}{${if eq {$runrc}{2}{softfail}{${if eq {$runrc}{3}{neutral}{${if eq {$runrc}{4}{unknown}\
{${if eq {$runrc}{6}{none}{error}}}}}}}}}}
condition = ${if le {$runrc}{6}{yes}{no}}
defer
message = Temporary DNS error while checking SPF record. Try again later.
condition = ${if eq {$runrc}{5}{yes}{no}}[img][/img]
簡單來說
DNS SPF record 應先配置在dns server 上
而DNS SPF check 則應在該機制成熟後加入,減少spam 信件
在EXIM 上的應用在exim configure acl sector 加入
acl_check_rcpt:
#...
# Use spfquery to perform a pair of SPF checks (for details, see
# http://www.openspf.org/)
#
# This is quite costly in terms of DNS lookups (~6 lookups per mail). Do not
# enable if that's an issue. Also note that if you enable this, you must
# install "libmail-spf-query-perl" which provides the spfquery command.
# Missing libmail-spf-query-perl will trigger the "Unexpected error in
# SPF check" warning.
deny
message = [SPF] $sender_host_address is not allowed to send mail from \
${if def:sender_address_domain {$sender_address_domain}{$sender_helo_name}}. \
Please see http://www.openspf.org/why.html?sender=$sender_address&ip=$sender_host_address
log_message = SPF check failed.
condition = ${run{/usr/bin/spfquery --ip \"$sender_host_address\" \
--mail-from \"$sender_address\" --helo \"$sender_helo_name\"} \
{no}{${if eq {$runrc}{1}{yes}{no}}}}
defer
message = Temporary DNS error while checking SPF record. Try again later.
condition = ${if eq {$runrc}{5}{yes}{no}}
warn
message = Received-SPF: ${if eq {$runrc}{0}{pass}{${if eq {$runrc}{2}{softfail}\
{ ${if eq {$runrc}{3}{neutral}{${if eq {$runrc}{4}{unknown}\
{${if eq {$runrc}{6}{none}{error}}}}}}}}}}
condition = ${if le {$runrc}{6}{yes}{no}}
warn
log_message = Unexpected error in SPF check.
condition = ${if gt {$runrc}{6}{yes}{no}}
# Support for best-guess (see http://www.openspf.org/developers-guide.html)
warn
message = X-SPF-Guess: ${run{/usr/bin/spfquery --ip \"$sender_host_address\" \
--mail-from \"$sender_address\" \ --helo \"$sender_helo_name\" --guess true}\
{pass}{${if eq {$runrc}{2}{softfail}{${if eq {$runrc}{3}{neutral}{${if eq {$runrc}{4}{unknown}\
{${if eq {$runrc}{6}{none}{error}}}}}}}}}}
condition = ${if le {$runrc}{6}{yes}{no}}
defer
message = Temporary DNS error while checking SPF record. Try again later.
condition = ${if eq {$runrc}{5}{yes}{no}}[img][/img]
簡單來說
DNS SPF record 應先配置在dns server 上
而DNS SPF check 則應在該機制成熟後加入,減少spam 信件
exim with maildir
platform :centos 5 , exim 4.69
begin routers 區段
localuser:
driver = accept
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
transport = maildir_delivery
cannot_route_message = Unknown user
begin transports 區段
maildir_delivery:
driver = appendfile
directory = /home/$local_part/maildir
delivery_date_add
envelope_to_add
return_path_add
maildir_format
check_string =
restart exim services .
log
2008-09-02 13:23:07 1KaOM7-0001P7-Bc <= lalala@mail.abc.com.tw H=mail.proeurotex.com.tw [123.123.123.123] P=esmtp S=823 id=200809020523.m825NCvl022516@mail.abc.com.tw
2008-09-02 13:23:07 1KaOM7-0001P7-Bc => admin R=localuser T=maildir_delivery
2008-09-02 13:23:07 1KaOM7-0001P7-Bc Completed
驗證一下 , 使用者家目錄
產生了maidlr 此目錄 內有cur new tmp 目錄
在new 目錄
1220332987.H475850P5403.andrew.usnei.net
在imap pop3 server 我使用dovecot
在 /etc/dovecot.conf 內
加入
mail_location = maildir:~/maildir
如果要使用ipop3 的話 ,
我不確定有沒有支援
同時我也不建議, ipop3 基本上已經過時了
dovecot 支援較多的功能
效能也一直隨著版本更新改善
begin routers 區段
localuser:
driver = accept
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
transport = maildir_delivery
cannot_route_message = Unknown user
begin transports 區段
maildir_delivery:
driver = appendfile
directory = /home/$local_part/maildir
delivery_date_add
envelope_to_add
return_path_add
maildir_format
check_string =
restart exim services .
log
2008-09-02 13:23:07 1KaOM7-0001P7-Bc <= lalala@mail.abc.com.tw H=mail.proeurotex.com.tw [123.123.123.123] P=esmtp S=823 id=200809020523.m825NCvl022516@mail.abc.com.tw
2008-09-02 13:23:07 1KaOM7-0001P7-Bc => admin
2008-09-02 13:23:07 1KaOM7-0001P7-Bc Completed
驗證一下 , 使用者家目錄
產生了maidlr 此目錄 內有cur new tmp 目錄
在new 目錄
1220332987.H475850P5403.andrew.usnei.net
在 /etc/dovecot.conf 內
加入
mail_location = maildir:~/maildir
如果要使用ipop3 的話 ,
我不確定有沒有支援
同時我也不建議, ipop3 基本上已經過時了
dovecot 支援較多的功能
效能也一直隨著版本更新改善
2009年2月11日 星期三
訂閱:
意見 (Atom)