Skip to content

Commit 482510f

Browse files
authored
2022/0003 (#13)
* 2022/0003 * update content
1 parent a634606 commit 482510f

File tree

6 files changed

+38
-0
lines changed

6 files changed

+38
-0
lines changed

2022/0003-assets/dropped-packets.png

127 KB
Loading
340 KB
Loading

2022/0003-assets/gcp-max-certs.png

130 KB
Loading

2022/0003-assets/high-packets.png

125 KB
Loading

2022/0003-no-reverse-proxy-ddos.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# อย่าเปิด Reverse Proxy เองถ้าไม่มีระบบป้องกัน DDoS
2+
3+
> บทความนี้มาเล่าว่าทำไมเราถึงไม่ควรเปิด reverse proxy ให้ทุกคนเข้ามาจาก Internet ได้
4+
5+
## เล่าที่มา
6+
7+
เนื่องจากระบบของผมต้องรองรับ HTTPS จากหลาย ๆ domains ทำให้ไม่สามารถใช้ L7 Load Balancer ได้ เพราะโดนข้อจำกัดตรงที่จำนวน Ceritificate ที่สามารถเพิ่มได้อย่างจำกัด
8+
9+
![gcp-max-certs](./0003-assets/gcp-max-certs.png)
10+
11+
เลยมีความจำเป็นที่จะต้องใช้ Network Load Balancer แล้วส่งตรงเข้า Instance Group ของ Ingress ทำให้เวลามีคนเข้าเว็บ คน ๆ นั้นจะต้อง connect TCP ตรงกับ VM ของเรา
12+
13+
## ปัญหา
14+
15+
พอ VM เรารับ TCP ตรง ๆ จาก user ก็อาจจะมีคนไม่หวังดีส่งจำนวน network packet มาเยอะมาก ๆ จน OS ไม่สามารถ process ได้ทัน ทำให้ reverse proxy เราล่มได้
16+
17+
![gcp-max-certs](./0003-assets/high-packets.png)
18+
19+
ถึงแม้เราจะ scale up vCPU ไปเยอะมาก ๆ แต่ก็โดน limit จาก Cloud Provider อยู่ดี
20+
21+
![gcp-ingress-limit](./0003-assets/gcp-ingress-limit.png)
22+
23+
## วิธีแก้ปัญหา
24+
25+
จริง ๆ วิธีแก้ปัญหามีหลายวิธี เช่น
26+
27+
1. ก็ย้ายไปใช้ Cloud ที่มีระบบป้องกัน L4 DDoS สิ
28+
29+
มี Cloud หลายเจ้าที่มีระบบป้องกัน L4 DDoS เราสามารถย้ายทั้งระบบไป หรือจะย้ายแค่ reverse proxy ไปก็ได้ เราก็จะมีระบบป้องกัน DDoS ที่เป็น Network layer
30+
31+
1. ใช้ DDoS Protection Provider
32+
33+
เช่น Cloudflare แน่นอนว่ามีค่าใช้จ่ายค่อนข้างสูง(มาก)
34+
35+
## สรุป
36+
37+
เราไม่ควรรัน reverse proxy แล้วเปิด port ให้เข้ามาจาก Internet ถ้า Cloud ที่ใช้ไม่มี service DDoS protection มาให้

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## 2022
66

7+
- [0003 - อย่าเปิด Reverse Proxy เองถ้าไม่มีระบบป้องกัน DDoS](./2022/0003-no-reverse-proxy-ddos.md)
78
- [0002 - Max HTTP Header Size](./2022/0002-max-http-header.md)
89
- [0001 - Concurrent Queue Ratelimit](./2022/0001-concurrent-queue-ratelimit.md)
910

0 commit comments

Comments
 (0)