#!/usr/bin/perl # # Host SSH # # Douglas Thrift # # $Id$ use strict; use LWP::UserAgent; use POSIX; use MIME::Base64 qw(encode_base64); my $agent = LWP::UserAgent->new; my ($sysname, $nodename, $release, $version, $machine) = uname(); my $host = $ARGV[0]; if ($host eq "") { die "$0: no host"; } elsif (!($host =~ /\./)) { $host .= ".local.douglasthrift.net"; } $agent->agent("Host SSH/1.0 ($sysname $release $machine) "); my $response = $agent->post("http://topsecret.douglasthrift.net/auth/hostupdat" . "e.cgi", [host => $host, mode => "n"], Authorization => "Basic " . encode_base64("HostUpdate:frell2003")); my $content = $response->content; if ($content =~ /^name=(.+)$/) { system ("ssh -L 8080:localhost:80 -R 8080:localhost:80 -L 5900:localhost:5" . "900 -L 2302:localhost:23 Douglas\\ Thrift\@$1"); }