LINUX.ORG.RU
ФорумAdmin

Странности с connmark

 , , ,


0

1

Собственно, имеется suricata со следующими правилами:

#pass tls any any -> any any (pcre: "/play.google.com/i"; tls_sni;nfq_set_mark:0x8/0xffffffff; sid:2466;)
#pass tls any any -> any any (pcre: "/google.com/i"; tls_sni;nfq_set_mark:0x8/0xffffffff; sid:2465;)
#pass tls any any -> any any (pcre: "/gstatic.com/i"; tls_sni;nfq_set_mark:0x8/0xffffffff; sid:2467;)
#pass tls any any -> any any (pcre: "/googleservice.com/i"; tls_sni;nfq_set_mark:0x8/0xffffffff; sid:2467;)
pass tls any any -> any any (pcre: "/youtube.com/s"; tls_sni;nfq_set_mark:0x2/0xffffffff; sid:2455;)
pass tls any any -> any any (pcre: "/googlevideo.com/s"; tls_sni;nfq_set_mark:0x2/0xffffffff; sid:2456;)
pass http any any <> any any (content: "tactical-market.ru"; http_header;nfq_set_mark:0x4/0xffffffff; sid:2457;)
pass http any any <> any any (content: "voent.org"; http_header;nfq_set_mark:0x4/0xffffffff; sid:2458;)
pass http any any <> any any (content: "h-mag.ru"; http_header;nfq_set_mark:0x4/0xffffffff; sid:2459;)
pass tls any any <> any any (content: "voent.org";tls_sni;nfq_set_mark:0x4/0xffffffff; sid:2460;)
pass tls any any <> any any (content: "h-mag.ru";tls_sni;nfq_set_mark:0x4/0xffffffff; sid:2461;)
rejectboth tcp any any <> any any (content: "GET http://";content: "Host: "; sid:2462;)
pass http any any <> any any (content: "302";http_stat_code;content: "ivrn.net";http_header;nfq_set_mark:0x64/0xffffffff; sid:2463;)
pass ssh any any <> any any (nfq_set_mark:0x6/0xffffffff; sid:2464;)

#reject tls any any <> any any (content:"www.youtube.com"; tls_sni;nfq_set_mark:0x2/0xffffffff; sid:2456;)

#ytimg.com

iptables:
Chain PREROUTING (policy ACCEPT 228K packets, 138M bytes)
 pkts bytes target     prot opt in     out     source               destination         
   11  3630 RETURN     all  --  *      *       0.0.0.0              255.255.255.255     
 127K  121M RETURN     all  --  eth1   *       0.0.0.0/0            0.0.0.0/0           
  187 11489 RETURN     all  --  ppp0   *       0.0.0.0/0            0.0.0.0/0           
10365 2323K RETURN     all  --  vpns0.10 *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            rpfilter invert LOG flags 0 level 4 prefix "IP SPOOFING: "
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            rpfilter invert
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            -m ipv4options --flags 7 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            -m ipv4options --flags 3 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            -m ipv4options --flags 9 
    0     0 MARK       all  --  *      *       0.0.0.0/0            0.0.0.0/0            match-set dpi_detect dst MARK xset 0x40/0xfe
    0     0 MARK       all  --  *      *       0.0.0.0/0            0.0.0.0/0            match-set dpi_detect src MARK xset 0x40/0xfe

Chain INPUT (policy ACCEPT 107K packets, 45M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 120K packets, 93M bytes)
 pkts bytes target     prot opt in     out     source               destination         
 241K  185M DPI        all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 120K   93M DPI_SH     all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 2063  123K TCPMSS     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp flags:0x06/0x02 TCPMSS clamp to PMTU

Chain OUTPUT (policy ACCEPT 109K packets, 24M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 229K packets, 116M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain DPI (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     all  --  *      *       198.18.0.0/15        192.168.0.0/15      
    0     0 RETURN     all  --  *      *       192.168.0.0/16       198.18.0.0/15       
    0     0 RETURN     all  --  *      *       192.168.0.0/16       192.168.0.0/16      
 121K   93M NFQUEUE    all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match ! 0x1/0x1 NFQUEUE num 0

Chain DPI_SH (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 3542 2688K RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0            connmark match  0x8/0xfe
   53 45450 CONNMARK   all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match 0x8/0xfe CONNMARK xset 0x8/0xfe
    0     0 CONNMARK   all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match 0x4/0xfe CONNMARK xset 0x4/0xfe
    8  9366 CONNMARK   all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match 0x2/0xfe CONNMARK xset 0x2/0xfe
24094   27M CLASSIFY   all  --  *      *       0.0.0.0/0            0.0.0.0/0            connmark match  0x2/0xfe CLASSIFY set 1:11
    0     0 CLASSIFY   all  --  *      *       0.0.0.0/0            0.0.0.0/0            connmark match  0x4/0xfe CLASSIFY set 1:12
    0     0 SET        all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match 0x64/0xfe add-set dpi_detect src
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            mark match 0x64/0xfe LOG flags 0 level 4 prefix "INFOROOM DPI: "
ip6tables:
Chain PREROUTING (policy ACCEPT 314 packets, 60079 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     all      eth1   *       ::/0                 ::/0                
 6722 5704K RETURN     all      ppp0   *       ::/0                 ::/0                
    2   112 RETURN     all      vpns0.10 *       ::/0                 ::/0                
    0     0 LOG        all      *      *       ::/0                 ::/0                 rpfilter invert LOG flags 0 level 4 prefix "IP6 SPOOFING: "
    0     0 DROP       all      *      *       ::/0                 ::/0                 rpfilter invert

Chain INPUT (policy ACCEPT 15 packets, 984 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 299 packets, 59095 bytes)
 pkts bytes target     prot opt in     out     source               destination         
23065   13M DPI        all      *      *       ::/0                 ::/0                
11539 6450K DPI_SH     all      *      *       ::/0                 ::/0                
  172 13760 TCPMSS     tcp      *      *       ::/0                 ::/0                 tcp flags:0x06/0x02 TCPMSS clamp to PMTU

Chain OUTPUT (policy ACCEPT 13 packets, 896 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 312 packets, 59991 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain DPI (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    1  1280 RETURN     all      *      *       2a01:d0:c353::/48    2a01:d0:c353::/48   
    0     0 RETURN     all      *      *       2a01:d0:c353::/48    2a01:d0:c353::/48   
11526 6448K NFQUEUE    all      *      *       ::/0                 ::/0                 mark match ! 0x1/0x1 NFQUEUE num 0

Chain DPI_SH (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     all      *      *       ::/0                 ::/0                 connmark match  0x8/0xfe
    0     0 CONNMARK   all      *      *       ::/0                 ::/0                 mark match 0x8/0xfe CONNMARK xset 0x8/0xfe
    0     0 CONNMARK   all      *      *       ::/0                 ::/0                 mark match 0x4/0xfe CONNMARK xset 0x4/0xfe
   31 36225 CONNMARK   all      *      *       ::/0                 ::/0                 mark match 0x2/0xfe CONNMARK xset 0x2/0xfe
  215 86776 CLASSIFY   all      *      *       ::/0                 ::/0                 connmark match  0x2/0xfe CLASSIFY set 1:11
    0     0 CLASSIFY   all      *      *       ::/0                 ::/0                 connmark match  0x4/0xfe CLASSIFY set 1:12
    0     0 LOG        all      *      *       ::/0                 ::/0                 mark match 0x64/0xfe LOG flags 0 level 4 prefix "INFOROOM DPI: "
Теперь вопрос: почему при вхлде на google.com, правило
  314  115K CLASSIFY   all      *      *       ::/0                 ::/0                 connmark match  0x2/0xfe CLASSIFY set 1:11
начинает срабатывать? По идее оно должно срабатывать, если заходишь на youtube.com.

★★★★★

А что вы такую маленькую портянку сделали? Даже не интересно рассматривать такую фигню. Надо раза в 3 побольше было.

vodz ★★★★★ ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.