• About
  • Policy
  • Contact

Phan Anh Buổi Sáng

  • Home
  • Kiến thức IT
    • PSD
    • Blogger
  • Translate
Google
Custom Search
Trang chủ » Security » TUTORIALS » Sử dụng Iptables chống Syn Flood attacks và cấm IP

Sử dụng Iptables chống Syn Flood attacks và cấm IP

Unknown Labels: Security, TUTORIALS Leave A Comment 20:19
Syn flood là 1 dạng tấn công từ chối dịch vụ, kẻ tấn công gửi các gói tin kết nối SYN đến hệ thống. Đây là 1 loại tấn công rất phổ biến. Loại tấn công này sẽ nguy hiểm nếu hệ thống cấp phát tài nguyên ngay sau khi nhận gói tin SYN từ kẻ tấn công và trước khi nhận gói ACK.
Nếu việc thiết lập kết nối chưa hòan tất 3 bước đây đủ (gọi là half-open connection) mà buộc hệ thống server phải cấp tài nguyên để quản lý thì kẻ tấn công có thể lấy hết tài nguyên của hệ thống server bằng các “flooding” vào server với các gói tin SYN. Syn flood là 1 dạng tấn công phổ biến và nó có thể được ngăn chặn bằng đoạn lệnh iptables sau:
Mã:
iptables -A INPUT -p tcp --syn -m limit --limit 1/s --limit-burst 3 -j RETURN
Tất cả các kết nối đến hệ thống chỉ được phép theo các thông số giới hạn sau:
–limit 1/s: Tốc độ truyền gói tin trung bình tối đa 1/s (giây)
–limit-burst 3: Số lượng gói tin khởi tạo tối đa được phép là 3

Dùng iptables, thêm rule sau vào:
Trích:
# Limit the number of incoming tcp connections
# Interface 0 incoming syn-flood protection
iptables -N syn_flood
iptables -A INPUT -p tcp –syn -j syn_flood
iptables -A syn_flood -m limit –limit 1/s –limit-burst 3 -j RETURN
iptables -A syn_flood -j DROP
iptables -I INPUT -p tcp -s 0/0 -d $SERVER_IP –sport 513:65535 –dport 22 -m state –state NEW,ESTABLISHED -m recent –set -j ACCEPT iptables -I INPUT -p tcp –dport 22 -m state –state NEW -m recent –update –seconds 600 –hitcount 11 -j DROP
iptables -A OUTPUT -p tcp -s $SERVER_IP -d 0/0 –sport 22 –dport 513:65
#!/bin/bash
IPT=/sbin/iptables
SPAMLIST=”spamlist”
SPAMDROPMSG=”SPAM LIST DROP”
BADIPS=$(egrep -v -E “^#|^$” /root/iptables/blocked.ips)
# create a new iptables list
$IPT -N $SPAMLIST
for ipblock in $BADIPS
do
$IPT -A $SPAMLIST -s $ipblock -j LOG –log-prefix “$SPAMDROPMSG”
$IPT -A $SPAMLIST -s $ipblock -j DROP
done
$IPT -I INPUT -j $SPAMLIST
$IPT -I OUTPUT -j $SPAMLIST
$IPT -I FORWARD -j $SPAMLIST
#!/bin/bash
# Ban quyen thuoc ve Hanh_bk
/etc/init.d/iptables start
cd /root/iptables
netstat -atun | grep SYN_RECV | awk ‘{print $5}’ | cut -d: -f1 |sort | uniq -d | sort -n > blocked.ips
sh ./iptables.sh

Bài viết liên quan

← Bài đăng mới hơn Bài đăng cũ hơn → Trang chủ
Powered by Blogger.

Các Bình Luận Gần Đây

Bài đăng phổ biến

  • PSD - Xin Hãy Rời Xa
    Download PSD
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Đôi lúc em tránh ánh mắt của anh. vì dường như lúc nào em cũng hiểu thấu lòng anh Demo Cover Download PSD loading...
  • 403 Forbidden and cant read /etc/named.conf Error Bypass
    This Tut has been submitted by Sen Haxor Now days most of the 2012 Linux Kernel server show this error when you try to symlink the serve...
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • PSD - Người & Ta
    DOWNLOAD PSD
  • vBulletin 5 Multiple Full Path Disclosure vulnerabilities
    /core/vb5/route/channel.php /core/vb5/route/conversation.php /core/vb5/route/*.php /includes/api/ interface /noncollapsed.php /includes/api/...
  • Tấn công PHP File Inclusion
    Thấy có người thắc mắc về vụ File inclusion này,mình sẽ lập 1 topic để giải đáp mọi vấn đề Local File Inclusion Basic Level: ví dụ trong trư...
  • Bandicam Full Crack - Duy Ripper
     
  • [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog
    [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog B1 : Fake IP Th ổ Nhĩ Kì B2 : Vô Link RIP:  http://ouo.io/G9AbfU - Ch ọ n 9 năm - C...

Pageviews from the past week

Chuyên mục

Bài đăng phổ biến

  • PSD - Xin Hãy Rời Xa
    PSD - Xin Hãy Rời Xa
    Download PSD
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Đôi lúc em tránh ánh mắt của anh. vì dường như lúc nào em cũng hiểu thấu lòng anh Demo Cover Download PSD loading...
  • 403 Forbidden and cant read /etc/named.conf Error Bypass
    This Tut has been submitted by Sen Haxor Now days most of the 2012 Linux Kernel server show this error when you try to symlink the serve...
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • PSD - Người & Ta
    PSD - Người & Ta
    DOWNLOAD PSD
  • vBulletin 5 Multiple Full Path Disclosure vulnerabilities
    /core/vb5/route/channel.php /core/vb5/route/conversation.php /core/vb5/route/*.php /includes/api/ interface /noncollapsed.php /includes/api/...
  • Tấn công PHP File Inclusion
    Thấy có người thắc mắc về vụ File inclusion này,mình sẽ lập 1 topic để giải đáp mọi vấn đề Local File Inclusion Basic Level: ví dụ trong trư...
  • Bandicam Full Crack - Duy Ripper
    Bandicam Full Crack - Duy Ripper
     
  • [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog
    [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog
    [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog B1 : Fake IP Th ổ Nhĩ Kì B2 : Vô Link RIP:  http://ouo.io/G9AbfU - Ch ọ n 9 năm - C...
Google
Custom Search
Support: Facebook | Twitter | Google+ | Giới thiệu
Copyright © 2015 • Phan Anh Buổi Sáng • All Right Reserved. Template by Template Việt