+ Responder ao Tópico



  1. #1

    Padrão Iptables - com time

    Pessoal, usei a seguinte regra abaixo para em um intervalo de 15min bloqueiar a eth1, ex.: 12:00 as 12:15...porem continua aceitando passar pela eth1. Só funciona quando eu aumento esse intervalo acima de 3h..ex.: 12:00 as 15:00.

    iptables -A FORWARD -i eth1 -m time --timestart 12:00 --timestop 12:15 -j DROP # assim nao funciona

    iptables -A FORWARD -i eth1 -m time --timestart 12:00 --timestop 15:00 -j DROP # assim funciona

  2. #2

    Padrão Re: Iptables - com time

    Ponha isso na cron! Muito mais fácil!

  3. #3

    Padrão Re: Iptables - com time

    pra mim sempre funciono , usei com parametro day

    time match options:
    --datestart time Start and stop time, to be given in ISO 8601
    --datestop time (YYYY[-MM[-DD[Thh[:mm[:ss]]]]])
    --timestart time Start and stop daytime (hh:mm[:ss])
    --timestop time (between 00:00:00 and 23:59:59)
    [!] --monthdays value List of days on which to match, separated by comma


    $ipt -t mangle -A P2PLAYER7 -m time --timestart $P2P_TIMESTART --timestop $P2P_TIMESTOP --days $P2P_DAYS -m layer7 --l7proto $P2P -j DROP


    Código :
    if [ $CONTROLE_P2P = "1" ]; then
    $ipt -t mangle -A PREROUTING -j P2PLAYER7
    $ipt -t mangle -A P2PLAYER7 -m ipp2p --ipp2p -j MARK --set-mark 3
    #$ipt -t mangle -A P2PLAYER7 -m time --timestart $P2P_TIMESTART --timestop $P2P_TIMESTOP --days $P2P_DAYS -m ipp2p --ipp2p -j DROP
    #$ipt -A FORWARD -m time --timestart $P2P_TIMESTART --timestop $P2P_TIMESTOP --days $P2P_DAYS -m ipp2p --ipp2p -j DROP
     
     
     for i in `cat $LAYER7`; do
      STATUS=`echo $i | cut -d ';' -f 1`
      P2P=`echo $i | cut -d ';' -f 2`
      DESC=`echo $i | cut -d ';' -f 3`
      printf "$T_VERMELHO_CLARO CONTROLE P2P $NO_COLOUR\t["
       if [ $STATUS = "1" ]; then
        printf "$T_VERDE  $GREEN LIBERADO DAS $P2P_TIMESTOP as $P2P_TIMESTART $P2P $NO_COLOUR - $T_VERDE $DESC $NO_COLOUR]\n"
        $ipt -t mangle -A P2PLAYER7 -m layer7 --l7proto $P2P -j MARK --set-mark 3
        #$ipt -t mangle -A P2PLAYER7 -m time --timestart $P2P_TIMESTART --timestop $P2P_TIMESTOP --days $P2P_DAYS -m layer7 --l7proto $P2P -j DROP
       else
        printf "$T_VERDE  $RED CONTROLE DESABILITADO PARA $P2P $NO_COLOUR - $T_VERDE $DESC $NO_COLOUR]\n"
       fi
     done

  4. #4

    Padrão Re: Iptables - com time

    Coloquei no cron funcionou... Estranho no iptables não funcionar em duas máquinas diferentes. Mas valeu ajuda

  5. #5