v1p
V2EX  ›  问与答

iptables 如何屏蔽代理访问?

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