สงสัยเรื่อง iptables ครับ
ก่อนหน้านี้ใช้ ubuntu ทำระบบไวเลส Coovachilli กับ Freeradius ใช้งานได้ปกติดี
แต่จะเปลี่ยนมาเป็น Debian
ทำเหมือนกันหมดแต่ติดตรง iptables ครับ
เริ่มจากคำสั่งนี้ไม่ได้
iptables -t nat -A POSTROUTING -o $HS_WANIF -j LOG --log-level DEBUG
จะ redirect ไปใช้ proxy ก็ไม่ได้
iptables -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
ต้องไปแก้ Config ใน Coova แทนด้วย
HS_TCP_PORTS=”80 443 3128”
HS_POSTAUTH_PROXY=xxx.xxx.xxx.xxx
HS_POSTAUTH_PROXYPORT=3128
ที่สำคัญ Block Bit-torrent ด้วยคำสั่งนี้ก็ไม่ได้
#block bittorrent
# Algo string
iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROP
iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
iptables -A FORWARD -m string --algo bm --string "torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce" -j DROP
iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROP
iptables -A FORWARD -m string --algo bm --string "/default.ida?" -j DROP #codered virus
iptables -A FORWARD -m string --algo bm --string ".exe?/c+dir" -j DROP #nimda virus
iptables -A FORWARD -m string --algo bm --string ".exe?/c_tftp" -j DROP #nimda virus
# bittorrent key
iptables -A FORWARD -m string --string "peer_id" --algo kmp --to 65535 -j DROP
iptables -A FORWARD -m string --string "BitTorrent" --algo kmp --to 65535 -j DROP
iptables -A FORWARD -m string --string "BitTorrent protocol" --algo kmp --to 65535 -j DROP
iptables -A FORWARD -m string --string "bittorrent-announce" --algo kmp --to 65535 -j DROP
iptables -A FORWARD -m string --string "announce.php?passkey=" --algo kmp --to 65535 -j DROP
# DHT keyword
iptables -A FORWARD -m string --string "info_hash" --algo kmp --to 65535 -j DROP
iptables -A FORWARD -m string --string "get_peers" --algo kmp --to 65535 -j DROP
iptables -A FORWARD -m string --string "announce" --algo kmp --to 65535 -j DROP
iptables -A FORWARD -m string --string "announce_peers" --algo kmp --to 65535 -j DROP
#block bittorrent
ต้องไป Block ใน Squid แทน
#Block Bittorrent
acl block_bittorrent url_regex -i passkey announce tracker info_hash peer \.torrent$
http_access deny block_bittorrent
#Block Bittorrent
Block แบบนี้มันได้แต่เว็บที่ต้องเป้นสมาชิกครับ Block พวกนี้ไม่ได้ http://btjunkie.org/
อยากให้ช่วยแนะนำทีครับว่าทำไมใช้ iptable พวกนั้นไม่ได้ครับ ผมต้องทำอะไรเพิ่มอีกหรือป่าวครับ
ขอบคุณครับ
|
ลิขสิทธิ์ของบทความเป็นของเจ้าของบทความแต่ละชิ้น ผลงานนี้ ใช้สัญญาอนุญาตของครีเอทีฟคอมมอนส์แบบ แสดงที่มา-อนุญาตแบบเดียวกัน 3.0 ที่ยังไม่ได้ปรับแก้ |
















Re: สงสัยเรื่อง iptables ครับ
>> ก่อนหน้านี้ใช้ ubuntu ทำระบบไวเลส Coovachilli กับ Freeradius ใช้งานได้ปกติดี
>> แต่จะเปลี่ยนมาเป็น Debian ทำเหมือนกันหมดแต่ติดตรง iptables ครับ
ใช้ Debian รุ่นไหนครับ และ Kernel รุ่นอะไรครับ
>> เริ่มจากคำสั่งนี้ไม่ได้
>> iptables -t nat -A POSTROUTING -o $HS_WANIF -j LOG --log-level DEBUG
$HS_WANIF ตั้งค่าถูกต้องไหมครับ และตอนที่สั่ง iptables แจ้งอะไรกลับมาครับ
>> ที่สำคัญ Block Bit-torrent ด้วยคำสั่งนี้ก็ไม่ได้
>> #block bittorrent
>> # Algo string
>> iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP
>> iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
>> ...
>> ...
>> ============= 8< ==============
module string ต้องการ linux kernel >= 2.6.14 แต่ถ้า kernel เป็นรุ่นที่ใหม่กว่าแล้ว น่าจะเป็นปัญหาที่ส่วนอื่นครับ
ผลที่ได้จากการสั่งคำสั่ง iptables แจ้งอะไรกลับมาครับ
___
Neutron: Linux Addict!
Re: สงสัยเรื่อง iptables ครับ
uname -a ได้แบบนี้ครับ
Linux wireless 2.6.26-2-686 #1 SMP Mon Jun 21 05:58:44 UTC 2010 i686 GNU/Linux
ต้องแก้ไงต่อครับ
เป้นไปได้ไหมครับตอนที่ผมติดตั้ง Debian 5.0.4 ผมอัพเดทแล้วอัพเกรด เหมือนมันมีการอัพเดท kernel ด้วย มันเลยผิดปกติตรงนี้หรือป่าวครับ
Re: สงสัยเรื่อง iptables ครับ
การ block แบบ -m string เป็นการ block content ไม่ได้ block ที่ header อย่างเช่นไฟล html มีคำๆ ที่ว่านี้ ก็จะ load ต่อไปไม่ได้ครับ