Article 2764 of comp.infosystems.gopher: Xref: feenix.metronet.com comp.infosystems.gopher:2764 Newsgroups: comp.infosystems.gopher Path: feenix.metronet.com!news.utdallas.edu!wupost!howland.reston.ans.net!darwin.sura.net!news-feed-1.peachnet.edu!umn.edu!mudhoney!lindner From: lindner@mudhoney.micro.umn.edu (Paul Lindner) Subject: Re: Proxy agent for gopher Message-ID: Sender: news@news.cis.umn.edu (Usenet News Administration) Nntp-Posting-Host: mudhoney.micro.umn.edu Organization: University of Minnesota, Minneapolis References: Date: Tue, 18 May 1993 21:56:17 GMT Lines: 140 mitra@path.net (Mitra) writes: >There are two ways of doing proxy servers with Gopher. One is at the IP >level, which sounds like the previous message's method. I'd be >interested >in seeing this. >We have a proxy gopher server working atthe application level. It will >sit on a firewall machine and funnel gopher requests between the two >sides of the net. We built it to solve some caching and interface >conversion problems but it could be fairly easily adapted to meet the >firewall situation mentioned in several people's messages. >If anyone needs one of these please get in touch by email, and I'll see >what could be done. Here is a firewall gopher translater that runs underneath go4gw, I did not write it, it was submitted to me.. Have fun :-) ----------snip--------------snip--------------s nip---- From A.Macpherson@bnr.co.uk Tue May 18 20:09:06 1993 Received: from boombox.micro.umn.edu by mudhoney.micro.umn.edu (5.65c/Tony Tiger 1.34) id AA04467; Tue, 18 May 1993 13:09:34 -0500 Message-Id: <9305181810.AA04936@boombox.micro.umn.edu> Received: from eurogate.bnr.co.uk by boombox.micro.umn.edu; Tue, 18 May 93 13:10:55 CDT Received: from bnr.co.uk by eurogate.bnr.co.uk with SMTP (PP) id <12773-0@eurogate.bnr.co.uk>; Tue, 18 May 1993 19:09:24 +0100 Received: from bnr.co.uk by hedera.bnr.co.uk id <22197-0@hedera.bnr.co.uk>; Tue, 18 May 1993 19:09:06 +0100 To: gopher@boombox.micro.umn.edu Subject: Gopher through a firewall Date: Tue, 18 May 1993 19:09:06 +0100 From: Andrew Macpherson Sender: A.Macpherson@bnr.co.uk Status: OR Sorry verry silly, I sent you the wrong version, which was missing 2 lines, I hope it may be usefull to someone #---------------------------------------------------------------------- @g2go4_acl=( # ipaddress access + = allow, - = deny '^47\. +', '^128.199\. +', '.* -' ); $SafeTypes = "^(0|1|3|4|5|6|7|9)" ; # Gopher tags we will pass #---------------------------------------------------------------------- sub g2go4_main { local($_ )= @_; &Gsorry if /^sorry$/; if (&check_access() eq '-') { &Greply("0Sorry! No access from Non-Local hosts\t$Ggw sorry\t$Ghost\t$Gport"); &Greply("."); exit; } if (/^$/) { &Greply("1Imperial College Archive\t$Ggw 70\007src.doc.ic.ac.uk\007\t$Ghost\t$Gport"); &Greply("."); exit(0); } ( $port, $host, $query ) = split('\007') ; &GopenServer($host, $port); &Gsend($query) ; # We may be doing a file transfer here, or it may be another menu # all we can do is intuit. $First = ; $Second = ; if ( $First =~ /^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*$/ && ($Second eq ".\r\n" || $Second =~ /^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*$/ )) { # close enough $First =~ s/[\r\n]//g ; ( $disp, $sel, $host, $port ) = split('\t', $First) ; print "${disp}\t$Ggw ${port}\7${host}\7${sel}\t$Ghost\t$Gport\r\n" if $disp =~ m/${SafeTypes}/ ; if ($Second eq ".\r\n" ) { print $Second ; exit 0; } $Second =~ s/[\r\n]//g ; ( $disp, $sel, $host, $port ) = split('\t', $Second) ; print "${disp}\t$Ggw ${port}\7${host}\7${sel}\t$Ghost\t$Gport\r\n" if $disp =~ m/${SafeTypes}/ ; while() { s/[\r\n]//g ; if ( $_ eq "." ) { print ".\r\n" ; exit 0; } ( $disp, $sel, $host, $port ) = split('\t') ; print "${disp}\t$Ggw ${port}\7${host}\7${sel}\t$Ghost\t$Gport\r\n" if $disp =~ m/${SafeTypes}/ ; } } else { print $First ; print $Second ; while() { print ; } } } sub check_access { return 1 if (-t STDIN); $sockaddr = 'S n a4 x8'; $mysockaddr = getpeername(STDIN); ($ramily,$rport,$raddr) = unpack($sockaddr,$mysockaddr); ($a,$b,$c,$d) = unpack('C4',$raddr); $ipaddress = "$a.$b.$c.$d"; foreach (@g2go4_acl) { ($ipacl,$access)=split; return $access if ($ipaddress =~ /$ipacl/); } return '-'; #default is to restrict access } 1; # for require -- | Paul Lindner | lindner@boombox.micro.umn.edu | Slipping into madness | | Computer & Information Services | is good for the sake | Gophermaster | University of Minnesota | of comparison. ///// / / / /////// / / / / / / / / //// / / / / / / / /