![]() |
|
||||
|
For the rest of the confused folks reading this who didn't know, my problem was not the table. I put the IP Addresses into a Macro and tried to refer to it, the rule still didn't work, so then I put the addresses literally into the rule and it still didn't work.
Eventually I figured out at least this riddle. This pf.conf works with my table, defined in the file /etc/developers: Code:
ext_if="rl0"
int_if="rl1"
localnet=$int_if:network
outsidenet=$ext_if:network
tcp_services="{ www, https, sftp, ntp, pop3, smtp, ms-sql-s }"
tcp_dev_services="{ 81 }"
udp_services="{ domain, ntp, dhcpd-sync }"
proxy="127.0.0.1"
netbios_services="{ netbios-ns, netbios-dgm, netbios-ssn }"
icmp_types="{ echoreq, unreach }"
table <developers> persist file "/etc/developers"
# begin settings
set block-policy drop
set skip on lo
antispoof quick for $ext_if
block all
# This is the NAT line:
match out on $ext_if from $localnet nat-to ($ext_if)
# begin granular rules
block in log on $ext_if all
# allow sh to come in from "outside"
pass in quick proto tcp to $ext_if port { ssh }
pass inet proto { tcp, udp } to port $udp_services keep state
pass inet proto icmp all icmp-type $icmp_types
pass inet proto tcp from $localnet to port $tcp_services
pass inet proto tcp from <developers> to port $tcp_dev_services
pass inet proto tcp from self
Just a bit more information for people like me who are still trying to figure this out. I'll post everything else I learn even if nobody else participates in this thread. Last edited by tomp; 23rd August 2011 at 09:47 PM. |
|
||||
|
I have arrived at a pf.conf that works in my test environment. It has a couple port forwarding redirects that I won't include here because they are internal business. But this works for FTP from inside the firewall to the 'net, it allows MS SQL Server tcp client access to db servers outside the firewall from inside, and it allows a selection of tcp/ip ports to be passed.
I post it because I hope that another clueless newb who googles to this thread will find it useful. Code:
# Macros:
ext_if="rl0"
int_if="rl1"
localnet=$int_if:network
outsidenet=$ext_if:network
tcp_services="{ www, https, ftp, ftp-data, ssh, sftp, ntp, pop3, smtp, ms-sql-s, 4022 }"
tcp_dev_services="{ 81 }"
udp_services="{ domain, ntp, dhcpd-sync, ms-sql-m }"
proxy="127.0.0.1"
netbios_services="{ netbios-ns, netbios-dgm, netbios-ssn }"
icmp_types="{ echoreq, unreach }"
# Tables:
table <developers> persist file "/etc/developers"
# begin settings
set block-policy drop
set skip on lo
antispoof quick for $ext_if
block log all
# This is the NAT line:
match out on $ext_if from $localnet nat-to ($ext_if)
# block incoming traffic
block in log on $ext_if all
# FTP Proxy rules:
pass in quick on $int_if proto tcp to port 21 rdr-to $proxy port 8021
anchor "ftp-proxy/*"
# begin granular rules
pass inet proto tcp from self
# allow sh to come in from "outside":
pass in quick proto tcp to $ext_if port { ssh }
# list of acceptable services:
pass inet proto tcp from $localnet to port $tcp_services
# needed for SQL Server tcp/ip access:
pass inet proto udp from $localnet to port ms-sql-m
# UDP and ICMP rules:
pass inet proto { tcp, udp } to port $udp_services keep state
pass inet proto icmp all icmp-type $icmp_types
|
|
||||
|
I'm not sure, Tom, what trouble you were actually having, because I can't always just look at a configuration file and figure out what may be going wrong.
For me, I find it easiest to log every filter rule, pass or block, as a matter of course. I then use tcpdump(8) to confirm which rule is applicable to the packets of interest. You probably already know it, but just in case:
__________________
OpenBSD LiveCDs/LiveDVDs |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| static ip's not showing up in routing table | birdmansdomain | OpenBSD General | 4 | 26th November 2009 11:57 PM |
| I think I just mangled my partition table | Mantazz | FreeBSD Installation and Upgrading | 2 | 2nd July 2009 09:55 PM |
| PHP~MYSQL - Get list of all the fields within a table | cksraj | Programming | 2 | 22nd April 2009 05:57 AM |
| table formatting (could not find better title) | gosha | Programming | 10 | 19th March 2009 05:33 PM |
| Ajax dynamic table/spreadsheet | robbak | Programming | 1 | 7th June 2008 10:33 PM |