v1p
V2EX  ›  问与答

iptables 如何屏蔽代理访问?

  •  
  •   v1p · Oct 17, 2014 · 4324 views
    This topic created in 4400 days ago, the information mentioned may be changed or developed.
    一个明确为采集的IP段,用iptables屏蔽了(iptables -I INPUT -s 123.123.123.0/24 -j DROP)

    现在在nginx日志里发现这个IP段又改为使用代理访问,日志的 $http_x_forwarded_for 字段显示了已经DROP的这个IP段

    请教,如何用iptables屏蔽这种通过代理访问的源地址
    6 replies  •  2014-10-17 17:19:59 +08:00
    rex1901
    rex1901
    Oct 17, 2014
    1
    squid的acl可以指定header:
    acl deny_ip req_header X-Forwarded-For 123\.123\.123\..*
    http_access deny deny_ip
    v1p
    v1p
    OP
    Oct 17, 2014 via Android
    2
    @rex1901 nginx也可以,但还是用iptables效率高啊
    jasontse
    jasontse
    Oct 17, 2014 via Android
    3
    @v1p
    应用层协议处理不适合交给 iptables
    v1p
    v1p
    OP
    Oct 17, 2014
    4
    @jasontse 我是想知道iptables如何能够屏蔽这种代理访问
    lsylsy2
    lsylsy2
    Oct 17, 2014
    5
    @v1p 没办法,因为TCP/IP层看不到$http_x_forwarded_for
    goter
    goter
    Oct 17, 2014 via iPhone
    6
    iptables -A FORWARD -m string --string "mp3" -s ! 192.168.1.0/24 -j DROP lz可以试试 看看速度怎么样 会不会有误判
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5346 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 01:28 · PVG 09:28 · LAX 17:28 · JFK 20:28
    ♥ Do have faith in what you're doing.