Tuesday, November 11, 2008

ส่งเมล์ผ่าน endian firewall มี error ดังนี้

สถานการณ์

ส่งเมล์ด้วยโปรแกรม mail ใน vista ส่งถึงผู้รับชื่อ xxx@gmail.com ตรวจสอบใน endian ด้วยคำสั่ง
mailq พบ error เช่นนี้แล


885F718F3C8 3470 Wed Nov 12 13:25:05 MAILER-DAEMON
(host mx5.isp.com[ipaddr] said: 452 Too many recipients received this hour (in reply to RCPT TO command))it_xx@xxx.co.th

ปัญหานี้ยังไม่ได้แก้
บันทึกไว้เป็นความจำ

วันที่และเวลาใน log ของ squid

ความเห็น 1

Open your squid.conf and search for the line that starts with access_log or cache_access_log and looks like:

Code:
access_log /var/log/squid/access.log squidOf course the path to the logfile may vary in your case.
Note the last keyword (in this case squid, but it could be common, combined, squidmime). Then look for the line that starts with logformat and change "%ts.%03tu" with "%tl" fro local time or "%tg" fro GMT time. If the line does not exist you should add it. For the above example it should changed from:

Code:
logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %
Code:
logformat squid %tl %6tr %>a %Ss/%03Hs %============
ความเห็น 2
emulate_httpd_log on

This is explained in the squid.conf.default:

# TAG: emulate_httpd_log on|off
# The Cache can emulate the log file format which many 'httpd'
# programs use. To disable/enable this emulation, set
# emulate_httpd_log to 'off' or 'on'. The default
# is to use the native log format since it includes useful
# information Squid-specific log analyzers use.
#
#Default:
# emulate_httpd_log off

ขอบคุณ
http://www.linuxquestions.org/questions/linux-general-1/adding-date-and-time-to-squid-access.log-589410/

Thursday, November 6, 2008

ผู้ใช้เปลี่ยนพาสเวิร์ดมี error

ในกรณีที่่ทำเป็น Authenticated ด้วย proxy แล้วให้ผู้ใช้งานสามารถเปลี่ยนพาสเวิร์ดด้วยตนเองโดยเข้าไปที่
https://endian:10443/cgi-bin/chpasswd.cgi เมื่อคลิกเปลี่ยนพาสเวิร์ดแล้วกลับมี error

E R R O R E R R O R: Username does not exist

What problem and how to solved this ?

Endian community กับปัญหาที่รอคำตอบ?????

1. ต่ออินเทอร์เน็ต 2 line คือ 1. True 2 MB 2. True 1 MB ต้องการให้เส้นทางเดินเป็นดังนี้
1.1 port 8080/80/445 เป็นต้น วิ่งออกที่ 2 MB
1.2 port 25/110 เป็นต้นวิ่งออกทาง 1 MB
-------------------------------------
2. hotspot function ใน Endian community
3. IPcop update http blacklist จะถูก enable ตั้งแต่แรกติดตั้ง ส่วนใน endian จะ update โดยอัตนโนมัติได้อย่างไร ??
คำตอบ

BTW, this was posted to the nabble mail list archives:
#!/bin/sh
# update_blacklists.sh, 20070615
# Mike Tremaine
###################################

###################################
#Set up variables
###################################

dansguardian_start="/etc/init.d/dansguardian start"
dansguardian_stop="/etc/init.d/dansguardian stop"
dansguardian_conf="/etc/dansguardian/"
httpget="/usr/bin/curl"
tarpath="/bin/tar"
workdir="/tmp"
blacklist="http://squidguard.mesd.k12.or.us/blacklists.tgz"

##########################################
#Move to tmp and download
##########################################

cd $workdir
$httpget -O $blacklist || exit 1
$tarpath xzf $workdir/blacklists.tgz -C $workdir || exit 1
#Sanity check file we downloaded
if [ $(stat -c%s "$workdir/blacklist.tgz") -lt 4000001 ]; then
exit 1
fi

###########################################
#Updates lists
############################################

cp -pRf $workdir/blacklists $dansguardian_conf

#Restart
$dansguardian_stop
sleep 3
$dansguardian_start

#Cleanup
rm -f $workdir/blacklists.tgz
rm -r -f $workdir/blacklists

exit 0

http://efwsupport.com/index.php?topic=347.0

วิธีป้องกัน SSH Brute Force บน Endian Firewall

การป้องกันการจู่โจมด้วย ssh brute force สำหรับ endian ให้เพิ่ม iptables สำหรับกฏ INPUT
เพิ่มเติม มีวิธีการดังนี้

1. เปิดไฟล์ /etc/rc.d/rc.firewall.local
เพิ่ม iptables อีก 2 บรรทัด

iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 600 --hitcount 2 -j DROP

รูปแบบไฟล์หลังจากเพิ่มสองบรรทัดข้างบนแล้วจะเป็นดังนี้


#!/bin/sh
# Used for private firewall rules

# See how we were called.
case "$1" in
start)
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 600 --hitcount 2 -j DROP
## add your 'start' rules here
;;
stop)
## add your 'stop' rules here
;;
reload)
## add your 'reload' rules here
;;
*)
echo "Usage: $0 {start|reload|stop}"
esac

*********************

reboot endian firewall ใหม่

mrt2514
บ.ไอทีทริปเปิลพลัส จก.

Wednesday, November 5, 2008

Set Endian Firewall ส่ง Log ไปเก็บไว้ที่ Log Server

Endian Firewall เวอร์ชั่น 2.2 RC3 ใช้ syslog-ng เป็นตัวจัดการ log ทำให้สามารถส่ง log จากเครื่อง endian ไปยัง Log Server เพื่อจัดเก็บตาม พรบ. ได้อย่างมีประสิทธิภาพเยี่ยม ในบทความนี้จะแสดงวิธีการ config แบบย่อ ๆ โดยมีรูปแบบการจัดวาง server ดังนี้

1. Endian Firewall เป็นตัวกั้นกลางระหว่าง network ภายในกับ internet
2. Router ที่ต่อเข้า internet เป็น ZyXEL 660H ต่อผ่าน RED ของ Endian โดย set เป้น Bridge
3. Log Server ตั้งอยู่ที่ network ภายใน มีหมายเลข IP=192.168.2.249 ใช้ FC9 เป็น OS ใช้ syslog-ng
เป็นตัวจัดการ Log

ในที่นี้้จะกำหนดให้ endian เป็น gateway ของระบบ และเป็นตัวผลิต log กำหนดให้ FC9 เป็น Log Server

..... หลังจากที่ท่านได้ติดตั้ง endian และ FC เสร็จแล้วทุกอยางผ่านหมด server ทั้งสองสามารถคุยกันได้แล้วต่อไปเรามาเริ่ม config โดยเริ่มจากเครื่อง Log Server ก่อน โดยแก้ไขไฟล์ /etc/syslog-ng/syslog-ng.conf ดังนี้

ส่วนที่เพิ่มเติม ตอนท้ายไฟล

# Log from Endian Server
source s_endialserver {
udp(ip("0.0.0.0") port(514));
};

destination d_logserver {
file("/var/log/$R_YEAR$R_MONTH$DAY.log"
owner(root) group(adm) perm(665)
create_dirs(yes) dir_perm(0775));
};

log {
source(s_endianserver);
destination(d_logserver);
};


รูปแบบไฟล์เก็บ log จะมีรูปแบบ 20081103.log คือ ปีเดือนวัน

เสร็จจากเครื่อง log server แล้ว คราวนี้ก็ไป set ที่ endian firewall ต่อกันนะครับ

endian มีการเซ็ต log ผ่าน gui ที่หัวข้อ Logs->Settings แต่ว่าการใช้ gui นี้ยังไม่ประสบความสำเร็จตามที่ประสงค์ได้ จึงได้หันมาใช้การเซ็ตผ่านไฟล์ตรง ๆ ดีกว่าดูเข้าท่าและมีรายละเอียดเยอะดี

เก็บอะไรบ้าง ?
log ที่เราจะให้ endian ผลิตให้และนำไปเก็บไว้ที่ log server ได้แก่
1. Mail : จากใคร ไปถึงใคร หัวข้ออะไร สถานะเป็นอย่างไร โดยเก็บจาก /var/log/maillog
2. Authenticated การใช้ internet เก็บจาก squid
3. เส้นทางการเดินของ data นั้น ๆ เก็บจาก iptables

ขั้นตอน ;
1. ตรวจสอบไฟล์และไดเรกทอรี /etc/syslog/
configuration ในที่นี้คือ syslog.conf
/etc/syslog/syslog.d/
ไฟล์ที่สำคัญคือ firewall.tmp1,squid.tmp1,smtp.tmp1

1. แก้ไข template ไฟลื firewall.tmp1 โดยเพิ่ม
#firewall
destination logserver { udp("192.168.2.249" port(514)); };
destination d_firewall {
file("/var/log/firewall" owner("root") group("nobody") perm(0640));
};
filter f_firewall {
facility(local2);
};
log {
source(s_sys);
filter(f_firewall);
destination(d_firewall);
destination(logserver);};
};
2. แก้ไขไฟล์ squid.tmp1

#squid access
destination logserver {udp("192.168.2.249" port(514));};
destination d_squid_access {
file("/var/log/squid/access.log" owner("root") group("nobody") perm(0640));
};
destination d_squid_access_short {
file("/var/log/squid/access.log_short" template("\\$MSGONLY\n") owner("root") group("nobody") perm(0640));
};
filter f_squid {
facility(local6) and priority(info) and program(squid);
};
log {
source(s_sys);
filter(f_squid);
destination(d_squid_access);
destination(d_squid_access_short);
destination(logserver);};

};

3. แก้ไขไฟล์ smtp.tmp1

#mail
destination logserver { udp("192.168.2.249" port(514)); };
destination d_mail {
file("/var/log/maillog" owner("root") group("nobody") perm(0640));
};
destination d_mail_short {
file("/var/log/maillog_short" template("\\$MSGONLY\n") owner("root") group("root") perm(0640));
};
filter f_filter4 {
facility(mail) and not match('connect from localhost\[127.0.0.1\]');
};
log {
source(s_sys);
filter(f_filter4);
destination(d_mail);
destination(d_mail_short);
destination(logserver);};


Reboot endian firewall หรือจะโหลด /etc/init.d/syslog-ng reload ก้ได้
ลองกลับไปตรวจสอบดู log server ดูควรจะมี log ที่ส่งมาจาก endian server ให้ได้ชมแล้ว....

mrt2514
บ.ไอทีทิปเปิลพลัส จำกัด

Tuesday, November 4, 2008

Endian กับการติดตั้งโปรแกรมชุดพัฒนา

Endian Firewall ชุดติดตั้งไม่ได้ลงตัว library สำหรับกลุ่ม develop ให้ด้วย เช่น พวก gcc / kernel-header เป็นต้น ทำให้ไม่สามารถ compile โปรแกรมต่าง ๆ ที่ตัองติดตั้งเพื่อให้ endian มีความสามารถได้
แต่ปัญหานี้ทีม endian ได้เห็นความสำคัญจึงได้มีชุด endian develop ให้ดาวน์โหลด และติดตั้งลงใน endian
เพื่อให้สามารถ compile โปรแกรมเสริมอื่นๆ ได้อย่างลงตัว ผมได้ทดลอง โดยมีสถานการณ์ดังนี้
1. ติดตั้งชุด endian develop ลงในเครื่อง endian firewall
2. ติดตั้งโปรแกรม imspector เพื่อกรอง และดักจับข้อมูลการใช้ msn ต่าง ๆ

โดยมีขั้นตอน ดังนี้
1. ดาวน์โหลดชุด endian develop จาก www.endian.com
EFW-COMMUNITY-2.2-rc3-devel-rpms.tar.gz
2. นำไฟล์ไปวางไว้ใน endian firewall ด้วย WinSCP
3. เข้าไปที่ endian firewall และคลี่ไฟล์ออกมาด้วยคำสั่ง
tar xvfz EFW-COMMUNITY-2.2-rc3.devel-rpms.tar.gz
จะได้ไดเรกทอรี /RPMS/devel เข้าไปในไดเรกทอรี และใช้คำสั่ง
rpm -ivh *



โปรแกรมจะดำเนินการติดตั้งแพกเกจทั้งหมดจนแล้วเสร็จถึงตอนนี้ endian ของเราก็จะมีชุดคำสั่ง gcc และ make พร้อม
compile โปรแกรมแล้ว
4. ดาวน์โหลด imspector ไฟล์ .tar.gz และโยนไปไว้ใน endian เข้าไปคลี่ไฟล์ออก
5. compile ด้วยคำสั่งต่อไปนี้
make



make install



เราก็จะได้ไฟล์ imspector ไว้ใช้งานใน endian แล้ว

Twitter Delicious Facebook Digg Stumbleupon Favorites More