Sorry if this seems a bit out of order, because I commented as it came to me.
On 5/13/05, GV <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have following LAN configuration:
>
> [ COMP_1 ] ... [ COMP_n ]
> | | ADSL
> ---+------+-----+------- int_if [ OpenBSD ] ext_if -------- ( Internet )
>
> "comp_1" ... "comp_n" are running a web base application and a number of ports
> on each machine have to be accessible from the internet.
>
> I have the following pf.conf file which doesn't seem to work apart from the
> redirection to port 80!:
>
> --------------------------
> ext_if="vr0"
> int_if="rl0"
>
> tcp_services = "{ 80, 20, 21, 22, 25, 110, 113 }"
> cam_services = "{ 5000, 6000, 6001, 6002, 6005 }"
> icmp_types = "echoreq"
>
> priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
>
> cam1 = "192.168.1.33"
>
> set block-policy return
> set loginterface $ext_if
>
> scrub in all
>
You should change this :
> nat on $ext_if from $int_if:network to any -> $ext_if
to this:
nat on $ext_if from $int_if:network to any -> ($ext_if)
> rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021
> rdr pass on $ext_if proto tcp from any to any port 8000 -> $cam1 port 80
>
> block all
> block in log all
> pass quick on lo0 all
>
> block drop in quick on $ext_if from $priv_nets to any
I think this line can cause problems as packets are blocked before
they get nated.
(I am not 100% sure on this one.)
> block drop out quick on $ext_if from any to $priv_nets
>
> pass in on $ext_if inet proto tcp from any to ($ext_if) \
> port $tcp_services flags S/SA keep state
Non-paranoid rule:
pass in on $ext_if proto tcp from any to any port $tcp_services flags
S/SA keep state
or "modulate state" at thge end.
>
> pass in on $ext_if proto tcp from any to $cam1 port $cam_services keep state
If you want to redirect traffic to those ports ($cam_services) to the
host cam1, this won't work. Use:
rdr on $ext_if proto tcp form any to any port $cam_services -> $cam1
Otherwise delete this rule as traffic destined to $cam1 will never
arrive on $ext_if.
>
> pass in inet proto icmp all icmp-type $icmp_types keep state
>
> pass in on $int_if from $int_if:network to any keep state
> pass out on $int_if from any to $int_if:network keep state
As a general rule, you don't need to be that paranoid about packet
passing rules something like :
pass on $int_if from any to any keep state
will do the job. Of course, if you loose sleep over security you can
always keep the ones you have.
>
> pass out on $ext_if proto tcp all modulate state flags S/SA
Same as above. There is no real need for "flags S/SA" on this rule
unless your sleep hours require this.
> pass out on $ext_if proto { udp, icmp } all keep state
> ----------------------------------
>
> Thanks for your help
>
> George
>
>
--
Fourth law of programming:
Anything that can go wrong wi
sendmail: segmentation violation - core dumped