[Firewall] A *real* transparent proxy anyone ??

My setup:
   Internet <--------|Linux Firewall (LF)|------> Internal

  Users on the Internet have to be able to initiate a
  connection to the LF to get a service.
  (Note: the users must give the IP of the LF as the
  host they want to connect to)

  The connection must be forwarded from the LF to a
  machine on the internal network, (The real server)

  The real server must know the real IP of the connecting
  user. (The service in question is an SNA gateway)

  On there way out, the packets must again have there
  source address changed so they appear coming from the LF.

My problem:

  'ipfwadm' only supports redirecting to ports on the local
  'tproxy'  changes the source address.
  'redir'   changes the source address.
  'plug_gw' changes the source address.

  In short: I haven't found a way to do this !

My Solution:

   [This space desperately left blank]
Rikhardur Egilsson  - Domain Administrator - Tel : +354-5695100
Armuli 2 - IS-108   Reykjavik - Iceland  - Fax : +354-5695251
rikardur@skyrr.is - Skyrr Ltd  - Iceland Information Management

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RikkiAuthor Commented:
Edited text of question
RikkiAuthor Commented:
Edited text of question
As far I know, transparent proxy works fine only for
originator - it will think it connected to real server,
while request will be redirected to other IP address,
and, possible, port.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Ipfwadm with masquerading will do most of this. It'll rewrite the packet IP addresses for you, and give transparent proxying from the inside.

If you get another package, called ipautofw, this should allow you to redirect incoming traffic to a machine inside the firewall. I haven't actually used this, so I'm not 100% sure it'll do what you're looking for, but it's worth checking - it allows forwarding of UDP (and TCP?) datagrams across the firewall.
I don't know if you can do this or not...

I would write an ISAPI server extension (good for NT and PWS) that would query the Linux box and ask him who is connected.

It starts up with a URL mapping.

If you don't have NT/PWS, you could also recompile Apache with code to do the same thing.  I think that there might be a problem keeping track, but if you've got the source for your proxy, you can do something to handle it.

In short, this is a *REAL* project.  Keep looking for something commercial.

Better Idea:

send a string with the IP:port of the user to the http server.  program the server to handle it, remove it.

boom. done.

RikkiAuthor Commented:
I think 'vinniew' answered the wrong question..  :-)              

At least this answer has nothing to do with the question or
my problem.

I suggest the moderator removes this 'proposed answer' and lets
the question stand as-is.

RikkiAuthor Commented:
Just for the record,

* There is no HTTP server involved in the problem.
* Our customers should connect to the linux firewall (LF)with
  there 'tn3270' clients, such as QVS3270, IRMA or IBM's.
* The LF should act as a gateway and forward there packages
  to the real server (RS) who is running an SNA gateway
  (SNA gateway is a way to connect to a IBM mainframe)
* The SNA gateway needs to get the real IP of the client in the
* Nedless to say I do NOT have the source to HP's SNAplus3270
  product :-(
* The packages need to have there source address changed on
  there way out.

* sauron's comment is a wery good one (I'd give him a few points
  for it if I knew how).  It pointed me to 'ipautofw' witch is
  supposed to solve exactly my problem.  The only drawback is
  that exactly that part of the service hasn't been implemented
  prpperly (yet).  
  (It's the -p switch I'm talking about.)
May be you can use the linux IP tunneling module ?For further details you can read the following files:<YourLinuxSrcDir>/drivers/net/README.tunnel<YourLinuxSrcDir>/drivers/net/new_tunnel.c or tunnel.c
RikkiAuthor Commented:
According to my <MyLinuxSrcDir>/drivers/net/README.tunnel
The machine that is supposed to appear on my internal network
has to run the tunnel encapsulator 'tunnel.o'.
This means that our customers, would have to do it.
And I'd run the decapsulator 'ipip.o'.
Sorry, but this won't go.

I guess I'l have to read over the sources to 'ipautofw' and see what can be done.
RikkiAuthor Commented:
Adjusted points to 200
RikkiAuthor Commented:
Adjusted points to 201
Ok ! Now you can try Linux NAT (Network Adress Translation).The network adress translation table is manageable with a command line program, like ipfwadm.This is experimental & i have not tested it.-> http://www.csn.tu-chemnitz.de/~mha/linux-ip-nat/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I thing the linux ip address translation is the best way for yourconfiguration and can preserve:  - **The source address** - The destination adress - or both...also, you can translate adresses for one selection of tcp/udp/icmp ports or for all ports
RikkiAuthor Commented:
This got me into the right direction,  It appears as if I were one of the first to download the IP_NAT package and therefore suffered from the early bugs that have since been corrected.

With a little help from the author I got it to work and here are a few hints as to how:

    * I had to apply the patch (<typo>) mentioned on the WWW
      page. (This one was easy)
    * Routing is done after any changes to the package on the
      inbound port (i.e. if you specify -W <inbound eth>
    * Routing is done before any changes made to the package on
      the outbound port ((i.e. if you specify -W <outbound eth>
    * So you have to specify routing (ipfwadm -F) rules for the
      packages as they are in that middle stage.

IP NAT now seems to work for me 100% of the time.  I have a little problem getting Linux to route back out on the same interface.  That is, I have one network "behind" me, behind one router and it can't get it to route to that router.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.