Re: new ftp proxy: pftpx

2004-12-17 Thread Tobias Wigand
hi,
I've put up the latest version at
http://www.sentia.org/downloads/pftpx-0.5.tar.gz
many thanks, works great. i´m planning on trying pftpx on our main 
firewall, as we have some mac users with picky ftp clients and also pasv 
ftp for everyone would be cool. so it would be really nice if you could 
post possible updates on your website (or maybe on this list?)

thanks again!
tobias


Re: new ftp proxy: pftpx

2004-12-14 Thread Tobias Wigand
hi,
Ok, bleeding edge pf people...  I wrote a new FTP proxy called pftpx and 
I'd like to solicit some feedback from the community...
it´s great! running it for a few days now and it works just fine. and i 
was able to tighten my ruleset (i.e. no more outgoing and wide open pasv 
ftp rules)
hope it doesn´t have any severe exploitable bugs, though. ;-)

Sorry, no manpage yet, this is bleeding edge after all.
would be great to know what all the address options mean, as i wasn´t 
able to figure out all of them. btw. the queue option is what i was 
about to ask for before i found it was already there :-)
because some queue option like
anchor pftpx/* queue ftp
won´t be complained about but is simply ignored by 3.6 pfctl´s parser...

All feedback welcome
many thanks for sharing this!
tobias


Re: new ftp proxy: pftpx

2004-12-13 Thread Camiel Dobbelaar


On Tue, 14 Dec 2004, Tobias Wigand wrote:
 hope it doesn´t have any severe exploitable bugs, though. ;-)

Peer review would be good...  but it already does some mitigation:
check the security section below.

I've put up the latest version at
http://www.sentia.org/downloads/pftpx-0.5.tar.gz

it includes a manpage as well, which is pretty short so I'll paste it 
below.

--
Cam


PFTPX(8)OpenBSD System Manager's Manual   PFTPX(8)

NAME
 pftpx - FTP proxy

SYNOPSIS
 pftpx [-6d] [-b address] [-c port] [-D level] [-f address] [-g port] [-m
   maxsessions] [-p address] [-q queue] [-t timeout]

DESCRIPTION
 pftpx is a proxy for the Internet File Transfer Protocol.  FTP control
 connections should be redirected into the proxy using the pf(4) rdr com-
 mand, after which the proxy connects to the server on behalf of the
 client.

 The proxy allows data connections to pass, rewriting and redirecting them
 so that the right addresses are used.  All connections from the client to
 the server have their source address rewritten so they appear to come
 from the proxy.  Consequently, all connections from the server to the
 proxy have their destination address rewritten, so they are redirected to
 the client.  The proxy uses the pf(4) anchor facility for this.

 Assuming the FTP control connection is from $client to $server, the proxy
 connected to the server using the $proxy source address, and $port is ne-
 gotiated, then pftpx adds the following rules to the various anchors.
 (These example rules use inet, but the proxy also supports inet6.)

 In case of active mode (PORT or EPRT):

   rdr from $server to $proxy port $port - $client
   pass log quick inet proto tcp \
   from $server to $client port $port flags S/SAFR keep state

 In case of passive mode (PASV or EPSV):

   nat from $client to $server port $port - $proxy
   pass log quick inet proto tcp \
   from $client to $server port $port flags S/SAFR keep state
   pass log quick inet proto tcp \
   from $proxy to $server port $port flags S/SAFR keep state

 The options are as follows:

 -6  IPv6 mode.  The proxy will expect and use IPv6 addresses for all
 communication.  Only the extended FTP modes EPSV and EPRT are al-
 lowed with IPv6.  The proxy is in IPv4 mode by default.

 -b address
 Address where the proxy will listen for redirected connections.
 The default is 127.0.0.1, or ::1 in IPv6 mode.

 -c port
 Port where the proxy will listen for redirected connections.  The
 default is port 8021.

 -d  Do not daemonize.  The process will stay in the foreground, log-
 ging to stderr.

 -D level
 Debug level, ranging from 0 to 7.  Higher is more verbose.  The
 default is 5.  (These levels correspond to the syslog(3) levels.)

 -f address
 Fixed server address.  The proxy will always connect to the same
 server, regardless of where the client wanted to connect to (be-
 fore it was redirected).  Use this option to proxy for a server
 behind NAT, or to forward all connections to another proxy.

 -g port
 Fixed server port.  Only used in combination with the previous
 option.  The default is port 21.

 -m maxsessions
 Maximum number of concurrent FTP sessions.  When the proxy reach-
 es this limit, new connections are denied.  The default is 100.

 -p address
 Proxy source address.  The proxy will use this as the source ad-
 dress to connect to servers.

 -q queue
 Create rules with queue queue appended, so that data connections
 can be queued.

 -t timeout
 Number of seconds that the control connection can be idle, before
 the proxy will disconnect.  The default is 24 hours.  Do not set
 this too low, because the control connection is usually idle when
 large data transfers are taking place.

CONFIGURATION
 To make use of the proxy, pf.conf(5) needs the following rules.  All an-
 chors are mandatory.  The rdr pass rule can be adjusted as needed.

 In the NAT section:

   nat-anchor pftpx/*
   rdr-anchor pftpx/*
   rdr pass on $int_if proto tcp from $lan to any port 21 - 127.0.0.1 port 
8021

 In the rule section:

   anchor pftpx/*

SECURITY
 Negotiated data connection ports below 1024 are not allowed.

 The negotiated IP address for active modes is ignored for security rea-
 sons.  This makes third party file transfers impossible.

 pftpx chroots to /var/empty and changes to user proxy to drop privi-
 leges.

SEE ALSO
 ftp(1), pf(4), pf.conf(5),


new ftp proxy: pftpx

2004-11-24 Thread Camiel Dobbelaar

Ok, bleeding edge pf people...  I wrote a new FTP proxy called pftpx and 
I'd like to solicit some feedback from the community...

Why should you try it?  What advantages does pftpx offer?
1) it handles all ftp modes: PORT, PASV, EPRT, EPSV
2) it handles ipv6
3) it should scale: one process handles all sessions using libevent
4) it works with strict ftp clients (clients that want data connections 
   to the same IP as the control connection)


Quick guide:
- you need libevent-0.8 (OpenBSD 3.6 has it)
- download http://www.sentia.org/downloads/pftpx-0.3.tar.gz
- untar, make
- add this to pf.conf in the nat section:

nat-anchor pftpx/*
rdr-anchor pftpx/*
rdr pass on $if proto tcp from any to any port 21 - 127.0.0.1 port 8021 

- add this to pf.conf in the rule section:

anchor pftpx/*

- run the proxy in debug mode: sudo pftpx -d -D7
- ready to go...

Sorry, no manpage yet, this is bleeding edge after all.  Don't run this in 
production if your job depends on it.  :-)

All feedback welcome, also if you want to suggest a better name.  :-)

Regards,
Cam


Re: new ftp proxy: pftpx

2004-11-24 Thread Marcos Biscaysaqu - ThePacific.net
Hi There.
This is a great news!!!
Do you know if work on freebsd?
Thanks
Marcos Biscaysaqu
Camiel Dobbelaar wrote:
Ok, bleeding edge pf people...  I wrote a new FTP proxy called pftpx and 
I'd like to solicit some feedback from the community...

Why should you try it?  What advantages does pftpx offer?
1) it handles all ftp modes: PORT, PASV, EPRT, EPSV
2) it handles ipv6
3) it should scale: one process handles all sessions using libevent
4) it works with strict ftp clients (clients that want data connections 
  to the same IP as the control connection)

Quick guide:
- you need libevent-0.8 (OpenBSD 3.6 has it)
- download http://www.sentia.org/downloads/pftpx-0.3.tar.gz
- untar, make
- add this to pf.conf in the nat section:
nat-anchor pftpx/*
rdr-anchor pftpx/*
rdr pass on $if proto tcp from any to any port 21 - 127.0.0.1 port 8021 

- add this to pf.conf in the rule section:
anchor pftpx/*
- run the proxy in debug mode: sudo pftpx -d -D7
- ready to go...
Sorry, no manpage yet, this is bleeding edge after all.  Don't run this in 
production if your job depends on it.  :-)

All feedback welcome, also if you want to suggest a better name.  :-)
Regards,
Cam
 



Re: new ftp proxy: pftpx

2004-11-24 Thread Camiel Dobbelaar


On Thu, 25 Nov 2004, Marcos Biscaysaqu - ThePacific.net wrote:
 Do you know if work on freebsd?

Not sure. 

The two most important parts are:
- recursive anchors (appeared in OpenBSD 3.6).  Maybe Max knows when those 
when into FreeBSD?

- libevent  0.8 (from ports/devel/libevent)

Anything else that crops up should be easily fixable.

--
Cam



Re: new ftp proxy: pftpx

2004-11-24 Thread Marcos Biscaysaqu - ThePacific.net
Hi there.
Great work my friend!.
   Working on it to make it work on freebsd as sonner as possible.
thanks
Marcos Biscaysaqu
Camiel Dobbelaar wrote:
On Thu, 25 Nov 2004, Marcos Biscaysaqu - ThePacific.net wrote:
 

Do you know if work on freebsd?
   

Not sure. 

The two most important parts are:
- recursive anchors (appeared in OpenBSD 3.6).  Maybe Max knows when those 
when into FreeBSD?

- libevent  0.8 (from ports/devel/libevent)
Anything else that crops up should be easily fixable.
--
Cam

 



Re: new ftp proxy: pftpx

2004-11-24 Thread Max Laier
On Wednesday 24 November 2004 21:32, Camiel Dobbelaar wrote:
 On Thu, 25 Nov 2004, Marcos Biscaysaqu - ThePacific.net wrote:
  Do you know if work on freebsd?

 Not sure.

 The two most important parts are:
 - recursive anchors (appeared in OpenBSD 3.6).  Maybe Max knows when those
 when into FreeBSD?

They will not come to the 5-STABLE branch, as we don't do user visible changes 
in the STABLE branch. So it will not be until 6-STABLE before we have 
recursive anchors in a FreeBSD Release. Do you really *need* recursive 
anchors? I'd guess one could work around this requirement.

 - libevent  0.8 (from ports/devel/libevent)

 Anything else that crops up should be easily fixable.

-- 
/\  Best regards,  | [EMAIL PROTECTED]
\ /  Max Laier  | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | [EMAIL PROTECTED]
/ \  ASCII Ribbon Campaign  | Against HTML Mail and News


pgpO0l2ExgkBE.pgp
Description: PGP signature