1 |
On 21-May-13 17:07, Nick Khamis wrote: |
2 |
> We recently moved our stateful firewall inside, and would like to |
3 |
> strip down the firewall at our router connected to the outside world. |
4 |
> The problem I am experiencing is getting things to work properly |
5 |
> without connection tracking. I hope I am not in breach of mailing list |
6 |
> rules however, a stripped down configuration is as follows: |
7 |
> |
8 |
<STRIP OBVIOUS THINGS I.E. IPTABLES, INTERFACES, LOOPBACK> |
9 |
> |
10 |
> #echo -e " - Defined Chains" |
11 |
> $IPTABLES -N TCP |
12 |
> $IPTABLES -N UDP |
13 |
> |
14 |
> #echo -e " - Accepting SSH Traffic" |
15 |
> $IPTABLES -A TCP -p tcp -m tcp -s 192.168.2.0/24 -d 192.168.2.5 |
16 |
> --dport 22 -j ACCEPT |
17 |
> $IPTABLES -A TCP -p tcp -m tcp -s 0.0.0.0/0 -d 192.168.2.5 --dport 22 -j DROP |
18 |
> |
19 |
> #echo -e " - Accepting input TCP and UDP traffic to open ports" |
20 |
> $IPTABLES -A INPUT -i $INTIF1 -p tcp --syn -j TCP |
21 |
> $IPTABLES -A INPUT -i $INTIF1 -p udp -j UDP |
22 |
> |
23 |
> #echo -e " - Accepting output TCP and UDP traffic to open ports" |
24 |
> $IPTABLES -A OUTPUT -o $INTIF1 -p tcp --syn -j TCP |
25 |
> $IPTABLES -A OUTPUT -o $INTIF1 -p udp -j UDP |
26 |
> |
27 |
<STRIP THE REST AND CONSIDER ALL REMAINING DROPPED/REJECTED> |
28 |
> |
29 |
> Everything works fine with the REJECT rules commented out, but when |
30 |
> included SSH access is blocked out. Not sure why, isn't the sequence |
31 |
> correct (i.e., the ACCPET entries before the DROP and REJECT)? |
32 |
> |
33 |
> Also, any pointers or heads up when going stateless would be greatly |
34 |
> appreciated. |
35 |
|
36 |
I do not understand why you *want* to omit statefullness, |
37 |
but if you do, you have to take care of corresponding part |
38 |
of ip-traffic yourself. |
39 |
|
40 |
First, you'd better learn someting about "3-way handshaking". |
41 |
That's the way tcp/ip connection is opened. Shortly: |
42 |
|
43 |
1. client sends to server tcp/ip packet with "syn" flag |
44 |
2. server responds with "syn/ack" flags |
45 |
3. client sends "ack" |
46 |
|
47 |
Now look at your rules: you covered only the first part with: |
48 |
$IPTABLES -A INPUT -i $INTIF1 -p tcp --syn -j TCP |
49 |
|
50 |
Where is OUTPUT rule for "syn/ack", and INPUT for "ack"? |
51 |
Nowhere, and because of that you can not open tcp-connection |
52 |
if drop/reject rules are in effect. |
53 |
|
54 |
But instead of playing with tcp-flags I strongly recommend |
55 |
to use statefull firewall, which takes care of this with |
56 |
one simple rule. |
57 |
|
58 |
Jarry |
59 |
|
60 |
-- |
61 |
_______________________________________________________________ |
62 |
This mailbox accepts e-mails only from selected mailing-lists! |
63 |
Everything else is considered to be spam and therefore deleted. |