1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
#!/usr/bin/perl -w
use strict; no strict "vars";
my $conffile="/etc/distributed-net-pproxy.conf";
my $force=0;
my $m;
$m=0;
if ($#ARGV >= 0) {
$force=($ARGV[0] eq "--force"); if ($force) { $m++; }
}
if ($m <= $#ARGV) { $conffile=$ARGV[$m]; }
sub input
{
my($message)=$_[0];
my($defanswer)=$_[1];
my($promptw)=$_[2] || "24";
my($answ)=$_[3] || "12";
my($reply);
printf "%-${promptw}s [%-${answ}s]: ",$message,$defanswer;
$reply=<STDIN>; chop($reply); if ($reply eq "") { $reply=$defanswer; }
return $reply;
}
sub yninput
{
my($message)=$_[0];
my($defanswer)=$_[1];
my($reply);
printf "%s? (y/n) [%s]: ",$message,$defanswer;
$reply=<STDIN>; chop($reply); if ($reply eq "") { $reply=$defanswer; }
return $reply;
}
if ( -e $conffile && !$force)
{
print<<EOT;
You already have an Personal Proxy configuration file installed.
I assume that it is already correctly configured and won't overwrite it.
EOT
exit 0;
}
$ipaddress="us.v27.distributed.net";
$proxymessage="Debian GNU/Linux";
$deskmin=200;
$deskmax=400;
$deskdone=10;
$rc5kmin=200;
$rc5kmax=400;
$rc5kdone=10;
$ogrkmin=200;
$ogrkmax=400;
$ogrkdone=10;
$csckmin=200;
$csckmax=400;
$csckdone=10;
print "\nConfiguring $conffile.\n\n";
do {
print <<EOT;
First you need to specify which keyproxy you will be connecting to.
The main keyservers are:
us.v27.distributed.net (United States, Canada)
euro.v27.distributed.net (Europe)
asia.v27.distributed.net (Asia)
aussie.v27.distributed.net (Australia, New Zealand)
You may also specify another personal proxy here.
Note that if you need to connect via the telnet or http ports (23 and
80) to avoid firewalling problems, you will need to edit the .conf file
by hand. A README is in /usr/share/doc/distributed-net-pproxy.
EOT
$ipaddress=&input("Keyserver address", $ipaddress);
$proxymessage=&input("Message for clients", $proxymessage);
print "\n";
$deskmin=&input( "DES: Minimum keys to have buffered", $deskmin, 39,5);
$deskmax=&input( "DES: Maximum keys to have buffered", $deskmax, 39,5);
$deskdone=&input( "DES: Minimum number of keys to submit", $deskdone, 39,5);
print "\n";
$rc5kmin=&input( "RC5: Minimum keys to have buffered", $rc5kmin, 39,5);
$rc5kmax=&input( "RC5: Maximum keys to have buffered", $rc5kmax, 39,5);
$rc5kdone=&input( "RC5: Minimum number of keys to submit", $rc5kdone, 39,5);
print "\n";
$ogrkmin=&input( "OGR: Minimum keys to have buffered", $ogrkmin, 39,5);
$ogrkmax=&input( "OGR: Maximum keys to have buffered", $ogrkmax, 39,5);
$ogrkdone=&input( "OGR: Minimum number of keys to submit", $ogrkdone, 39,5);
print "\n";
$csckmin=&input( "CSC: Minimum keys to have buffered", $csckmin, 39,5);
$csckmax=&input( "CSC: Maximum keys to have buffered", $csckmax, 39,5);
$csckdone=&input( "CSC: Minimum number of keys to submit", $csckdone, 39,5);
print "\n";
$ans=&yninput("Are these responses correct","y");
} until ( $ans eq "y" );
open( PPINI, ">$conffile" ) || die "Couldn't create $conffile";
print PPINI "[KeyServer]\n";
print PPINI "ipaddress=$ipaddress\n";
print PPINI "port=2064\n";
print PPINI "workperiod=60\n";
print PPINI "[ports]\n";
print PPINI "port=2064\n";
print PPINI "testport=3064\n";
print PPINI "timeout=30\n";
print PPINI "[console]\n";
print PPINI "detached=0\n";
print PPINI "logfileconsole=/dev/null\n";
print PPINI "logfileconsolerotation=none\n";
print PPINI "consoleverbosity=255\n";
print PPINI "[rc564]\n";
print PPINI "logfilekeyblock=/var/log/distributed-net-pproxy/rc5pkey\n";
print PPINI "logfilekeyblockrotation=monthly\n";
print PPINI "minkeysready=$rc5kmin\n";
print PPINI "maxkeysready=$rc5kmax\n";
print PPINI "maxkeysdone=$rc5kdone\n";
print PPINI "timeaverage=12\n";
print PPINI "randomprefix=107\n";
print PPINI "[desII]\n";
print PPINI "logfilekeyblock=/var/log/distributed-net-pproxy/despkey\n";
print PPINI "logfilekeyblockrotation=monthly\n";
print PPINI "minkeysready=$deskmin\n";
print PPINI "maxkeysready=$deskmax\n";
print PPINI "maxkeysdone=$deskdone\n";
print PPINI "timeaverage=12\n";
print PPINI "contestclosed=-1091571699\n";
print PPINI "[ogr]\n";
print PPINI "logfilekeyblock=/var/log/distributed-net-pproxy/ogrpkey\n";
print PPINI "logfilekeyblockrotation=monthly\n";
print PPINI "minkeysready=$ogrkmin\n";
print PPINI "maxkeysready=$ogrkmax\n";
print PPINI "maxkeysdone=$ogrkdone\n";
print PPINI "timeaverage=12\n";
print PPINI "[csc]\n";
print PPINI "logfilekeyblock=/var/log/distributed-net-pproxy/cscpkey\n";
print PPINI "logfilekeyblockrotation=monthly\n";
print PPINI "minkeysready=$csckmin\n";
print PPINI "maxkeysready=$csckmax\n";
print PPINI "maxkeysdone=$csckdone\n";
print PPINI "timeaverage=12\n";
print PPINI "[misc]\n";
print PPINI "proxymessage=\"$proxymessage\"\n";
print PPINI "showcumulativestats=0\n";
close(PPINI);
print<<EOT;
$conffile generated.
You'll probably want to finetune your newly created .conf file.
Please read the documentation and sample .conf in
/usr/share/doc/distributed-net-pproxy before doing this.
EOT
my $display=$ENV{"DISPLAY"} || "";
$dummy="";
print "Press enter to continue"; $dummy=<STDIN>;
exit 0;
|