Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 1996 08:48:02 -0700 ()
From:      Jason Fesler <jfesler@calweb.com>
To:        Adam David <adam@veda.is>
Cc:        Nadav Eiron <nadav@barcode.co.il>, ke6mgb@ix.NETcom.COM, questions@FreeBSD.org
Subject:   Re: ampr.org
Message-ID:  <Pine.WNT.3.95.960913083931.-81531H-100000@devnull.calweb.com>
In-Reply-To: <199609131238.MAA01137@veda.is>

next in thread | previous in thread | raw e-mail | index | archive | help

My solution is attached below.  This was never meant to be publicized, so
any critiques of it can go to /dev/null - I'm not interested :-).
However, if you can use it, awesome.  I use it both on the non-webserver
machines, as well as on my home 28k link to pass the connections back to
the T1 side.  Standard disclaimers, if it formats your hard drive, let me
know so I can stop using it too :-).

I used a combination of perl, and tcp_wrappers to determine which address
to redirect to (multiple IP addresses on that box).  One can probably not
bother if they only have a single IP address, and work strictly out of
inetd ..

/etc/hosts.allow for tcp_wrappers extended mode
fakehtml@165.90.138.208: all : twist /usr/libexec/fakehtml http\://165.90.189.182
fakehtml : all : twist /usr/libexec/fakehtml http\://www.calweb.com/


#!/usr/local/bin/perl5

 select(STDOUT); $|=1;
 $date=`date`; chop $date;

 $base=$ARGV[0];
 if ($base eq "") {$base = "http://www.gigo.com/";}
 unless ($base =~ /.*\/$/) {$base = $base . "/";}


 $l=<STDIN>;
 $l =~ s/\n$//;  #chop
 $l =~ s/\r$//;  #chop
 if ($l =~ /.*\/cgi-bin\/.*/) {
   $base =~ s/~.*//;              # in the case of /cgi-bin/, remove
                                  #~username from the redirected URL,
                                  #since users do not have personal CGI
                                  #directories
  }
 $l =~ s/[ \t]+/ /g; # extra spaces
# print "incoming is $l\n";
 @words=split(" ",$l);

 if (substr($words[1],0,1) eq "/") {
  $words[1] = substr($words[1],1,1000);
 }
File fakehtml not changed so no update needed.
{root@web2;0.47:/usr/libexec} cat fakehtml
#!/usr/local/bin/perl5

 select(STDOUT); $|=1;
 $date=`date`; chop $date;

 $base=$ARGV[0];
 if ($base eq "") {$base = "http://www.gigo.com/";}
 unless ($base =~ /.*\/$/) {$base = $base . "/";}


 $l=<STDIN>;
 $l =~ s/\n$//;  #chop
 $l =~ s/\r$//;  #chop
 if ($l =~ /.*\/cgi-bin\/.*/) {
   $base =~ s/~.*//;
  }
 $l =~ s/[ \t]+/ /g; # extra spaces
# print "incoming is $l\n";
 @words=split(" ",$l);

 if (substr($words[1],0,1) eq "/") {
  $words[1] = substr($words[1],1,1000);
 }
 $a="${base}$words[1]";
 print <<EOF
HTTP/1.0 302 Found
Date: $date
Server: cs-http/0.1.p
Location: $a
Content-type: text/html

<HEAD><TITLE>Document moved</TITLE></HEAD>
<BODY><H1>Document moved</H1>
The document has moved <A
HREF=\"$a\">here
</A>.<P>
</BODY>
EOF
;




On Fri, 13 Sep 1996, Adam David wrote:

> > > >I am currently registered under ampr.org - I am ke6mgb.ampr.org. I was 
> > > >wondering how I can have it, so when someone connects to ke6mgb.ampr.org, it 
> > > >will automatically route them to another ip or www page? 
> > > >Thank You,
> > > >Rod
> > > >KE6MGB - HAM RADIO OPERATOR - IP: 44.16.1.219 <--> KE6MGB.AMPR.ORG
> > > 
> > > If I understood your question right, you need a minimal server program to
> > > accept connections on specific port numbers and hand off the connection to
> > > another host:port destination.
> 
> > There is something that does just that! It's part of the TIS fwtk 
> > (firewall toolikit) and is called plug-gw. It's a tiny little program you 
> > run from inetd.conf and that redirects connections to specific ports on 
> > the current host to other addresses (host:ports). It is driven by a 
> > configuration file where you can specify the host/port to connect to 
> > based on the origin of the connection. Very nice stuff, and amazingly 
> > compact (like the rest of the TIS fwtk).
> 
> plug-gw will pass all traffic on the connection through the forwarding host,
> which might not be what was meant. What I mean by redirect is to transfer
> the connection early on, so that further traffic on the connection will not
> necessarily travel via that first host.
> 
> Adam David <adam@veda.is>
> 

--
 Jason Fesler        jfesler@calweb.com      Internic info: 'whois jf319'
 Admin, CalWeb Internet Service  Support: 916-641-9320  http://calweb.com
 Unsolicited propoganda delivered electronicly shall be returned in bulk!
 Junk mail problems?  'man procmail' (unix) or 'buy eudora pro' (windows)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.WNT.3.95.960913083931.-81531H-100000>