All of lore.kernel.org
 help / color / mirror / Atom feed
* A very basic chain question
@ 2009-09-07  6:58 J. Bakshi
  2009-09-07  7:47 ` Pascal Hambourg
  0 siblings, 1 reply; 3+ messages in thread
From: J. Bakshi @ 2009-09-07  6:58 UTC (permalink / raw)
  To: netfilter

Hello list,

Please bother  with me as this time I have a very basic question about
iptables chain and I have not found any answer yet.  I am in a process
to create a complex  ssh checking rule where conditions are checked one
by one and finally the valid packets are accepted.  The scenario is like

````````````
check limit ( say 10/min) --> check connlimit ( 2 per ip ) --> check
hashlimit ( 2 attempt per min) ---> ACCEPT.
````````````````````

I have made a chain called sshrate but don't find the way to append the
rules in that chain one by one. If I simply append the rules as accept
then the very first rule is working bypassing the other two and my
objective is to pass the rules in a pipe one by one and finally accept
the valid packets. Could any one enlighten me in that direction ?

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A very basic chain question
  2009-09-07  6:58 A very basic chain question J. Bakshi
@ 2009-09-07  7:47 ` Pascal Hambourg
  2009-09-07  8:07   ` J. Bakshi
  0 siblings, 1 reply; 3+ messages in thread
From: Pascal Hambourg @ 2009-09-07  7:47 UTC (permalink / raw)
  To: netfilter

Hello,

J. Bakshi a écrit :
> 
> check limit ( say 10/min) --> check connlimit ( 2 per ip ) --> check
> hashlimit ( 2 attempt per min) ---> ACCEPT.
> 
> I have made a chain called sshrate but don't find the way to append the
> rules in that chain one by one. If I simply append the rules as accept
> then the very first rule is working bypassing the other two and my
> objective is to pass the rules in a pipe one by one and finally accept
> the valid packets. Could any one enlighten me in that direction ?

DROP (or REJECT) packets which fail early checks if possible :

-A sshrate -m <!check1> -j DROP
-A sshrate -m <!check2> -j DROP
-A sshrate -m <check3> -j ACCEPT

or put all checks in the same rule if possible :

-A sshrate -m <check1> -m <check2> -m <check3> -j ACCEPT

or cascade chains :

-A sshrate -m <check1> -j check1ok
-A check1ok -m <check2> -j check2ok
-A check2ok -m <check2> -j ACCEPT

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A very basic chain question
  2009-09-07  7:47 ` Pascal Hambourg
@ 2009-09-07  8:07   ` J. Bakshi
  0 siblings, 0 replies; 3+ messages in thread
From: J. Bakshi @ 2009-09-07  8:07 UTC (permalink / raw)
  To: Pascal Hambourg; +Cc: netfilter

Pascal Hambourg wrote:
> Hello,
>
> J. Bakshi a écrit :
>   
>> check limit ( say 10/min) --> check connlimit ( 2 per ip ) --> check
>> hashlimit ( 2 attempt per min) ---> ACCEPT.
>>
>> I have made a chain called sshrate but don't find the way to append the
>> rules in that chain one by one. If I simply append the rules as accept
>> then the very first rule is working bypassing the other two and my
>> objective is to pass the rules in a pipe one by one and finally accept
>> the valid packets. Could any one enlighten me in that direction ?
>>     
>
> DROP (or REJECT) packets which fail early checks if possible :
>
> -A sshrate -m <!check1> -j DROP
> -A sshrate -m <!check2> -j DROP
> -A sshrate -m <check3> -j ACCEPT
>
> or put all checks in the same rule if possible :
>
> -A sshrate -m <check1> -m <check2> -m <check3> -j ACCEPT
>   

Very nice. The second one is really nice.
many many thanks.


> or cascade chains :
>
> -A sshrate -m <check1> -j check1ok
> -A check1ok -m <check2> -j check2ok
> -A check2ok -m <check2> -j ACCEPT
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>   


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-07  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-07  6:58 A very basic chain question J. Bakshi
2009-09-07  7:47 ` Pascal Hambourg
2009-09-07  8:07   ` J. Bakshi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.