mr_a
#1
คือได้ดำเนินการ block ip ทั้งวงเลยคือ 180.76.4.xxx
ลอง netstat ก็ไม่มี การเชื่อมต่อแล้ว
[root@ns1 public_html]# netstat -an |grep 180.76
[root@ns1 public_html]#
แต่ทาง isp ยังแจ้งว่า ip ผมมีการทำ upd port 53 ไปที่ ip ดังกล่าว ตาม log ด้านล่าง เลยไม่รู้ว่ามันไปได้อย่างไร และเราจะ block มันได้อย่างไร
เท่าที่ทราบ port 53 คือ dns ใช่ไหมครับ จะปิดก็ไม่ได้
ขอบคุณมากครับ
Po14 202.57.160.xxx Gi5/1 180.76.4.51 11 0035 087C 65
Gi5/1 180.76.4.60 Po14 202.57.160.xxx 11 085E 0035 72
Po14 202.57.160.xxx Gi5/1 180.76.4.60 11 0035 085E 64
Gi5/1 180.76.4.49 Po14 202.57.160.xxx 11 0871 0035 133
Po14 202.57.160.xxx Gi5/1 180.76.4.49 11 0035 0871 126
Gi5/1 180.76.4.175 Po14 202.142.223.162 11 041C 0035 134
Po14 202.142.223.162 Gi5/1 180.76.4.175 11 0035 041C 126
icez
#2
มันเป็น UDP ครับ netstat ไม่เจอ
mr_a
#3
แล้วเราจะ block มันได้ไหมอะครับ
ใช้อันนี้ จะช่วยได้ไหมครับ
iptables -A OUTPUT -p udp -m owner --uid-owner cat /etc/passwd|grep apache: |cut -d: -f3
--dport ! 53 -j DROP
ขอบคุณมากครับ
mr_a
#4
ผมลองเช็คจาก iptraf มันมีการส่ง upd จริงๆด้วยส่งไม่หยุดเลย แต่ไม่รู้ว่าจะเช็คได้จากตรงไหน ว่าใครส่ง พอมีทางไหมครับ
ขอบคุณครับ
mr_a
#6
ขอบคุณคุณไอท์ มากครับ
น่าจะเป็น udp flood นะครับ ส่ง package เล้กๆจำนวนมาก

icez
#7
อันนี้มันถูกส่งเข้ามาจาก 180.76.4.x น่ะครับ ต้นทางเป็น baidu server ลอง tcpdump ดูน่าจะเจออะไรประมาณนี้
ไม่รู้ว่า baidu ทำเองหรือโดน spoof แต่เท่าที่ดูก็น่าจะทำเองครับ
12:33:29.679193 IP 180.76.4.207.1049 > *********8.218.53: 35840+ A? th.hao123.com. (31)
12:33:29.679687 IP 180.76.4.32.1051 > *********8.149.53: 37632+ A? th.hao123.com. (31)
12:33:29.680332 IP 180.76.4.142.1615 > *********7.178.53: 43008+ A? th.hao123.com. (31)
12:33:29.680678 IP 180.76.4.39.1055 > *********8.177.53: 42496+ A? th.hao123.com. (31)
12:33:29.681439 IP 180.76.4.40.1056 > *********8.225.53: 42752+ A? th.hao123.com. (31)
12:33:29.682304 IP 180.76.4.112.2460 > *********6.180.53: 41984+ A? th.hao123.com. (31)
12:33:29.683212 IP 180.76.4.107.2444 > *********8.17.53: 43776+ A? th.hao123.com. (31)
12:33:29.715031 IP 180.76.4.115.2480 > *********8.218.53: 35072+ A? th.hao123.com. (31)
12:33:29.716792 IP 180.76.4.203.1044 > *********6.180.53: 41216+ A? th.hao123.com. (31)
12:33:29.717583 IP 180.76.4.252.1042 > *********8.224.53: 44032+ A? th.hao123.com. (31)
12:33:29.718471 IP 180.76.4.229.1041 > *********8.149.53: 36864+ A? th.hao123.com. (31)
12:33:29.718982 IP 180.76.4.179.1042 > *********8.220.53: 35584+ A? th.hao123.com. (31)
12:33:29.719563 IP 180.76.4.44.1043 > *********7.178.53: 42240+ A? th.hao123.com. (31)
12:33:29.719769 IP 180.76.4.114.2445 > *********6.219.53: 36096+ A? th.hao123.com. (31)
12:33:29.720787 IP 180.76.4.51.2163 > *********8.19.53: 42496+ A? th.hao123.com. (31)
12:33:29.721385 IP 180.76.4.166.1622 > *********8.9.53: 43264+ A? th.hao123.com. (31)
12:33:29.721396 IP 180.76.4.165.1604 > *********8.133.53: 43520+ A? th.hao123.com. (31)
12:33:29.722383 IP 180.76.4.169.1622 > *********8.177.53: 41728+ A? th.hao123.com. (31)
12:33:29.723428 IP 180.76.4.44.1049 > *********8.220.53: 46848+ A? th.hao123.com. (31)
12:33:29.723693 IP 180.76.4.179.1053 > *********9.34.53: 47616+ A? th.hao123.com. (31)
12:33:29.724491 IP 180.76.4.49.2162 > *********8.9.53: 54528+ A? th.hao123.com. (31)
12:33:29.725550 IP 180.76.4.209.1048 > *********7.178.53: 53504+ A? th.hao123.com. (31)
12:33:29.725595 IP 180.76.4.169.1634 > *********7.195.53: 55040+ A? th.hao123.com. (31)
12:33:29.726116 IP 180.76.4.60.2143 > *********8.224.53: 55296+ A? th.hao123.com. (31)
12:33:29.726431 IP 180.76.4.7.1050 > *********8.240.53: 46592+ A? th.hao123.com. (31)
ประเด็นคือเราไม่ได้ยิงออก และเป็นการตอบ request dns ตามปกติครับ ไม่ใช่เครื่องมีปัญหา แต่บังเอิญมัน request มาถี่ยิบเลย
mr_a
#8
ปัญหา คือมันยิงออก ปัญหาคือเป็นลิงค์ inter นะครับ ซึ่งมีค่อนข้างจำกัด
จนทำให้ port หมดไปเยอะเลยนะครับ แบบนี้ เราปิด บล็อคได้ไหมอะครับ แบบไม่ตอบกลับนะครับ
ขอบคุณมากครับ
icez
#9
iptables -I INPUT -s 180.76.0.0/16 -p udp --dport 53 -j DROP
แค่นี้พอครับ
อ้อ ในเครื่องต้องไม่มี csf/apf นะครับ ถ้ามีก็ไปแก้ตามมีตามเกิดของแต่ละ app เอาเอง
mr_a
#10
ใช่เลยครับ แต่ใน csf นะครับ มันทำให้ iptables ไม่ทำงานเหรอครับ เพราะลองแล้วก็ไม่ได้นะครับ
13:56:14.025549 IP 180.76.4.49.2161 > xxx.xxx.xxx.x65.53: 55040+ A? th.hao123.com. (31)
13:56:14.065559 IP 180.76.4.51.2172 > xxx.xxx.xxx.x65.53: 44288+ A? th.hao123.com. (31)
13:56:14.150832 IP 180.76.4.188.1039 > xxx.xxx.xxx.x65.53: 26880+ A? th.hao123.com. (31)
13:56:14.197728 IP 180.76.4.145.1643 > xxx.xxx.xxx.x65.53: 1280+ A? th.hao123.com. (31)
13:56:14.201669 IP 180.76.4.60.2142 > xxx.xxx.xxx.x65.53: 36096+ A? th.hao123.com. (31)
13:56:14.235668 IP 180.76.4.101.2413 > xxx.xxx.xxx.x65.53: 19968+ A? th.hao123.com. (31)
13:56:14.250278 IP 180.76.4.88.2478 > xxx.xxx.xxx.x65.53: 46592+ A? th.hao123.com. (31)
13:56:14.273198 IP 180.76.4.215.1050 > xxx.xxx.xxx.x65.53: 63488+ A? th.hao123.com. (31)
13:56:14.414665 IP 180.76.4.64.2207 > xxx.xxx.xxx.x65.53: 31488+ A? th.hao123.com. (31)
13:56:14.429664 IP 180.76.4.68.2183 > xxx.xxx.xxx.x65.53: 33792+ A? th.hao123.com. (31)
13:56:14.437773 IP 180.76.4.164.1634 > xxx.xxx.xxx.x65.53: 2048+ A? th.hao123.com. (31)
13:56:14.476542 IP 202.142.223.228.53054 > 239.2.11.71.8649: UDP, length 8
13:56:14.476555 IP 202.142.223.228.53054 > 239.2.11.71.8649: UDP, length 8
13:56:14.485230 IP 180.76.4.49.2161 > xxx.xxx.xxx.x65.53: 63488+ A? th.hao123.com. (31)
13:56:14.524519 IP 180.76.4.51.2172 > xxx.xxx.xxx.x65.53: 52736+ A? th.hao123.com. (31)
13:56:14.610053 IP 180.76.4.188.1039 > xxx.xxx.xxx.x65.53: 35328+ A? th.hao123.com. (31)
13:56:14.620869 IP 180.76.4.145.1643 > xxx.xxx.xxx.x65.53: 9728+ A? th.hao123.com. (31)
13:56:14.660689 IP 180.76.4.60.2142 > xxx.xxx.xxx.x65.53: 44544+ A? th.hao123.com. (31)
13:56:14.695923 IP 180.76.4.101.2413 > xxx.xxx.xxx.x65.53: 28416+ A? th.hao123.com. (31)
13:56:14.710239 IP 180.76.4.88.2478 > xxx.xxx.xxx.x65.53: 55040+ A? th.hao123.com. (31)
13:56:14.733214 IP 180.76.4.215.1050 > xxx.xxx.xxx.x65.53: 6400+ A? th.hao123.com. (31)
13:56:14.874755 IP 180.76.4.64.2207 > xxx.xxx.xxx.x65.53: 39936+ A? th.hao123.com. (31)
13:56:14.888719 IP 180.76.4.68.2183 > xxx.xxx.xxx.x65.53: 42240+ A? th.hao123.com. (31)
13:56:14.899491 IP 180.76.4.164.1634 > xxx.xxx.xxx.x65.53: 10496+ A? th.hao123.com. (31)
13:56:14.949376 IP 180.76.4.49.2161 > xxx.xxx.xxx.x65.53: 6400+ A? th.hao123.com. (31)
13:56:14.989405 IP 180.76.4.51.2172 > xxx.xxx.xxx.x65.53: 61184+ A? th.hao123.com. (31)
icez
#11
csf มัน override การทำงานของ iptables ครับ rule ที่เขียนไว้นอก csf จะโดนลบหมด
ความเห็นส่วนตัวคือ ผมเกลียด csf / apf ครับ iptables เพียวๆ ดีกว่าเยอะ ง่ายกว่า ไม่เรื่องมาก
kke
#12
ใช้ csf ก็สั่ง block ผ่าน csf สิครับ มันมีคำสั่งของมัน
หรือถ้าใช้ da ก็เข้าไป block ผ่านหน้า da ได้เลย
apf ก็ทำนองเดียวกับ csf แต่ไม่มีหน้าจัดการผ่าน da
mr_a
#13
ผมลองแล้วนะครับ ใช้ผ่าน DA ผ่าน quick deny แล้วก็ไปดูที่ firewal deny ip
180.76.4.101 # Manually denied - Wed Nov 6 10:44:36 2013
180.76.4.88 # Manually denied - Wed Nov 6 10:44:46 2013
180.76.4.215 # Manually denied - Wed Nov 6 10:44:57 2013
แต่พอ tcpdump ก็ยังเข้ามาได้อยู่ดี
10:45:16.834023 IP 180.76.4.101.2413 > 202.142.223.165.53: 63488+ A? th.hao123.com. (31)
รบกวนสอบถามหน่อยนะครับ ไม่แน่ใจว่าถ้าเป็น CSF ต้อง block อย่างไรเหรอครับ
[root@ns165 ~]# service csf status
Status of csf:Chain INPUT (policy DROP 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 1794K 106M DROP udp – * * 180.76.0.0/16 0.0.0.0/0 udp dpt:53
2 0 0 ACCEPT tcp – !lo * 202.57.160.129 0.0.0.0/0 tcp dpt:53
3 18 1324 ACCEPT udp – !lo * 202.57.160.129 0.0.0.0/0 udp dpt:53
4 20 9822 ACCEPT tcp – !lo * 202.57.160.129 0.0.0.0/0 tcp spt:53
5 116K 18M ACCEPT udp – !lo * 202.57.160.129 0.0.0.0/0 udp spt:53
6 7571K 835M LOCALINPUT all – !lo * 0.0.0.0/0 0.0.0.0/0
7 430K 793M ACCEPT all – lo * 0.0.0.0/0 0.0.0.0/0
ขอบคุณมากครับ
icez
#14
ขาเข้ายังไงก็เห็นครับ มันคือ udp คุณทำได้แค่ block ไม่ให้ตอบกลับ