[Rtir] A couple of questions

Ruediger Riediger ruediger.riediger at Sun.COM
Thu Sep 16 05:09:41 EDT 2004


Hello,

Gorazd Bozic wrote:
> Natasa Glavor wrote:
>> * how do we adjust RTIR to make queries to different custom databases
>> instead of the default whois querying?
[...]
> We solved this by setting up our own simple whois server (or you might 
> call it a whois wrapper). The whois protocol is really simple: connect 
> to the server, send a single line query (usually an IP address) and read 
> back the response. If it is run from inetd.conf, you read from stdin and 
> write results to stdout, so it doesn't need any networking stuff.

we have actually gone one step father, as we have more than one internal 
query system. We are running the Geek-Tools proxy locally, as well as 
some additional whois-like services. Now, with RTIR's "Lookup.html" 
tools, you can only have one whois service per system as there is no 
possibility to query the service on another port (than 43/tcp).

We have modified Lookup.html to allow the "whois" variable to not only 
hold server names, but "name:port". Further, since no one can remember 
what runs on port 43 and what on port 4321, we have added a second 
variable holding the "beautified" names of the services. Here is what 
you need to add:

in /opt/rt3/etc/RT_SiteConfig.pm
---------------
Set($whois, {2 => "localhost",
              1 =>  "localhost:4321"
} );

Set($bwhois, {2 => "GT-Whois",
               1 => "Internal Lookup"
} );
---------------

and the diff:
*** /opt/rt3/share/html/RTIR/Tools/Lookup.html
--- /opt/rt3/local/html/RTIR/Tools/Lookup.html
***************
*** 84,91 ****
--- 84,95 ----
   % if ($servers->{$s} eq $server) {
   %   $selected = " SELECTED";
   % }
+ % if (exists($beauties->{$s})) {
+         <option 
value="<%$servers->{$s}%>"<%$selected%>><%$beauties->{$s}%></option>
+ % } else {
           <option 
value="<%$servers->{$s}%>"<%$selected%>><%$servers->{$s}%></option>
   % }
+ % }
         </select>
       </td>
       <td align=left><input type=submit value="Go"></td>
***************
*** 142,149 ****
     last;
   }

   use Net::Whois::RIPE;
! my $query = Net::Whois::RIPE->new($server);
   my ($iterator, $error);
   if ($query) {
       $iterator = $query->query_iterator($q);
--- 146,159 ----
     last;
   }

+ $beauty = ( exists($beauties->{ ({ reverse %$servers }->{$server}) })
+       ? $beauties->{ ({ reverse %$servers }->{$server}) } ." (". 
$server .")"
+       : $server );
+
   use Net::Whois::RIPE;
! my ($whois, $port) = split(/\s*:\s*/, $server, 2);
! $port = 43 unless($port =~ /^\d+$/);
! my $query = Net::Whois::RIPE->new($whois, Port => $port);
   my ($iterator, $error);
   if ($query) {
       $iterator = $query->query_iterator($q);
***************
*** 160,166 ****
       $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
   }

! my $title = "Lookup $q using server $server";
   my $ticketcount;
   $session{'i'}++;
   if ($session{'tickets'}) {
--- 170,176 ----
       $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
   }

! my $title = "Lookup $q using server $beauty";
   my $ticketcount;
   $session{'i'}++;
   if ($session{'tickets'}) {
***************
*** 194,199 ****
--- 204,211 ----
   <%args>
   $servers => $RT::whois
   $server => undef
+ $beauties => $RT::bwhois
+ $beauty => undef
   $handparse => 1
   $q => undef
   $type => undef


As usual, these chanegs are subject to Version 2 of the GNU General 
Public License. Proper reference if this makes it into the RTIR source 
would be appreciated ;-)

Best regards,

	Ruediger Riediger

-- 
Dr. Ruediger Riediger                              Sun Microsystems GmbH
NSG - SunCERT                                             Komturstr. 18a
mailto:Ruediger.Riediger at Sun.com                          D-12099 Berlin
------------------------------------------------------------------------
NOTICE:  This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
------------------------------------------------------------------------
PGP 2048RSA/0x2C5020E9          964C E189 0FF0 8882  2BAB 65E2 6912 1FF2
------------------------------------------------------------------------


More information about the Rtir mailing list