From 301db34ccc66bf905e88bb3e83171c67f3c1e4dc Mon Sep 17 00:00:00 2001 From: short <> Date: Wed, 8 Oct 2003 10:28:35 +0000 Subject: [PATCH 1/1] bootstrap --- hostintranet/etc-inittab | 1 + hostintranet/hostintranet-ssht.pl | 55 ++++++++++++++++++++++ .../public.internet.com--hostintranet-ssht | 4 ++ ...ublic.internet.com--hostintranet-ssht--identity | 1 + public.internet.com/etc-passwd | 1 + .../home-hostintranet-ssht/.ssh/authorized_keys | 1 + .../home-hostintranet-ssht/hostintranet-ssht.log | 0 .../home-hostintranet-ssht/hostintranet-ssht.pl | 55 ++++++++++++++++++++++ 8 files changed, 118 insertions(+) create mode 100644 hostintranet/etc-inittab create mode 100755 hostintranet/hostintranet-ssht.pl create mode 100755 hostintranet/public.internet.com--hostintranet-ssht create mode 100644 hostintranet/public.internet.com--hostintranet-ssht--identity create mode 100644 public.internet.com/etc-passwd create mode 100644 public.internet.com/home-hostintranet-ssht/.ssh/authorized_keys create mode 100644 public.internet.com/home-hostintranet-ssht/hostintranet-ssht.log create mode 100755 public.internet.com/home-hostintranet-ssht/hostintranet-ssht.pl diff --git a/hostintranet/etc-inittab b/hostintranet/etc-inittab new file mode 100644 index 0000000..70dd759 --- /dev/null +++ b/hostintranet/etc-inittab @@ -0,0 +1 @@ +gw:2345:respawn:/root/public.internet.com--hostintranet-ssht diff --git a/hostintranet/hostintranet-ssht.pl b/hostintranet/hostintranet-ssht.pl new file mode 100755 index 0000000..c5e42a9 --- /dev/null +++ b/hostintranet/hostintranet-ssht.pl @@ -0,0 +1,55 @@ +#! /usr/bin/perl -Tw -- + +use strict; +#use warnings; #-w + +use constant LOGFNAME=>"/root/hostintranet-ssht-out.log"; + +open LOG,">>".LOGFNAME + or die "append: ".LOGFNAME; +my $stdout=select(); +$|=1; +select LOG; +$|=1; +select $stdout; + +my($nulldev ,$nullinode )=stat "/dev/null"; +my($stdindev,$stdininode)=stat STDIN; +my $isnull=($nulldev==$stdindev && $nullinode==$stdininode); + +sub out +{ +my($msg)=@_; + + $msg="$$: $msg\n"; + print LOG $msg; + print $msg; +} + +sub outdie +{ +my($msg)=@_; + + out $msg; + die $msg; +} + +out "CONNECT"; +for (;;) { + out scalar localtime(time()); + + my $tmo=60; + while ($tmo-->0) { + sleep 1; + next if $isnull; + + my $rfds=""; + vec($rfds,fileno(STDIN),1)=1; + my $efds=$rfds; + next if 1!=select $rfds,undef,$efds,0; + my $got; + outdie "expectfds" if vec($efds,fileno(STDIN),1); + my $sysread; + outdie "sysread=$sysread" if 1!=($sysread=sysread STDIN,$got,1); + } + } diff --git a/hostintranet/public.internet.com--hostintranet-ssht b/hostintranet/public.internet.com--hostintranet-ssht new file mode 100755 index 0000000..13c5887 --- /dev/null +++ b/hostintranet/public.internet.com--hostintranet-ssht @@ -0,0 +1,4 @@ +#! /bin/sh +/root/hostintranet-ssht.pl > /root/hostintranet-ssht-in.log 2>&1 diff --git a/hostintranet/public.internet.com--hostintranet-ssht--identity b/hostintranet/public.internet.com--hostintranet-ssht--identity new file mode 100644 index 0000000..3622492 --- /dev/null +++ b/hostintranet/public.internet.com--hostintranet-ssht--identity @@ -0,0 +1 @@ +private key from ~/.ssh/id_dsa diff --git a/public.internet.com/etc-passwd b/public.internet.com/etc-passwd new file mode 100644 index 0000000..d4fe57f --- /dev/null +++ b/public.internet.com/etc-passwd @@ -0,0 +1 @@ +hostintranet-ssht:x:1006:1006:hostintranet ssht:/home/hostintranet-ssht:/home/hostintranet-ssht/hostintranet-ssht.pl diff --git a/public.internet.com/home-hostintranet-ssht/.ssh/authorized_keys b/public.internet.com/home-hostintranet-ssht/.ssh/authorized_keys new file mode 100644 index 0000000..c6e87f5 --- /dev/null +++ b/public.internet.com/home-hostintranet-ssht/.ssh/authorized_keys @@ -0,0 +1 @@ +public key from ~/.ssh/id_dsa.pub diff --git a/public.internet.com/home-hostintranet-ssht/hostintranet-ssht.log b/public.internet.com/home-hostintranet-ssht/hostintranet-ssht.log new file mode 100644 index 0000000..e69de29 diff --git a/public.internet.com/home-hostintranet-ssht/hostintranet-ssht.pl b/public.internet.com/home-hostintranet-ssht/hostintranet-ssht.pl new file mode 100755 index 0000000..e29f516 --- /dev/null +++ b/public.internet.com/home-hostintranet-ssht/hostintranet-ssht.pl @@ -0,0 +1,55 @@ +#! /usr/bin/perl -Tw -- + +use strict; +#use warnings; #-w + +use constant LOGFNAME=>"/home/hostintranet-ssht/hostintranet-ssht.log"; + +open LOG,">>".LOGFNAME + or die "append: ".LOGFNAME; +my $stdout=select(); +$|=1; +select LOG; +$|=1; +select $stdout; + +my($nulldev ,$nullinode )=stat "/dev/null"; +my($stdindev,$stdininode)=stat STDIN; +my $isnull=($nulldev==$stdindev && $nullinode==$stdininode); + +sub out +{ +my($msg)=@_; + + $msg="$$: $msg\n"; + print LOG $msg; + print $msg; +} + +sub outdie +{ +my($msg)=@_; + + out $msg; + die $msg; +} + +out "CONNECT"; +for (;;) { + out scalar localtime(time()); + + my $tmo=60; + while ($tmo-->0) { + sleep 1; + next if $isnull; + + my $rfds=""; + vec($rfds,fileno(STDIN),1)=1; + my $efds=$rfds; + next if 1!=select $rfds,undef,$efds,0; + my $got; + outdie "expectfds" if vec($efds,fileno(STDIN),1); + my $sysread; + outdie "sysread=$sysread" if 1!=($sysread=sysread STDIN,$got,1); + } + } -- 1.8.3.1