| 1 |
#!/usr/bin/perl -w |
| 2 |
|
| 3 |
# myproxy test script |
| 4 |
# written by Jim Basney <[email protected]> |
| 5 |
|
| 6 |
# Assumes myproxy-server running as root on the local machine if |
| 7 |
# MYPROXY_SERVER not set. |
| 8 |
# Requires a valid proxy credential with lifetime of at least 3 hours |
| 9 |
# unless the -generatecerts option is used |
| 10 |
# Assumes myproxy-server.config has default policy. |
| 11 |
# |
| 12 |
# Some tests only run if -startserver is given. |
| 13 |
|
| 14 |
use File::Temp qw(tempdir); |
| 15 |
use File::Copy; |
| 16 |
use IPC::Open3; |
| 17 |
use Socket; |
| 18 |
|
| 19 |
$tmpdir = tempdir(CLEANUP => 1); |
| 20 |
my $openssl = $ENV{OPENSSL} || "openssl"; |
| 21 |
|
| 22 |
$PROXYBITS = "-bits 2048"; |
| 23 |
|
| 24 |
# |
| 25 |
# handle cmdline options |
| 26 |
# |
| 27 |
$usage = "usage: myproxy-test [-help] [-verbose] [-startserver]\n" . |
| 28 |
" [-performance iterations clients]\n" . |
| 29 |
" [-dbperformance] [-valgrind]\n" . |
| 30 |
" [-generatecerts]\n" ; |
| 31 |
$startserver = 0; |
| 32 |
$performance = 0; |
| 33 |
$dbperformance = 0; |
| 34 |
$perfiters = 0; |
| 35 |
$perfclients = 0; |
| 36 |
$verbose = 0; |
| 37 |
$generatecerts = 0; |
| 38 |
while (($arg = shift @ARGV)) { |
| 39 |
if ($arg eq "-h" || $arg eq "-help") { |
| 40 |
print STDERR $usage; |
| 41 |
exit 1; |
| 42 |
} elsif ($arg eq "-v" || $arg eq "-verbose") { |
| 43 |
$verbose = 1; |
| 44 |
} elsif ($arg eq "-startserver") { |
| 45 |
$startserver = 1; |
| 46 |
} elsif ($arg eq "-performance") { |
| 47 |
$performance = 1; |
| 48 |
$perfiters = shift @ARGV; |
| 49 |
$perfclients = shift @ARGV; |
| 50 |
} elsif ($arg eq "-dbperformance") { |
| 51 |
$dbperformance = 1; |
| 52 |
} elsif ($arg eq "-valgrind") { |
| 53 |
chomp($valgrind = `which valgrind 2>/dev/null`); |
| 54 |
die "valgrind not in PATH, stopped" if (!(-x $valgrind)); |
| 55 |
&write_valgrind_supp(); |
| 56 |
$valgrind .= " --leak-check=full"; |
| 57 |
$valgrind .= " --suppressions=$tmpdir/valgrind.supp"; |
| 58 |
$valgrind .= " --undef-value-errors=no"; |
| 59 |
$valgrind .= " --gen-suppressions=all"; |
| 60 |
$valgrind .= " --num-callers=50 -q "; |
| 61 |
} elsif ($arg eq "-generatecerts" ) { |
| 62 |
$generatecerts = 1; |
| 63 |
} else { |
| 64 |
print STDERR $usage; |
| 65 |
exit 1; |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
# |
| 70 |
# If generatecerts option is specified then create |
| 71 |
# a private CA and proxy locally and use them. |
| 72 |
if ( $generatecerts) { |
| 73 |
die("-generatecerts option requires -startserver option") unless ($startserver); |
| 74 |
my $privcerts = "$tmpdir/privcerts.$$" ; |
| 75 |
print STDERR "creating a CA in ", $privcerts, "\n" if ($verbose); |
| 76 |
mkdir("$privcerts") || |
| 77 |
die("failed to create $privcerts directory, stopped") ; |
| 78 |
open(SSLCNF, ">$privcerts/openssl.cnf") || |
| 79 |
die("failed to create $privcerts/openssl.cnf: $!"); |
| 80 |
print SSLCNF <<EOF; |
| 81 |
[ ca ] |
| 82 |
default_ca = CA_default # The default ca section |
| 83 |
|
| 84 |
[ CA_default ] |
| 85 |
dir = $privcerts # top dir |
| 86 |
database = $privcerts/index.txt # index file. |
| 87 |
new_certs_dir = $privcerts/ # new certs dir |
| 88 |
|
| 89 |
certificate = $privcerts/cacert.pem # The CA cert |
| 90 |
serial = $privcerts/serial # serial no file |
| 91 |
private_key = $privcerts/cakey.pem # CA private key |
| 92 |
RANDFILE = $privcerts/.rand # random number file |
| 93 |
default_md = default |
| 94 |
|
| 95 |
[ req ] |
| 96 |
default_bits = 2048 |
| 97 |
default_md = sha256 |
| 98 |
distinguished_name = req_distinguished_name |
| 99 |
|
| 100 |
[ req_distinguished_name ] |
| 101 |
commonName = Common Name (hostname, IP, or your name) |
| 102 |
commonName_max = 64 |
| 103 |
|
| 104 |
[ v3_ca ] |
| 105 |
basicConstraints = CA:TRUE |
| 106 |
subjectKeyIdentifier = hash |
| 107 |
authorityKeyIdentifier = keyid:always,issuer:always |
| 108 |
|
| 109 |
[ policy_anything ] |
| 110 |
commonName = supplied |
| 111 |
|
| 112 |
EOF |
| 113 |
|
| 114 |
close(SSLCNF); |
| 115 |
open(CAINDEX,">$privcerts/index.txt") || |
| 116 |
die("failed to create $privcerts/index.txt"); |
| 117 |
close(CAINDEX); |
| 118 |
open(SERIAL,">$privcerts/serial") || |
| 119 |
die("failed to create $privcerts/serial"); |
| 120 |
print SERIAL "01\n"; |
| 121 |
close(SERIAL); |
| 122 |
&runcmd("$openssl req -batch -subj '/CN=MyProxy Test CA' -config $privcerts/openssl.cnf -new -x509 -extensions v3_ca -nodes -keyout $privcerts/cakey.pem -out $privcerts/cacert.pem -days 30"); |
| 123 |
|
| 124 |
chomp($hash = `$openssl x509 -in $privcerts/cacert.pem -hash -noout`) ; |
| 125 |
mkdir("$privcerts/grid-security") || |
| 126 |
die("failed to create $privcerts/grid-security"); |
| 127 |
copy("$privcerts/cacert.pem","$privcerts/grid-security/$hash.0") || |
| 128 |
die("failed to copy $privcerts/cacert.pem","$privcerts/grid-security/$hash.0"); |
| 129 |
open(POLICY,">$privcerts/grid-security/$hash.signing_policy") || |
| 130 |
die("failed to create $privcerts/grid-security/$hash.signing_policy"); |
| 131 |
print POLICY "access_id_CA X509 '/CN=MyProxy Test CA'\n"; |
| 132 |
print POLICY "pos_rights globus CA:sign\n"; |
| 133 |
print POLICY "cond_subjects globus '\"/*\"'\n"; |
| 134 |
close(POLICY); |
| 135 |
print STDERR "creating a user certificate request ", $privcerts, "\n" if ($verbose); |
| 136 |
&runcmd("$openssl req -batch -subj '/CN=MyProxy Test User' -config $privcerts/openssl.cnf -new -nodes -keyout $privcerts/userkey.pem -out $privcerts/usercert.csr -days 7") ; |
| 137 |
print STDERR "signing user certificate with by CA in ", $privcerts, "\n" if ($verbose); |
| 138 |
&runcmd("$openssl ca -batch -days 7 -config $privcerts/openssl.cnf -policy policy_anything -out $privcerts/usercert.pem -infiles $privcerts/usercert.csr"); |
| 139 |
chmod(oct("0600"),"$privcerts/userkey.pem","$privcerts/usercert.pem") || |
| 140 |
die("failed to chmod $privcerts/userkey.pem or $privcerts/usercert.pem"); |
| 141 |
$ENV{'X509_USER_CERT'} = "$privcerts/usercert.pem" ; |
| 142 |
$ENV{'X509_USER_KEY'} = "$privcerts/userkey.pem" ; |
| 143 |
$ENV{'X509_CERT_DIR'} = "$privcerts/grid-security" ; |
| 144 |
print STDERR "generating a user proxy\n" if ($verbose); |
| 145 |
chomp($grid_proxy_init = `which grid-proxy-init 2>/dev/null`); |
| 146 |
die "grid-proxy-init not found, stopped" if (!(-x $grid_proxy_init)); |
| 147 |
&runcmd("$grid_proxy_init -debug $PROXYBITS"); |
| 148 |
} #end of generatecerts. |
| 149 |
|
| 150 |
# |
| 151 |
# make sure I have a valid proxy |
| 152 |
# |
| 153 |
chomp($grid_proxy_init = `which grid-proxy-init 2>/dev/null`); |
| 154 |
die "grid-proxy-init not found, stopped" if (!(-x $grid_proxy_init)); |
| 155 |
chomp($grid_proxy_info = `which grid-proxy-info 2>/dev/null`); |
| 156 |
die "grid-proxy-info not found, stopped" if (!(-x $grid_proxy_info)); |
| 157 |
chomp($grid_cert_info = `which grid-cert-info 2>/dev/null`); |
| 158 |
die "grid-cert-info not found, stopped" if (!(-x $grid_cert_info)); |
| 159 |
$timeleft = `$grid_proxy_info -timeleft 2>/dev/null`; |
| 160 |
if (!defined($timeleft) || $timeleft eq "" || ($timeleft < 60*60*3)) { |
| 161 |
&debug("Problem with proxy. Will try to create a new one."); |
| 162 |
`$grid_proxy_init $PROXYBITS -pwstdin </dev/null >/dev/null 2>&1`; |
| 163 |
$timeleft = `$grid_proxy_info -timeleft 2>/dev/null`; |
| 164 |
} |
| 165 |
if (!defined($timeleft) || $timeleft eq "") { |
| 166 |
print STDERR "grid-proxy-info failed:\n"; |
| 167 |
system("$grid_proxy_info -timeleft"); # show the error |
| 168 |
die "stopped"; |
| 169 |
} |
| 170 |
die "proxy expired, stopped" if ($timeleft < 60); |
| 171 |
die "proxy lifetime too short, stopped" if ($timeleft < 60*60*6); |
| 172 |
die "proxy is limited, stopped" if (`$grid_proxy_info -type` =~ /limited/); |
| 173 |
chomp($cert_subject = `$grid_proxy_info -identity`); |
| 174 |
die "grid-proxy-info -identity failed, stopped" |
| 175 |
if (!defined($cert_subject) || $cert_subject eq ""); |
| 176 |
chomp($proxy_path = `$grid_proxy_info -path 2>/dev/null`); |
| 177 |
die "grid-proxy-info -path failed, stopped" if (!(-e $proxy_path)); |
| 178 |
($exitstatus, $output) = &verifyproxy($proxy_path); |
| 179 |
if ($exitstatus) { |
| 180 |
print STDERR $output; |
| 181 |
die if ($exitstatus); |
| 182 |
} |
| 183 |
|
| 184 |
# |
| 185 |
# check for the commands I want to run |
| 186 |
# |
| 187 |
chomp($myproxy_store = `which myproxy-store 2>/dev/null`); |
| 188 |
die "myproxy-store not in PATH, stopped" if (!(-x $myproxy_store)); |
| 189 |
chomp($myproxy_init = `which myproxy-init 2>/dev/null`); |
| 190 |
die "myproxy-init not in PATH, stopped" if (!(-x $myproxy_init)); |
| 191 |
chomp($myproxy_retrieve = `which myproxy-retrieve 2>/dev/null`); |
| 192 |
die "myproxy-retrieve not in PATH, stopped" if (!(-x $myproxy_retrieve)); |
| 193 |
chomp($myproxy_info = `which myproxy-info 2>/dev/null`); |
| 194 |
die "myproxy-info not in PATH, stopped" if (!(-x $myproxy_info)); |
| 195 |
chomp($myproxy_destroy = `which myproxy-destroy 2>/dev/null`); |
| 196 |
die "myproxy-destroy not in PATH, stopped" if (!(-x $myproxy_destroy)); |
| 197 |
chomp($myproxy_get = `which myproxy-logon 2>/dev/null`); |
| 198 |
die "myproxy-logon not in PATH, stopped" if (!(-x $myproxy_get)); |
| 199 |
chomp($myproxy_passwd = `which myproxy-change-pass-phrase 2>/dev/null`); |
| 200 |
die "myproxy-change-pass-phrase not in PATH, stopped" |
| 201 |
if (!(-x $myproxy_passwd)); |
| 202 |
chomp($bintrue = `which true 2>/dev/null`); |
| 203 |
|
| 204 |
# |
| 205 |
# setup environment variables |
| 206 |
# |
| 207 |
if (!defined($ENV{'MYPROXY_SERVER'})) { |
| 208 |
chomp($hostname = `hostname 2>/dev/null`); |
| 209 |
$ENV{'MYPROXY_SERVER'} = $hostname; |
| 210 |
} |
| 211 |
if (!defined($ENV{'X509_USER_PROXY'})) { |
| 212 |
$ENV{'X509_USER_PROXY'} = "/tmp/x509up_u$<"; |
| 213 |
} |
| 214 |
# make proxy from existing proxy, so we don't need to deal with long-term cred |
| 215 |
$ENV{'X509_USER_CERT'} = $ENV{'X509_USER_PROXY'}; |
| 216 |
$ENV{'X509_USER_KEY'} = $ENV{'X509_USER_PROXY'}; |
| 217 |
$ENV{'LOGNAME'} = $ENV{'USER'} if (!defined($ENV{'LOGNAME'})); |
| 218 |
$ENV{'LOGNAME'} = $ENV{'LOGNAME'} . ".myproxy-test"; |
| 219 |
|
| 220 |
# |
| 221 |
# make an independent proxy for a separate identity |
| 222 |
# |
| 223 |
$iproxyloc = "$tmpdir/iproxy.pem"; |
| 224 |
&runcmd("$grid_proxy_init $PROXYBITS -out $iproxyloc -independent -hours 0"); |
| 225 |
chomp($iproxysubject = `$grid_proxy_info -file $iproxyloc -identity`); |
| 226 |
die "grid-proxy-info -file $iproxyloc -identity failed, stopped" |
| 227 |
if (!defined($iproxysubject) || $iproxysubject eq ""); |
| 228 |
|
| 229 |
srand(time||$$); |
| 230 |
$passphrase = sprintf "%010d", int(rand(0x7fffffff)); |
| 231 |
$trustrootdir = "$tmpdir/.globus/certificates.test.$$"; |
| 232 |
$origtrustrootdir = $ENV{'X509_CERT_DIR'} if defined($ENV{'X509_CERT_DIR'}); |
| 233 |
|
| 234 |
&opensslsanitycheck(); |
| 235 |
|
| 236 |
# all temporary files accessible only by running user |
| 237 |
umask(0077); |
| 238 |
|
| 239 |
# |
| 240 |
# start server if requested |
| 241 |
# |
| 242 |
if ($startserver) { |
| 243 |
$ENV{'MYPROXY_SERVER'} = "localhost"; |
| 244 |
$ENV{'MYPROXY_SERVER_DN'} = $cert_subject; |
| 245 |
chomp($myproxy_server = `which myproxy-server 2>/dev/null`); |
| 246 |
die "myproxy-server not in PATH, stopped" if (!(-x $myproxy_server)); |
| 247 |
$serverdir = "$tmpdir/myproxy-test.serverdir.$$"; |
| 248 |
mkdir($serverdir, 0700) || |
| 249 |
die "failed to create $serverdir, stopped"; |
| 250 |
$serverconf = "$tmpdir/myproxy-test.serverconf.$$"; |
| 251 |
open(CONF, ">$serverconf") || |
| 252 |
die "failed to open $serverconf, stopped"; |
| 253 |
print CONF "accepted_credentials \"*\"\n"; |
| 254 |
print CONF "authorized_retrievers \"*\"\n"; |
| 255 |
print CONF "default_retrievers \"*\"\n"; |
| 256 |
print CONF "authorized_renewers \"*\"\n"; |
| 257 |
print CONF "default_renewers \"none\"\n"; |
| 258 |
print CONF "authorized_key_retrievers \"*\"\n"; |
| 259 |
print CONF "default_key_retrievers \"none\"\n"; |
| 260 |
print CONF "trusted_retrievers \"*\"\n"; |
| 261 |
print CONF "default_trusted_retrievers \"none\"\n"; |
| 262 |
print CONF "passphrase_policy_program $bintrue\n" if (-x $bintrue); |
| 263 |
print CONF "accepted_credentials_mapapp $bintrue\n" if (-x $bintrue); |
| 264 |
print CONF "allow_self_authorization true\n"; # for renewal testing |
| 265 |
print CONF "check_multiple_credentials true\n"; |
| 266 |
close(CONF); |
| 267 |
$SERVERPIDFILE = "$tmpdir/myproxy-test.serverpid.$$"; |
| 268 |
$SERVERPORTFILE = "$tmpdir/myproxy-test.serverport.$$"; |
| 269 |
$servercmd = "$myproxy_server -s $serverdir -c $serverconf"; |
| 270 |
$servercmd .= " -l $ENV{'MYPROXY_SERVER'} -p 0"; |
| 271 |
$servercmd .= " -P $SERVERPIDFILE -z $SERVERPORTFILE"; |
| 272 |
if (defined($valgrind)) { |
| 273 |
$valgrindlog = File::Temp::tempnam($tmpdir, "valgrind.log."); |
| 274 |
$valgrindlogopt = " --log-file=$valgrindlog "; |
| 275 |
$servercmd = $valgrind . $valgrindlogopt . $servercmd; |
| 276 |
} |
| 277 |
&debug("running '$servercmd'"); |
| 278 |
system($servercmd); |
| 279 |
sleep(2); # give server a chance to startup |
| 280 |
sleep(4) if (defined($valgrind)); # valgrind slows things down |
| 281 |
if (open SERVERPIDFILE) { |
| 282 |
chomp($serverpid = <SERVERPIDFILE>); |
| 283 |
close SERVERPIDFILE; |
| 284 |
} |
| 285 |
if (!defined($serverpid) || $serverpid eq "") { |
| 286 |
print STDERR "failed to start myproxy-server:\n"; |
| 287 |
system("$servercmd -d"); # send errors to STDERR |
| 288 |
if (defined($valgrindlog) && -e $valgrindlog) { |
| 289 |
print STDERR "valgrind log follows:\n"; |
| 290 |
system("cat $valgrindlog"); |
| 291 |
} |
| 292 |
&docleanup(); |
| 293 |
exit 1; |
| 294 |
} |
| 295 |
if (open SERVERPORTFILE) { |
| 296 |
chomp($serverport = <SERVERPORTFILE>); |
| 297 |
close SERVERPORTFILE; |
| 298 |
} |
| 299 |
if (!defined($serverport) || $serverport eq "") { |
| 300 |
print STDERR "myproxy-server didn't write portfile!\n"; |
| 301 |
&docleanup(); |
| 302 |
exit 1; |
| 303 |
} else { |
| 304 |
$ENV{'MYPROXY_SERVER_PORT'} = $serverport; |
| 305 |
print STDERR "server listening on port ", $serverport, "\n" if ($verbose); |
| 306 |
} |
| 307 |
} |
| 308 |
|
| 309 |
# |
| 310 |
# run performance tests if requested |
| 311 |
# |
| 312 |
if ($performance) { |
| 313 |
&doperftests(); |
| 314 |
exit 0; |
| 315 |
} |
| 316 |
|
| 317 |
# |
| 318 |
# BEGIN TESTS |
| 319 |
# |
| 320 |
$SUCCESSES = $FAILURES = 0; |
| 321 |
|
| 322 |
# commands to test: myproxy-init, myproxy-info, myproxy-destroy, |
| 323 |
# myproxy-logon, and myproxy-change-pass-phrase |
| 324 |
|
| 325 |
($exitstatus, $output) = |
| 326 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S", |
| 327 |
$passphrase . "\n"); |
| 328 |
print "MyProxy Test 1 (store credential with default name): "; |
| 329 |
if ($exitstatus == 0) { |
| 330 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 331 |
} else { |
| 332 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 333 |
print "Skipping remaining tests.\n"; |
| 334 |
goto end_of_all_tests; |
| 335 |
} |
| 336 |
|
| 337 |
($exitstatus, $output) = &runtest("myproxy-info -v", undef); |
| 338 |
print "MyProxy Test 2 (get info for stored credential): "; |
| 339 |
if ($exitstatus == 0 && $output =~ /username/) { |
| 340 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 341 |
} else { |
| 342 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 343 |
} |
| 344 |
|
| 345 |
($exitstatus, $output) = |
| 346 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 347 |
$passphrase . "\n"); |
| 348 |
print "MyProxy Test 3 (retrieve stored credential): "; |
| 349 |
if ($exitstatus == 0) { |
| 350 |
($exitstatus, $output) = |
| 351 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 352 |
} |
| 353 |
if ($exitstatus == 0) { |
| 354 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 355 |
} else { |
| 356 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 357 |
} |
| 358 |
|
| 359 |
($exitstatus, $output) = |
| 360 |
&runtest("myproxy-logon -t 1 -o - -v -S > $tmpdir/myproxy-test.$$", |
| 361 |
$passphrase . "\n"); |
| 362 |
print "MyProxy Test 3- (retrieve stored credential to stdout): "; |
| 363 |
if ($exitstatus == 0) { |
| 364 |
($exitstatus, $output) = |
| 365 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 366 |
} |
| 367 |
if ($exitstatus == 0) { |
| 368 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 369 |
} else { |
| 370 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 371 |
} |
| 372 |
|
| 373 |
($exitstatus, $output) = |
| 374 |
&runtest("myproxy-logon -t 1 -N -v -S", |
| 375 |
$passphrase . "\n"); |
| 376 |
print "MyProxy Test 3N (authenticate w/o retrieving credential): "; |
| 377 |
if ($exitstatus == 0) { |
| 378 |
($exitstatus, $output) = |
| 379 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 380 |
} |
| 381 |
if ($exitstatus == 0) { |
| 382 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 383 |
} else { |
| 384 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 385 |
} |
| 386 |
|
| 387 |
$ENV{'X509_CERT_DIR'} = $trustrootdir; |
| 388 |
($exitstatus, $output) = |
| 389 |
&runtest("myproxy-logon -T -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 390 |
$passphrase . "\n"); |
| 391 |
print "MyProxy Test 3T (retrieve stored credential w/ trustroots): "; |
| 392 |
if ($exitstatus == 0) { |
| 393 |
($exitstatus, $output) = |
| 394 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 395 |
} |
| 396 |
if ($exitstatus == 0) { |
| 397 |
($exitstatus, $output) = |
| 398 |
&verifytrustroots(); |
| 399 |
} |
| 400 |
if ($exitstatus == 0) { |
| 401 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 402 |
} else { |
| 403 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 404 |
} |
| 405 |
if (defined($origtrustrootdir)) { |
| 406 |
$ENV{'X509_CERT_DIR'} = $origtrustrootdir; |
| 407 |
} else { |
| 408 |
delete $ENV{'X509_CERT_DIR'}; |
| 409 |
} |
| 410 |
|
| 411 |
if (defined($serverconf)) { |
| 412 |
system("touch $serverconf") && die "failed to touch $serverconf, stopped"; |
| 413 |
($exitstatus, $output) = |
| 414 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 415 |
$passphrase . "\n"); |
| 416 |
print "MyProxy Test 3R1 (retrieve stored credential after server reconfig): "; |
| 417 |
if ($exitstatus == 0) { |
| 418 |
($exitstatus, $output) = |
| 419 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 420 |
} |
| 421 |
if ($exitstatus == 0) { |
| 422 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 423 |
} else { |
| 424 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 425 |
} |
| 426 |
system("touch $serverconf") && die "failed to touch $serverconf, stopped"; |
| 427 |
($exitstatus, $output) = |
| 428 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 429 |
$passphrase . "\n"); |
| 430 |
print "MyProxy Test 3R2 (retrieve stored credential after server reconfig): "; |
| 431 |
if ($exitstatus == 0) { |
| 432 |
($exitstatus, $output) = |
| 433 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 434 |
} |
| 435 |
if ($exitstatus == 0) { |
| 436 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 437 |
} else { |
| 438 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 439 |
} |
| 440 |
system("touch $serverconf") && die "failed to touch $serverconf, stopped"; |
| 441 |
($exitstatus, $output) = |
| 442 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 443 |
$passphrase . "\n"); |
| 444 |
print "MyProxy Test 3R3 (retrieve stored credential after server reconfig): "; |
| 445 |
if ($exitstatus == 0) { |
| 446 |
($exitstatus, $output) = |
| 447 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 448 |
} |
| 449 |
if ($exitstatus == 0) { |
| 450 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 451 |
} else { |
| 452 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 453 |
} |
| 454 |
} |
| 455 |
|
| 456 |
($exitstatus, $output) = |
| 457 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 458 |
"badpassphrase\n"); |
| 459 |
print "MyProxy Test 4 (verify passphrase checking on retrieve): "; |
| 460 |
if ($exitstatus != 0 && $output =~ /invalid credential passphrase/) { |
| 461 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 462 |
} else { |
| 463 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 464 |
} |
| 465 |
|
| 466 |
($exitstatus, $output) = |
| 467 |
&runtest("myproxy-logon -t 1 -N -v -S", |
| 468 |
"badpassphrase\n"); |
| 469 |
print "MyProxy Test 4N (verify passphrase checking on authenticate): "; |
| 470 |
if ($exitstatus != 0 && $output =~ /invalid credential passphrase/) { |
| 471 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 472 |
} else { |
| 473 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 474 |
} |
| 475 |
|
| 476 |
$old_passphrase = $passphrase; |
| 477 |
$passphrase = sprintf "%010d", int(rand(0x7fffffff)); |
| 478 |
($exitstatus, $output) = |
| 479 |
&runtest("myproxy-change-pass-phrase -v -S", |
| 480 |
"$old_passphrase\n$passphrase\n"); |
| 481 |
print "MyProxy Test 5 (change passphrase for credential): "; |
| 482 |
if ($exitstatus == 0 && $output =~ /Pass phrase changed/) { |
| 483 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 484 |
} else { |
| 485 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 486 |
} |
| 487 |
|
| 488 |
($exitstatus, $output) = |
| 489 |
&runtest("myproxy-logon -t 1 -N -v -S", |
| 490 |
$passphrase . "\n"); |
| 491 |
print "MyProxy Test 6 (verify new passphrase): "; |
| 492 |
if ($exitstatus == 0) { |
| 493 |
($exitstatus, $output) = |
| 494 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 495 |
} |
| 496 |
if ($exitstatus == 0) { |
| 497 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 498 |
} else { |
| 499 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 500 |
} |
| 501 |
|
| 502 |
($exitstatus, $output) = |
| 503 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 504 |
$old_passphrase . "\n"); |
| 505 |
print "MyProxy Test 7 (verify old passphrase fails): "; |
| 506 |
if ($exitstatus != 0 && $output =~ /invalid credential passphrase/) { |
| 507 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 508 |
} else { |
| 509 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 510 |
} |
| 511 |
|
| 512 |
($exitstatus, $output) = |
| 513 |
&runtest("myproxy-logon -a \$X509_USER_PROXY -t 1 -o $tmpdir/myproxy-test.$$ -v", undef); |
| 514 |
print "MyProxy Test 8 (verify default renewal policy): "; |
| 515 |
if ($exitstatus != 0) { |
| 516 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 517 |
} else { |
| 518 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 519 |
} |
| 520 |
|
| 521 |
($exitstatus, $output) = |
| 522 |
&runtest("myproxy-destroy -v", undef); |
| 523 |
print "MyProxy Test 9 (remove credential from repository): "; |
| 524 |
if ($exitstatus == 0 && $output =~ /was successfully removed/) { |
| 525 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 526 |
} else { |
| 527 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 528 |
} |
| 529 |
|
| 530 |
($exitstatus, $output) = |
| 531 |
&runtest("myproxy-info -v", undef); |
| 532 |
print "MyProxy Test 10 (verify credentials are removed): "; |
| 533 |
if (!($output =~ /default credential/)) { |
| 534 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 535 |
} else { |
| 536 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 537 |
} |
| 538 |
|
| 539 |
# |
| 540 |
# Test 10.a |
| 541 |
# |
| 542 |
if ($startserver && defined($serverpid)) { # only case we have direct access to server |
| 543 |
# ($exitstatus, $output) = kill('HUP', $serverpid); |
| 544 |
($exitstatus, $output) = &runtest("/bin/kill -HUP $serverpid"); |
| 545 |
print "MyProxy Test 10.a (kill -HUP $serverpid): "; |
| 546 |
if ($exitstatus != 0) { |
| 547 |
print "FAILED with $exitstatus\n"; $FAILURES++; |
| 548 |
print STDERR $output; |
| 549 |
} else { |
| 550 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 551 |
} |
| 552 |
} else { |
| 553 |
print "MyProxy Test 10.a (kill -HUP <myproxy-server>): SKIPPED\n"; |
| 554 |
} |
| 555 |
|
| 556 |
|
| 557 |
($exitstatus, $output) = |
| 558 |
&runtest("myproxy-init -v -r 'nobody' -k 'nobody' -c 1 -t 1 -S", |
| 559 |
$passphrase . "\n"); |
| 560 |
print "MyProxy Test 11 (store credentials with retrieval policies): "; |
| 561 |
if ($exitstatus == 0) { |
| 562 |
($exitstatus, $output) = |
| 563 |
&runtest("myproxy-init -v -x -r '$cert_subject' -k 'mine' -c 1 -t 1 -S", |
| 564 |
$passphrase . "\n"); |
| 565 |
} |
| 566 |
if ($exitstatus == 0) { |
| 567 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 568 |
} else { |
| 569 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 570 |
} |
| 571 |
|
| 572 |
($exitstatus, $output) = |
| 573 |
&runtest("myproxy-logon -k 'mine' -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 574 |
$passphrase . "\n"); |
| 575 |
print "MyProxy Test 12 (verify retrieval policies): "; |
| 576 |
if ($exitstatus == 0) { |
| 577 |
($exitstatus, $output) = |
| 578 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 579 |
} |
| 580 |
if ($exitstatus == 0) { |
| 581 |
($exitstatus, $output) = |
| 582 |
&runtest("myproxy-logon -k 'nobody' -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 583 |
$passphrase . "\n"); |
| 584 |
if ($exitstatus != 0) { |
| 585 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 586 |
} else { |
| 587 |
print "FAILED\n"; $FAILURES++; |
| 588 |
print STDERR "Shouldn't have allowed retrieval.\n"; |
| 589 |
print STDERR $output; |
| 590 |
} |
| 591 |
} else { |
| 592 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 593 |
} |
| 594 |
&runtest("myproxy-destroy -v -k 'mine'", undef); |
| 595 |
&runtest("myproxy-destroy -v -k 'nobody'", undef); |
| 596 |
|
| 597 |
($exitstatus, $output) = |
| 598 |
&runtest("myproxy-init -v -R 'nobody' -k 'nobody' -c 1 -t 1 -d -S", |
| 599 |
$passphrase . "\n"); |
| 600 |
print "MyProxy Test 13 (store credentials with renewal policies): "; |
| 601 |
if ($exitstatus == 0) { |
| 602 |
($exitstatus, $output) = |
| 603 |
&runtest("myproxy-init -v -x -R '$cert_subject' -k 'mine' -c 1 -t 1 -d -S", |
| 604 |
$passphrase . "\n"); |
| 605 |
} |
| 606 |
if ($exitstatus == 0) { |
| 607 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 608 |
} else { |
| 609 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 610 |
} |
| 611 |
|
| 612 |
($exitstatus, $output) = &runtest("myproxy-info -v -d", undef); |
| 613 |
print "MyProxy Test 14 (get info for stored renewal credentials): "; |
| 614 |
if ($exitstatus == 0 && $output =~ /username/) { |
| 615 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 616 |
} else { |
| 617 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 618 |
} |
| 619 |
|
| 620 |
($exitstatus, $output) = |
| 621 |
&runtest("myproxy-logon -k 'mine' -a $ENV{'X509_USER_PROXY'} -t 1 -o $tmpdir/myproxy-test.$$ -v -d", |
| 622 |
undef); |
| 623 |
print "MyProxy Test 15 (verify renewal policies): "; |
| 624 |
if ($exitstatus == 0) { |
| 625 |
($exitstatus, $output) = |
| 626 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 627 |
} elsif ($output =~ /self-authz not allowed/) { |
| 628 |
$exitstatus = 0; # default policy will give this response |
| 629 |
} |
| 630 |
if ($exitstatus == 0) { |
| 631 |
($exitstatus, $output) = |
| 632 |
&runtest("myproxy-logon -k 'nobody' -a $ENV{'X509_USER_PROXY'} -t 1 -o $tmpdir/myproxy-test.$$ -v -d", |
| 633 |
undef); |
| 634 |
if ($exitstatus != 0) { |
| 635 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 636 |
} else { |
| 637 |
print "FAILED\n"; $FAILURES++; |
| 638 |
print STDERR "Shouldn't have allowed retrieval.\n"; |
| 639 |
print STDERR $output; |
| 640 |
} |
| 641 |
} else { |
| 642 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 643 |
} |
| 644 |
&runtest("myproxy-destroy -v -k 'mine' -d", undef); |
| 645 |
&runtest("myproxy-destroy -v -k 'nobody' -d", undef); |
| 646 |
|
| 647 |
($exitstatus, $output) = |
| 648 |
&runtest("myproxy-init -v -a -c 3 -t 2 -S", |
| 649 |
$passphrase . "\n"); |
| 650 |
print "MyProxy Test 16 (verify lifetime of retrieved credentials): "; |
| 651 |
if ($exitstatus == 0) { |
| 652 |
($exitstatus, $output) = |
| 653 |
&runtest("myproxy-logon -o $tmpdir/myproxy-test.$$ -v -S", |
| 654 |
$passphrase . "\n"); |
| 655 |
$timeleft = `$grid_proxy_info -file $tmpdir/myproxy-test.$$ -timeleft`; |
| 656 |
if (defined($timeleft) && |
| 657 |
$timeleft > 60*60*2+300 || $timeleft < 60*60*2-300) { |
| 658 |
$output = "Credential lifetime ($timeleft) incorrect." . |
| 659 |
"It should be " . (60*60*2) . ".\n"; |
| 660 |
$exitstatus = 1; |
| 661 |
} |
| 662 |
} |
| 663 |
if ($exitstatus == 0) { |
| 664 |
($exitstatus, $output) = |
| 665 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 666 |
} |
| 667 |
if ($exitstatus == 0) { |
| 668 |
($exitstatus, $output) = |
| 669 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 670 |
$passphrase . "\n"); |
| 671 |
$timeleft = `$grid_proxy_info -file $tmpdir/myproxy-test.$$ -timeleft`; |
| 672 |
if ($timeleft > 60*61 || $timeleft < 60*59) { |
| 673 |
$output = "Credential lifetime ($timeleft) incorrect." . |
| 674 |
"It should be " . (60*60) . ".\n"; |
| 675 |
$exitstatus = 1; |
| 676 |
} |
| 677 |
} |
| 678 |
if ($exitstatus == 0) { |
| 679 |
($exitstatus, $output) = |
| 680 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 681 |
} |
| 682 |
if ($exitstatus == 0) { |
| 683 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 684 |
} else { |
| 685 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 686 |
} |
| 687 |
&runtest("myproxy-destroy -v", undef); |
| 688 |
|
| 689 |
# |
| 690 |
# Start of myproxy-store and myproxy-retrieve tests |
| 691 |
# |
| 692 |
|
| 693 |
# commands to test: myproxy-store, myproxy-info, myproxy-destroy, |
| 694 |
# myproxy-logon, myproxy-retrieve, and |
| 695 |
# myproxy-change-pass-phrase |
| 696 |
|
| 697 |
# For myproxy-store, we need an encrypted key to store. |
| 698 |
# So, let's encrypt our proxy key. |
| 699 |
$passphrase = sprintf "%010d", int(rand(0x7fffffff)); |
| 700 |
$testkey = "$tmpdir/myproxy-test.$$.key"; |
| 701 |
&runcmd("$openssl rsa -des3 -passout stdin -in \$X509_USER_KEY -out $testkey", |
| 702 |
$passphrase . "\n"); |
| 703 |
chmod(0600, $testkey); |
| 704 |
|
| 705 |
# |
| 706 |
# Test 17 |
| 707 |
# |
| 708 |
($exitstatus, $output) = |
| 709 |
&runtest("myproxy-store -x -E '$cert_subject' -v -t 1 -y $testkey", undef); |
| 710 |
print "MyProxy Test 17 (store credential with default name): "; |
| 711 |
if ($exitstatus == 0) { |
| 712 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 713 |
} elsif (($output =~ /Error checking authorization/) || |
| 714 |
($output =~ /unknown command/)) { |
| 715 |
print "UNSUPPORTED\n"; $FAILURES++; |
| 716 |
print "Server does not support myproxy-store. Skipping futher myproxy-store tests.\n"; |
| 717 |
goto end_of_store_tests; |
| 718 |
} else { |
| 719 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 720 |
print "Skipping futher myproxy-store tests.\n"; |
| 721 |
goto end_of_store_tests; |
| 722 |
} |
| 723 |
|
| 724 |
# |
| 725 |
# Test 18 |
| 726 |
# |
| 727 |
($exitstatus, $output) = &runtest("myproxy-info -v", undef); |
| 728 |
print "MyProxy Test 18 (get info for stored credential): "; |
| 729 |
if ($exitstatus == 0 && $output =~ /username/) { |
| 730 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 731 |
} else { |
| 732 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 733 |
} |
| 734 |
|
| 735 |
# |
| 736 |
# Test 19 |
| 737 |
# |
| 738 |
($exitstatus, $output) = |
| 739 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 740 |
$passphrase . "\n"); |
| 741 |
print "MyProxy Test 19 (create proxy from stored credential): "; |
| 742 |
if ($exitstatus == 0) { |
| 743 |
($exitstatus, $output) = |
| 744 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 745 |
} |
| 746 |
if ($exitstatus == 0) { |
| 747 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 748 |
} else { |
| 749 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 750 |
} |
| 751 |
|
| 752 |
|
| 753 |
# |
| 754 |
# Test 20 |
| 755 |
# |
| 756 |
|
| 757 |
($exitstatus, $output) = |
| 758 |
&runtest("myproxy-retrieve -c $tmpdir/myproxy-test.cert.$$.pem -y $tmpdir/myproxy-test.key.$$.pem -v -S", |
| 759 |
$passphrase . "\n"); |
| 760 |
print "MyProxy Test 20 (retrieve stored credential): "; |
| 761 |
if ($exitstatus == 0) { |
| 762 |
($exitstatus, $output) = |
| 763 |
&verifycert("$tmpdir/myproxy-test.cert.$$.pem", "$tmpdir/myproxy-test.key.$$.pem"); |
| 764 |
} |
| 765 |
if ($exitstatus == 0) { |
| 766 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 767 |
} else { |
| 768 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 769 |
} |
| 770 |
unlink( "$tmpdir/myproxy-test.cert.$$.pem" ); |
| 771 |
unlink( "$tmpdir/myproxy-test.key.$$.pem" ); |
| 772 |
|
| 773 |
$ENV{'X509_CERT_DIR'} = $trustrootdir; |
| 774 |
($exitstatus, $output) = |
| 775 |
&runtest("myproxy-retrieve -T -c $tmpdir/myproxy-test.cert.$$.pem -y $tmpdir/myproxy-test.key.$$.pem -v -S", |
| 776 |
$passphrase . "\n"); |
| 777 |
print "MyProxy Test 20T (retrieve stored credential w/ trustroots): "; |
| 778 |
if ($exitstatus == 0) { |
| 779 |
($exitstatus, $output) = |
| 780 |
&verifycert("$tmpdir/myproxy-test.cert.$$.pem", "$tmpdir/myproxy-test.key.$$.pem"); |
| 781 |
} |
| 782 |
if ($exitstatus == 0) { |
| 783 |
($exitstatus, $output) = |
| 784 |
&verifytrustroots(); |
| 785 |
} |
| 786 |
if ($exitstatus == 0) { |
| 787 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 788 |
} else { |
| 789 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 790 |
} |
| 791 |
unlink( "$tmpdir/myproxy-test.cert.$$.pem" ); |
| 792 |
unlink( "$tmpdir/myproxy-test.key.$$.pem" ); |
| 793 |
if (defined($origtrustrootdir)) { |
| 794 |
$ENV{'X509_CERT_DIR'} = $origtrustrootdir; |
| 795 |
} else { |
| 796 |
delete $ENV{'X509_CERT_DIR'}; |
| 797 |
} |
| 798 |
|
| 799 |
# |
| 800 |
# Test 20.a |
| 801 |
# |
| 802 |
if ($startserver && defined($serverpid)) { # only case we have direct access to server |
| 803 |
# ($exitstatus, $output) = kill('HUP', $serverpid); |
| 804 |
($exitstatus, $output) = &runtest("/bin/kill -HUP $serverpid"); |
| 805 |
print "MyProxy Test 20.a (kill -HUP $serverpid): "; |
| 806 |
if ($exitstatus != 0) { |
| 807 |
print "FAILED with $exitstatus\n"; $FAILURES++; |
| 808 |
print STDERR $output; |
| 809 |
} else { |
| 810 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 811 |
} |
| 812 |
} else { |
| 813 |
print "MyProxy Test 20.a (kill -HUP <myproxy-server>): SKIPPED\n"; |
| 814 |
} |
| 815 |
|
| 816 |
# |
| 817 |
# Test 21 |
| 818 |
# |
| 819 |
($exitstatus, $output) = |
| 820 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 821 |
"badpassphrase\n"); |
| 822 |
print "MyProxy Test 21 (verify passphrase checking on myproxy-logon): "; |
| 823 |
if ($exitstatus != 0 && $output =~ /invalid credential passphrase/) { |
| 824 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 825 |
} else { |
| 826 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 827 |
} |
| 828 |
|
| 829 |
# |
| 830 |
# Test 22 |
| 831 |
# |
| 832 |
($exitstatus, $output) = |
| 833 |
&runtest("myproxy-retrieve -c $tmpdir/myproxy-test-cert.$$.pem -y $tmpdir/myproxy-test-key.$$.pem -v -S", |
| 834 |
"badpassphrase\n"); |
| 835 |
print "MyProxy Test 22 (verify passphrase checking on myproxy-retrieve): "; |
| 836 |
if ($exitstatus != 0 && $output =~ /invalid credential passphrase/) { |
| 837 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 838 |
} else { |
| 839 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 840 |
} |
| 841 |
unlink( "$tmpdir/myproxy-test.cert.$$.pem" ); |
| 842 |
unlink( "$tmpdir/myproxy-test.key.$$.pem" ); |
| 843 |
|
| 844 |
# |
| 845 |
# Test 23 |
| 846 |
# |
| 847 |
($exitstatus, $output) = |
| 848 |
&runtest("myproxy-logon -a \$X509_USER_PROXY -t 1 -o $tmpdir/myproxy-test.$$ -v", undef); |
| 849 |
print "MyProxy Test 23 (verify myproxy-logon default renewal policy): "; |
| 850 |
if ($exitstatus != 0) { |
| 851 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 852 |
} else { |
| 853 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 854 |
} |
| 855 |
|
| 856 |
# |
| 857 |
# Test 24 |
| 858 |
# |
| 859 |
($exitstatus, $output) = |
| 860 |
&runtest("myproxy-retrieve -a \$X509_USER_PROXY -c $tmpdir/myproxy-test-cert.$$.pem -y $tmpdir/myproxy-test-key.$$.pem -v", undef); |
| 861 |
print "MyProxy Test 24 (verify myproxy-retrieve default renewal policy): "; |
| 862 |
if ($exitstatus != 0) { |
| 863 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 864 |
} else { |
| 865 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 866 |
} |
| 867 |
unlink( "$tmpdir/myproxy-test-cert.$$.pem" ); |
| 868 |
unlink( "$tmpdir/myproxy-test-key.$$.pem" ); |
| 869 |
|
| 870 |
# |
| 871 |
# Test 25 |
| 872 |
# |
| 873 |
($exitstatus, $output) = |
| 874 |
&runtest("myproxy-destroy -v", undef); |
| 875 |
print "MyProxy Test 25 (remove credential from repository): "; |
| 876 |
if ($exitstatus == 0 && $output =~ /was successfully removed/) { |
| 877 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 878 |
} else { |
| 879 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 880 |
} |
| 881 |
|
| 882 |
# |
| 883 |
# Test 26 |
| 884 |
# |
| 885 |
($exitstatus, $output) = |
| 886 |
&runtest("myproxy-info -v", undef); |
| 887 |
print "MyProxy Test 26 (verify credentials are removed): "; |
| 888 |
if (!($output =~ /default credential/)) { |
| 889 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 890 |
} else { |
| 891 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 892 |
} |
| 893 |
|
| 894 |
# |
| 895 |
# Test 27 |
| 896 |
# |
| 897 |
($exitstatus, $output) = |
| 898 |
&runtest("myproxy-store -v -r 'nobody' -k 'nobody' -t 1 -y $testkey", |
| 899 |
undef); |
| 900 |
print "MyProxy Test 27 (store credentials with retrieval policies): "; |
| 901 |
|
| 902 |
if ($exitstatus == 0) { |
| 903 |
($exitstatus, $output) = |
| 904 |
&runtest("myproxy-store -x -E '$cert_subject' -v -r '$cert_subject' -k 'mine' -t 1 -y $testkey", undef); |
| 905 |
} |
| 906 |
if ($exitstatus == 0) { |
| 907 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 908 |
} else { |
| 909 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 910 |
} |
| 911 |
|
| 912 |
# |
| 913 |
# Test 28 |
| 914 |
# |
| 915 |
($exitstatus, $output) = |
| 916 |
&runtest("myproxy-logon -k 'mine' -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 917 |
$passphrase . "\n"); |
| 918 |
print "MyProxy Test 28 (verify myproxy-logon retrieval policies): "; |
| 919 |
|
| 920 |
if ($exitstatus == 0) { |
| 921 |
($exitstatus, $output) = |
| 922 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 923 |
} |
| 924 |
if ($exitstatus == 0) { |
| 925 |
($exitstatus, $output) = |
| 926 |
&runtest("myproxy-logon -k 'nobody' -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 927 |
$passphrase . "\n"); |
| 928 |
|
| 929 |
if ($exitstatus != 0) { |
| 930 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 931 |
} else { |
| 932 |
print "FAILED\n"; $FAILURES++; |
| 933 |
print STDERR "Shouldn't have allowed retrieval.\n"; |
| 934 |
print STDERR $output; |
| 935 |
} |
| 936 |
} else { |
| 937 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 938 |
} |
| 939 |
|
| 940 |
# |
| 941 |
# Test 29 |
| 942 |
# |
| 943 |
($exitstatus, $output) = |
| 944 |
&runtest("myproxy-retrieve -k 'mine' -c $tmpdir/myproxy-test.cert.12.1.$$.pem -y $tmpdir/myproxy-test.key.12.1.$$.pem -v -S", |
| 945 |
$passphrase . "\n"); |
| 946 |
print "MyProxy Test 29 (verify myproxy-retrieve retrieval policies): "; |
| 947 |
if ($exitstatus == 0) { |
| 948 |
($exitstatus, $output) = |
| 949 |
&verifycert("$tmpdir/myproxy-test.cert.12.1.$$.pem", "$tmpdir/myproxy-test.key.12.1.$$.pem"); |
| 950 |
} |
| 951 |
if ($exitstatus == 0) { |
| 952 |
($exitstatus, $output) = |
| 953 |
&runtest("myproxy-retrieve -k 'nobody' -c $tmpdir/myproxy-test.cert.12.2.$$.pem -y $tmpdir/myproxy-test.key.12.2.$$.pem -v -S", |
| 954 |
$passphrase . "\n"); |
| 955 |
if ($exitstatus != 0) { |
| 956 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 957 |
} else { |
| 958 |
print "FAILED\n"; $FAILURES++; |
| 959 |
print STDERR "Shouldn't have allowed retrieval.\n"; |
| 960 |
print STDERR $output; |
| 961 |
} |
| 962 |
} else { |
| 963 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 964 |
} |
| 965 |
&runtest("myproxy-destroy -v -k 'mine'", undef); |
| 966 |
&runtest("myproxy-destroy -v -k 'nobody'", undef); |
| 967 |
`rm -f $tmpdir/myproxy-test.*.12.*.$$.pem`; |
| 968 |
|
| 969 |
|
| 970 |
# |
| 971 |
# Test 30 |
| 972 |
# |
| 973 |
($exitstatus, $output) = |
| 974 |
&runtest("myproxy-store -v -R 'nobody' -k 'nobody' -t 1 -d -y \$X509_USER_PROXY -c \$X509_USER_PROXY", |
| 975 |
undef); |
| 976 |
print "MyProxy Test 30 (store credentials with renewal policies): "; |
| 977 |
if ($exitstatus == 0) { |
| 978 |
($exitstatus, $output) = |
| 979 |
&runtest("myproxy-store -v -x -R '$cert_subject' -k 'mine' -t 1 -d -y \$X509_USER_PROXY -c \$X509_USER_PROXY", undef); |
| 980 |
} |
| 981 |
if ($exitstatus == 0) { |
| 982 |
($exitstatus, $output) = |
| 983 |
&runtest("myproxy-store -v -c $iproxyloc -y $iproxyloc -x -R '$cert_subject' -k 'independent' -t 1", undef); |
| 984 |
} |
| 985 |
if ($exitstatus == 0) { |
| 986 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 987 |
} else { |
| 988 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 989 |
} |
| 990 |
|
| 991 |
# |
| 992 |
# Test 30.a |
| 993 |
# |
| 994 |
if ($startserver && defined($serverpid)) { # only case we have direct access to server |
| 995 |
# ($exitstatus, $output) = kill('HUP', $serverpid); |
| 996 |
($exitstatus, $output) = &runtest("/bin/kill -HUP $serverpid"); |
| 997 |
print "MyProxy Test 30.a (kill -HUP $serverpid): "; |
| 998 |
if ($exitstatus != 0) { |
| 999 |
print "FAILED with $exitstatus\n"; $FAILURES++; |
| 1000 |
print STDERR $output; |
| 1001 |
} else { |
| 1002 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1003 |
} |
| 1004 |
} else { |
| 1005 |
print "MyProxy Test 30.a (kill -HUP <myproxy-server>): SKIPPED\n"; |
| 1006 |
} |
| 1007 |
|
| 1008 |
# |
| 1009 |
# Test 31 |
| 1010 |
# |
| 1011 |
($exitstatus, $output) = &runtest("myproxy-info -v -d", undef); |
| 1012 |
print "MyProxy Test 31 (get info for stored renewal credentials): "; |
| 1013 |
if ($exitstatus == 0 && $output =~ /username/) { |
| 1014 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1015 |
} else { |
| 1016 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1017 |
} |
| 1018 |
|
| 1019 |
# |
| 1020 |
# Test 32 |
| 1021 |
# |
| 1022 |
($exitstatus, $output) = |
| 1023 |
&runtest("myproxy-logon -k 'mine' -a $ENV{'X509_USER_PROXY'} -t 1 -o $tmpdir/myproxy-test.$$ -v -d -S", |
| 1024 |
$passphrase . "\n"); |
| 1025 |
print "MyProxy Test 32 (verify renewal policies): "; |
| 1026 |
if ($exitstatus == 0) { |
| 1027 |
($exitstatus, $output) = |
| 1028 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1029 |
} elsif ($output =~ /self-authz not allowed/) { |
| 1030 |
$exitstatus = 0; # default policy will give this response |
| 1031 |
} |
| 1032 |
if ($exitstatus == 0) { |
| 1033 |
($exitstatus, $output) = |
| 1034 |
&runtest("myproxy-logon -k 'independent' -a $iproxyloc -t 1 -o $tmpdir/myproxy-test.$$ -v", |
| 1035 |
undef); |
| 1036 |
} |
| 1037 |
if ($exitstatus == 0) { |
| 1038 |
($exitstatus, $output) = |
| 1039 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1040 |
} |
| 1041 |
if ($exitstatus == 0) { |
| 1042 |
($exitstatus, $output) = |
| 1043 |
&runtest("myproxy-logon -k 'nobody' -a $ENV{'X509_USER_PROXY'} -t 1 -o $tmpdir/myproxy-test.$$ -v -d -S", |
| 1044 |
$passphrase . "\n"); |
| 1045 |
if ($exitstatus != 0) { |
| 1046 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1047 |
} else { |
| 1048 |
print "FAILED\n"; $FAILURES++; |
| 1049 |
print STDERR "Shouldn't have allowed retrieval.\n"; |
| 1050 |
print STDERR $output; |
| 1051 |
} |
| 1052 |
} else { |
| 1053 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1054 |
} |
| 1055 |
|
| 1056 |
&runtest("myproxy-destroy -v -k 'mine' -d", undef); |
| 1057 |
&runtest("myproxy-destroy -v -k 'nobody' -d", undef); |
| 1058 |
&runtest("env X509_USER_PROXY=$iproxyloc myproxy-destroy -v -k 'independent'", undef); |
| 1059 |
|
| 1060 |
# |
| 1061 |
# Test 33 |
| 1062 |
# |
| 1063 |
($exitstatus, $output) = |
| 1064 |
&runtest("myproxy-store -x -E '$cert_subject' -v -a -t 2 -y $testkey", undef); |
| 1065 |
print "MyProxy Test 33 (verify lifetime of retrieved credentials): "; |
| 1066 |
if ($exitstatus == 0) { |
| 1067 |
($exitstatus, $output) = |
| 1068 |
&runtest("myproxy-logon -o $tmpdir/myproxy-test.$$ -v -S", |
| 1069 |
$passphrase . "\n"); |
| 1070 |
$timeleft = `$grid_proxy_info -file $tmpdir/myproxy-test.$$ -timeleft`; |
| 1071 |
if (defined($timeleft) && |
| 1072 |
$timeleft > 60*60*2+300 || $timeleft < 60*60*2-300) { |
| 1073 |
$output = "Credential lifetime ($timeleft) incorrect." . |
| 1074 |
"It should be " . (60*60*2) . ".\n"; |
| 1075 |
$exitstatus = 1; |
| 1076 |
} |
| 1077 |
} |
| 1078 |
if ($exitstatus == 0) { |
| 1079 |
($exitstatus, $output) = |
| 1080 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1081 |
} |
| 1082 |
if ($exitstatus == 0) { |
| 1083 |
($exitstatus, $output) = |
| 1084 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 1085 |
$passphrase . "\n"); |
| 1086 |
$timeleft = `$grid_proxy_info -file $tmpdir/myproxy-test.$$ -timeleft`; |
| 1087 |
if ($timeleft > 60*61 || $timeleft < 60*59) { |
| 1088 |
$output = "Credential lifetime ($timeleft) incorrect." . |
| 1089 |
"It should be " . (60*60) . ".\n"; |
| 1090 |
$exitstatus = 1; |
| 1091 |
} |
| 1092 |
} |
| 1093 |
if ($exitstatus == 0) { |
| 1094 |
($exitstatus, $output) = |
| 1095 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1096 |
} |
| 1097 |
if ($exitstatus == 0) { |
| 1098 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1099 |
} else { |
| 1100 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1101 |
} |
| 1102 |
&runtest("myproxy-destroy -v", undef); |
| 1103 |
|
| 1104 |
# |
| 1105 |
# Test 34 |
| 1106 |
# |
| 1107 |
($exitstatus, $output) = |
| 1108 |
&runtest("myproxy-store -v -E 'nobody' -k 'nobody' -t 1 -y $testkey", |
| 1109 |
undef); |
| 1110 |
print "MyProxy Test 34 (store credentials with retrieve key policies): "; |
| 1111 |
if ($exitstatus == 0) { |
| 1112 |
($exitstatus, $output) = |
| 1113 |
&runtest("myproxy-store -v -x -E '$cert_subject' -k 'mine' -t 1 -y $testkey", undef); |
| 1114 |
} |
| 1115 |
if ($exitstatus == 0) { |
| 1116 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1117 |
} else { |
| 1118 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1119 |
} |
| 1120 |
|
| 1121 |
# |
| 1122 |
# Test 35 |
| 1123 |
# |
| 1124 |
($exitstatus, $output) = &runtest("myproxy-info -v", undef); |
| 1125 |
print "MyProxy Test 35 (get info for stored retrieve key credentials): "; |
| 1126 |
if ($exitstatus == 0 && $output =~ /username/) { |
| 1127 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1128 |
} else { |
| 1129 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1130 |
} |
| 1131 |
|
| 1132 |
# |
| 1133 |
# Test 36 |
| 1134 |
# |
| 1135 |
($exitstatus, $output) = |
| 1136 |
&runtest("myproxy-retrieve -k 'mine' -c $tmpdir/myproxy-test.cert.12.1.$$.pem -y $tmpdir/myproxy-test.key.12.1.$$.pem -v -S", |
| 1137 |
$passphrase . "\n"); |
| 1138 |
print "MyProxy Test 36 (verify myproxy-retrieve key retrieval policies): "; |
| 1139 |
if ($exitstatus == 0) { |
| 1140 |
($exitstatus, $output) = |
| 1141 |
&verifycert("$tmpdir/myproxy-test.cert.12.1.$$.pem", "$tmpdir/myproxy-test.key.12.1.$$.pem"); |
| 1142 |
} |
| 1143 |
if ($exitstatus == 0) { |
| 1144 |
($exitstatus, $output) = |
| 1145 |
&runtest("myproxy-retrieve -k 'nobody' -c $tmpdir/myproxy-test.cert.12.2.$$.pem -y $tmpdir/myproxy-test.key.12.2.$$.pem -v -S", |
| 1146 |
$passphrase . "\n"); |
| 1147 |
if ($exitstatus != 0) { |
| 1148 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1149 |
} else { |
| 1150 |
print "FAILED\n"; $FAILURES++; |
| 1151 |
print STDERR "Shouldn't have allowed retrieval.\n"; |
| 1152 |
print STDERR $output; |
| 1153 |
} |
| 1154 |
} else { |
| 1155 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1156 |
} |
| 1157 |
end_of_store_tests: |
| 1158 |
&runtest("myproxy-destroy -v -k 'mine'", undef); |
| 1159 |
&runtest("myproxy-destroy -v -k 'nobody'", undef); |
| 1160 |
`rm -f $tmpdir/myproxy-test.*.12.*.$$.pem`; |
| 1161 |
unlink("$tmpdir/myproxy-test.$$.key.pem"); |
| 1162 |
|
| 1163 |
# |
| 1164 |
# Test 37 |
| 1165 |
# |
| 1166 |
($exitstatus, $output) = |
| 1167 |
&runtest("myproxy-init -v -Z 'nobody' -k 'nobody' -c 1 -t 1 -d -S -n", |
| 1168 |
$passphrase . "\n"); |
| 1169 |
print "MyProxy Test 37 (store credentials w/ retrievable_by_cert policies): "; |
| 1170 |
if ($exitstatus == 0) { |
| 1171 |
($exitstatus, $output) = |
| 1172 |
&runtest("myproxy-store -v -x -Z '$cert_subject' -k 'mine' -c $iproxyloc -y $iproxyloc -t 1", undef); |
| 1173 |
} |
| 1174 |
if ($exitstatus == 0) { |
| 1175 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1176 |
} else { |
| 1177 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1178 |
} |
| 1179 |
|
| 1180 |
# |
| 1181 |
# Test 38 |
| 1182 |
# |
| 1183 |
($exitstatus, $output) = |
| 1184 |
&runtest("myproxy-logon -k 'mine' -t 1 -o $tmpdir/myproxy-test.$$ -v -n", |
| 1185 |
undef); |
| 1186 |
print "MyProxy Test 38 (verify retrievable_by_cert policies): "; |
| 1187 |
if ($exitstatus == 0) { |
| 1188 |
($exitstatus, $output) = |
| 1189 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1190 |
} |
| 1191 |
if ($exitstatus == 0) { |
| 1192 |
($exitstatus, $output) = |
| 1193 |
&runtest("myproxy-logon -k 'nobody' -t 1 -o $tmpdir/myproxy-test.$$ -v -d -n", |
| 1194 |
undef); |
| 1195 |
if ($exitstatus != 0) { |
| 1196 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1197 |
} else { |
| 1198 |
print "FAILED\n"; $FAILURES++; |
| 1199 |
print STDERR "Shouldn't have allowed retrieval.\n"; |
| 1200 |
print STDERR $output; |
| 1201 |
} |
| 1202 |
} else { |
| 1203 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1204 |
} |
| 1205 |
&runtest("env X509_USER_PROXY=$iproxyloc myproxy-destroy -v -k 'mine'", undef); |
| 1206 |
&runtest("myproxy-destroy -v -k 'nobody' -d", undef); |
| 1207 |
|
| 1208 |
# |
| 1209 |
# Test 39 |
| 1210 |
# |
| 1211 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S", $passphrase . "\n"); |
| 1212 |
&runtest("myproxy-init -v -x -R '$cert_subject' -k renew -c 1 -t 1", |
| 1213 |
undef); |
| 1214 |
&runcmd("grid-proxy-init $PROXYBITS -limited -o \$X509_USER_PROXY.limited", undef); |
| 1215 |
rename("\$X509_USER_PROXY", "\$X509_USER_PROXY.orig"); |
| 1216 |
rename("\$X509_USER_PROXY.limited", "\$X509_USER_PROXY"); |
| 1217 |
($exitstatus, $output) = |
| 1218 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 1219 |
$passphrase . "\n"); |
| 1220 |
print "MyProxy Test 39 (verify limited proxy retrieves a limited proxy): "; |
| 1221 |
if ($exitstatus == 0) { |
| 1222 |
($exitstatus, $output) = |
| 1223 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1224 |
} |
| 1225 |
if ($exitstatus != 0) { |
| 1226 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1227 |
goto cleanup_limited; |
| 1228 |
} |
| 1229 |
if (!`$grid_proxy_info -file $tmpdir/myproxy-test.$$ -type` =~ /limited/) { |
| 1230 |
print "FAILED\nRetrieved proxy is not limited.\n"; $FAILURES++; |
| 1231 |
} |
| 1232 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1233 |
|
| 1234 |
|
| 1235 |
# |
| 1236 |
# Test 40 |
| 1237 |
# |
| 1238 |
($exitstatus, $output) = |
| 1239 |
&runtest("myproxy-logon -a \$X509_USER_PROXY -k renew -t 1 -o $tmpdir/myproxy-test.$$ -v", undef); |
| 1240 |
print "MyProxy Test 40 (verify renewed limited proxy is still limited): "; |
| 1241 |
if ($exitstatus == 0) { |
| 1242 |
($exitstatus, $output) = |
| 1243 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1244 |
} elsif ($output =~ /self-authz not allowed/) { |
| 1245 |
$exitstatus = 0; # default policy will give this response |
| 1246 |
} |
| 1247 |
if ($exitstatus != 0) { |
| 1248 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1249 |
goto cleanup_limited; |
| 1250 |
} |
| 1251 |
if (!`$grid_proxy_info -file $tmpdir/myproxy-test.$$ -type` =~ /limited/) { |
| 1252 |
print "FAILED\nRetrieved proxy is not limited.\n"; $FAILURES++; |
| 1253 |
} |
| 1254 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1255 |
|
| 1256 |
cleanup_limited: |
| 1257 |
&runtest("myproxy-destroy -v", undef); |
| 1258 |
&runtest("myproxy-destroy -v -k renew", undef); |
| 1259 |
rename("\$X509_USER_PROXY.orig", "\$X509_USER_PROXY"); |
| 1260 |
|
| 1261 |
# |
| 1262 |
# Test 40.a |
| 1263 |
# |
| 1264 |
if ($startserver && defined($serverpid)) { # only case we have direct access to server |
| 1265 |
# ($exitstatus, $output) = kill('HUP', $serverpid); |
| 1266 |
($exitstatus, $output) = &runtest("/bin/kill -HUP $serverpid"); |
| 1267 |
print "MyProxy Test 40.a (kill -HUP $serverpid): "; |
| 1268 |
if ($exitstatus != 0) { |
| 1269 |
print "FAILED with $exitstatus\n"; $FAILURES++; |
| 1270 |
print STDERR $output; |
| 1271 |
} else { |
| 1272 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1273 |
} |
| 1274 |
} else { |
| 1275 |
print "MyProxy Test 40.a (kill -HUP <myproxy-server>): SKIPPED\n"; |
| 1276 |
} |
| 1277 |
|
| 1278 |
|
| 1279 |
# |
| 1280 |
# Test 41 |
| 1281 |
# |
| 1282 |
$ENV{'X509_CERT_DIR'} = $trustrootdir; |
| 1283 |
($exitstatus, $output) = |
| 1284 |
&runtest("myproxy-get-trustroots -v", undef); |
| 1285 |
print "MyProxy Test 41 (retrieve trustroots w/o authentication): "; |
| 1286 |
if ($exitstatus == 0) { |
| 1287 |
($exitstatus, $output) = |
| 1288 |
&verifytrustroots(); |
| 1289 |
} |
| 1290 |
if ($exitstatus == 0) { |
| 1291 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1292 |
} else { |
| 1293 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1294 |
} |
| 1295 |
if (defined($origtrustrootdir)) { |
| 1296 |
$ENV{'X509_CERT_DIR'} = $origtrustrootdir; |
| 1297 |
} else { |
| 1298 |
delete $ENV{'X509_CERT_DIR'}; |
| 1299 |
} |
| 1300 |
|
| 1301 |
# |
| 1302 |
# Test 42 |
| 1303 |
# |
| 1304 |
if ($startserver) { # only way to know check_multiple_credentials is true |
| 1305 |
$passphrase = sprintf "%010d", int(rand(0x7fffffff)); |
| 1306 |
($exitstatus, $output) = |
| 1307 |
&runtest("myproxy-init -v -a -k multiple -c 1 -t 1 -S", |
| 1308 |
$passphrase . "\n"); |
| 1309 |
print "MyProxy Test 42 (check_multiple_credentials): "; |
| 1310 |
if ($exitstatus == 0) { |
| 1311 |
($exitstatus, $output) = |
| 1312 |
&runtest("myproxy-logon -k multiple -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 1313 |
$passphrase . "\n"); |
| 1314 |
} |
| 1315 |
if ($exitstatus == 0) { |
| 1316 |
$passphrase = sprintf "%010d", int(rand(0x7fffffff)); |
| 1317 |
($exitstatus, $output) = |
| 1318 |
&runtest("myproxy-logon -k multiple -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 1319 |
$passphrase . "\n"); |
| 1320 |
if ($exitstatus == 0) { |
| 1321 |
print "FAILED\n"; $FAILURES++; |
| 1322 |
print STDERR "Shouldn't have allowed retrieval with bad passphrase.\n"; |
| 1323 |
print STDERR $output; |
| 1324 |
} else { |
| 1325 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1326 |
} |
| 1327 |
} else { |
| 1328 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1329 |
} |
| 1330 |
&runtest("myproxy-destroy -v -k multiple", undef); |
| 1331 |
} else { |
| 1332 |
print "MyProxy Test 42 (check_multiple_credentials): SKIPPED\n"; |
| 1333 |
} |
| 1334 |
|
| 1335 |
# |
| 1336 |
# Test 43 |
| 1337 |
# |
| 1338 |
if ($startserver) { # only case we have direct access to repository |
| 1339 |
($exitstatus, $output) = |
| 1340 |
&runtest("myproxy-init -v -a -l test-user1 -c 2 -t 2 -S", |
| 1341 |
$passphrase . "\n"); |
| 1342 |
print "MyProxy Test 43 (myproxy-admin-query): "; |
| 1343 |
if ($exitstatus == 0) { |
| 1344 |
($exitstatus, $output) = |
| 1345 |
&runtest("myproxy-init -v -a -l test-user2 -k test-credname -c 4 -t 4 -S", |
| 1346 |
$passphrase . "\n"); |
| 1347 |
} |
| 1348 |
if ($exitstatus == 0) { |
| 1349 |
($exitstatus, $output) = |
| 1350 |
&runtest("myproxy-admin-query -s $serverdir -c $serverconf"); |
| 1351 |
@usernames = split(/username/, $output); |
| 1352 |
if ($#usernames != 2) { |
| 1353 |
$exitstatus = 1; |
| 1354 |
print "FAILED\n"; $FAILURES++; |
| 1355 |
print STDERR "CASE 1: Should have returned two credentials. Found ", |
| 1356 |
$#usernames, ".\n"; |
| 1357 |
print STDERR $output; |
| 1358 |
} |
| 1359 |
} |
| 1360 |
if ($exitstatus == 0) { |
| 1361 |
($exitstatus, $output) = |
| 1362 |
&runtest("myproxy-admin-query -l test-user1 -s $serverdir -c $serverconf"); |
| 1363 |
@usernames = split(/username/, $output); |
| 1364 |
if ($#usernames != 1) { |
| 1365 |
$exitstatus = 1; |
| 1366 |
print "FAILED\n"; $FAILURES++; |
| 1367 |
print STDERR "CASE 2: Should have returned one credential. Found ", |
| 1368 |
$#usernames, ".\n"; |
| 1369 |
print STDERR $output; |
| 1370 |
} |
| 1371 |
} |
| 1372 |
if ($exitstatus == 0) { |
| 1373 |
($exitstatus, $output) = |
| 1374 |
&runtest("myproxy-admin-query -e 5 -s $serverdir -c $serverconf"); |
| 1375 |
@usernames = split(/username/, $output); |
| 1376 |
if ($#usernames != 2) { |
| 1377 |
$exitstatus = 1; |
| 1378 |
print "FAILED\n"; $FAILURES++; |
| 1379 |
print STDERR "CASE 3: Should have returned two credentials. Found ", |
| 1380 |
$#usernames, ".\n"; |
| 1381 |
print STDERR $output; |
| 1382 |
} |
| 1383 |
} |
| 1384 |
if ($exitstatus == 0) { |
| 1385 |
($exitstatus, $output) = |
| 1386 |
&runtest("myproxy-admin-query -t 5 -s $serverdir -c $serverconf"); |
| 1387 |
@usernames = split(/username/, $output); |
| 1388 |
if ($#usernames != 0) { |
| 1389 |
$exitstatus = 1; |
| 1390 |
print "FAILED\n"; $FAILURES++; |
| 1391 |
print STDERR "CASE 4: Should have returned no credentials. Found ", |
| 1392 |
$#usernames, ".\n"; |
| 1393 |
print STDERR $output; |
| 1394 |
} |
| 1395 |
} |
| 1396 |
if ($exitstatus == 0) { |
| 1397 |
($exitstatus, $output) = |
| 1398 |
&runtest("myproxy-admin-query -e 3 -s $serverdir -c $serverconf"); |
| 1399 |
@usernames = split(/username/, $output); |
| 1400 |
if ($#usernames != 1) { |
| 1401 |
$exitstatus = 1; |
| 1402 |
print "FAILED\n"; $FAILURES++; |
| 1403 |
print STDERR "CASE 5: Should have returned one credential. Found ", |
| 1404 |
$#usernames, ".\n"; |
| 1405 |
print STDERR $output; |
| 1406 |
} |
| 1407 |
} |
| 1408 |
if ($exitstatus == 0) { |
| 1409 |
($exitstatus, $output) = |
| 1410 |
&runtest("myproxy-admin-query -t 3 -s $serverdir -c $serverconf"); |
| 1411 |
@usernames = split(/username/, $output); |
| 1412 |
if ($#usernames != 1) { |
| 1413 |
$exitstatus = 1; |
| 1414 |
print "FAILED\n"; $FAILURES++; |
| 1415 |
print STDERR "CASE 6: Should have returned one credential. Found ", |
| 1416 |
$#usernames, ".\n"; |
| 1417 |
print STDERR $output; |
| 1418 |
} |
| 1419 |
} |
| 1420 |
if ($exitstatus == 0) { |
| 1421 |
($exitstatus, $output) = |
| 1422 |
&runtest("myproxy-admin-query -e 1 -s $serverdir -c $serverconf"); |
| 1423 |
@usernames = split(/username/, $output); |
| 1424 |
if ($#usernames != 0) { |
| 1425 |
$exitstatus = 1; |
| 1426 |
print "FAILED\n"; $FAILURES++; |
| 1427 |
print STDERR "CASE 7: Should have returned no credentials. Found ", |
| 1428 |
$#usernames, ".\n"; |
| 1429 |
print STDERR $output; |
| 1430 |
} |
| 1431 |
} |
| 1432 |
if ($exitstatus == 0) { |
| 1433 |
($exitstatus, $output) = |
| 1434 |
&runtest("myproxy-admin-query -t 1 -s $serverdir -c $serverconf"); |
| 1435 |
@usernames = split(/username/, $output); |
| 1436 |
if ($#usernames != 2) { |
| 1437 |
$exitstatus = 1; |
| 1438 |
print "FAILED\n"; $FAILURES++; |
| 1439 |
print STDERR "CASE 8: Should have returned two credentials. Found ", |
| 1440 |
$#usernames, ".\n"; |
| 1441 |
print STDERR $output; |
| 1442 |
} |
| 1443 |
} |
| 1444 |
if ($exitstatus == 0) { |
| 1445 |
($exitstatus, $output) = |
| 1446 |
&runtest("myproxy-admin-query -i -s $serverdir -c $serverconf"); |
| 1447 |
@usernames = split(/username/, $output); |
| 1448 |
if ($#usernames != 0) { |
| 1449 |
$exitstatus = 1; |
| 1450 |
print "FAILED\n"; $FAILURES++; |
| 1451 |
print STDERR "CASE 9: Should have returned no credentials. Found ", |
| 1452 |
$#usernames, ".\n"; |
| 1453 |
print STDERR $output; |
| 1454 |
} |
| 1455 |
} |
| 1456 |
if ($exitstatus == 0) { |
| 1457 |
($exitstatus, $output) = |
| 1458 |
&runtest("myproxy-admin-query -r -s $serverdir -c $serverconf"); |
| 1459 |
} |
| 1460 |
if ($exitstatus == 0) { |
| 1461 |
($exitstatus, $output) = |
| 1462 |
&runtest("myproxy-admin-query -s $serverdir -c $serverconf"); |
| 1463 |
@usernames = split(/username/, $output); |
| 1464 |
if ($#usernames != 0) { |
| 1465 |
$exitstatus = 1; |
| 1466 |
print "FAILED\n"; $FAILURES++; |
| 1467 |
print STDERR "CASE 10: Should have returned no credentials. Found ", |
| 1468 |
$#usernames, ".\n"; |
| 1469 |
print STDERR $output; |
| 1470 |
} |
| 1471 |
} |
| 1472 |
if ($exitstatus == 0) { |
| 1473 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1474 |
} |
| 1475 |
} else { |
| 1476 |
print "MyProxy Test 43 (myproxy-admin-query): SKIPPED\n"; |
| 1477 |
} |
| 1478 |
|
| 1479 |
myproxy_header_test: |
| 1480 |
# |
| 1481 |
# Test 44 |
| 1482 |
# |
| 1483 |
chomp($gcc = `which gcc 2>/dev/null`); |
| 1484 |
if (-x $gcc && |
| 1485 |
defined($ENV{'GLOBUS_LOCATION'}) && |
| 1486 |
-d "$ENV{'GLOBUS_LOCATION'}/include") { |
| 1487 |
&write_myproxy_header_test; |
| 1488 |
$basedir = "$ENV{'GLOBUS_LOCATION'}/include"; |
| 1489 |
$includedirs = "-I$basedir"; |
| 1490 |
opendir(DIRHANDLE, "$basedir") |
| 1491 |
|| die "can't opendir $basedir: $!"; |
| 1492 |
while (defined($filename = readdir(DIRHANDLE))) { |
| 1493 |
next if $filename =~ /^\.\.?$/; # skip . and .. |
| 1494 |
if (-d "$basedir/$filename") { |
| 1495 |
$includedirs .= " -I$basedir/$filename"; |
| 1496 |
} |
| 1497 |
} |
| 1498 |
closedir(DIRHANDLE); |
| 1499 |
# should really just make this a recursive search... |
| 1500 |
$basedir = "$ENV{'GLOBUS_LOCATION'}/include/globus"; |
| 1501 |
if (opendir(DIRHANDLE, "$basedir")) { |
| 1502 |
while (defined($filename = readdir(DIRHANDLE))) { |
| 1503 |
next if $filename =~ /^\.\.?$/; # skip . and .. |
| 1504 |
if (-d "$basedir/$filename") { |
| 1505 |
$includedirs .= " -I$basedir/$filename"; |
| 1506 |
} |
| 1507 |
} |
| 1508 |
closedir(DIRHANDLE); |
| 1509 |
} |
| 1510 |
($exitstatus, $output) = |
| 1511 |
&runcmd("$gcc $includedirs -o $tmpdir/myproxy-header $tmpdir/myproxy.c"); |
| 1512 |
print "MyProxy Test 44 (myproxy.h): "; |
| 1513 |
if ($exitstatus == 0) { |
| 1514 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1515 |
} else { |
| 1516 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1517 |
} |
| 1518 |
} else { |
| 1519 |
print "MyProxy Test 44 (myproxy.h): SKIPPED\n"; |
| 1520 |
} |
| 1521 |
|
| 1522 |
# |
| 1523 |
# Test 45 |
| 1524 |
# |
| 1525 |
$SAVED_LOGNAME = $ENV{'LOGNAME'}; |
| 1526 |
$ENV{'LOGNAME'} = $ENV{'LOGNAME'} . "ruld9ocitegdatNigWaiwacWowd5blerUdCaxVanurs4OtNimEsDeicEgOakEkavTykEvenIpRipCarattAidcack3grirtigrimhuatwykCoth5QuicAtJawmAdutbi0QuekKabCugNelgAneuvCavNokdejnilevityixafyudGujBekIgDoadjel9shraruld9ocitegdatNigWaiwacWowd5blerUdCaxVanurs4OtNimEsDeicEgOakEkavTykEvenIpRipCarattAidcack3grirtigrimhuatwykCoth5QuicAtJawmAdutbi0QuekKabCugNelgAneuvCavNokdejnilevityixafyudGujBekIgDoadjel9shraruld9ocitegdatNigWaiwacWowd5blerUdCaxVanurs4OtNimEsDeicEgOakEkavTykEvenIpRipCarattAidcack3grirtigrimhuatwykCoth5QuicAtJawmAdutbi0QuekKabCugNelgAneuvCavNokdejnilevityixafyudGujBekIgDoadjel9shraruld9ocitegdatNigWaiwacWowd5blerUdCaxVanurs4OtNimEsDeicEgOakEkavTykEvenIpRipCarattAidcack3grirtigrimhuatwykCoth5QuicAtJawmAdutbi0QuekKabCugNelgAneuvCavNokdejnilevityixafyudGujBekIgDoadjel9shraruld9ocitegdatNigWaiwacWowd5blerUdCaxVanurs4OtNimEsDeicEgOakEkavTykEvenIpRipCarattAidcack3grirtigrimhuatwykCoth5QuicAtJawmAdutbi0QuekKabCugNelgAneuvCavNokdejnilevityixafyudGujBekIgDoadjel9shraruld9ocitegdatNigWaiwacWowd5blerUdCaxVanurs4OtNimEsDeicEgOakEkavTykEvenIpRipCarattAidcack3grirtigrimhuatwykCoth5QuicAtJawmAdutbi0QuekKabCugNelgAneuvCavNokdejnilevityixafyudGujBekIgDoadjel9shra"; |
| 1527 |
($exitstatus, $output) = |
| 1528 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S", $passphrase . "\n"); |
| 1529 |
if ($exitstatus == 0) { |
| 1530 |
($exitstatus, $output) = |
| 1531 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 1532 |
$passphrase . "\n"); |
| 1533 |
} |
| 1534 |
print "MyProxy Test 45 (verify long username handling): "; |
| 1535 |
if ($exitstatus == 0) { |
| 1536 |
($exitstatus, $output) = |
| 1537 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1538 |
} |
| 1539 |
if ($exitstatus == 0) { |
| 1540 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1541 |
} else { |
| 1542 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1543 |
} |
| 1544 |
$ENV{'LOGNAME'} = $SAVED_LOGNAME; |
| 1545 |
|
| 1546 |
|
| 1547 |
|
| 1548 |
# |
| 1549 |
# COG tests |
| 1550 |
# |
| 1551 |
if (defined($ENV{"COG_INSTALL_PATH"})) { |
| 1552 |
&docogtests(); |
| 1553 |
} else { |
| 1554 |
print "\$COG_INSTALL_PATH undefined. Skipping Java CoG tests.\n"; |
| 1555 |
} |
| 1556 |
|
| 1557 |
# |
| 1558 |
# END TESTS |
| 1559 |
# |
| 1560 |
end_of_all_tests: |
| 1561 |
&docleanup(); |
| 1562 |
|
| 1563 |
print "MyProxy Tests Complete: ", $SUCCESSES, " tests passed, "; |
| 1564 |
print $FAILURES, " tests failed\n"; |
| 1565 |
|
| 1566 |
if (defined($valgrind)) { |
| 1567 |
`cat $tmpdir/valgrind.log.* > valgrind.log.$$`; |
| 1568 |
if (-s "valgrind.log.$$") { |
| 1569 |
print "Valgrind errors in valgrind.log.$$.\n"; |
| 1570 |
# $FAILURES++; |
| 1571 |
} else { |
| 1572 |
print "Valgrind found no errors.\n"; |
| 1573 |
unlink("valgrind.log.$$"); |
| 1574 |
} |
| 1575 |
} |
| 1576 |
|
| 1577 |
exit $FAILURES; |
| 1578 |
|
| 1579 |
# |
| 1580 |
# SUBROUTINES |
| 1581 |
# |
| 1582 |
|
| 1583 |
sub runtest { |
| 1584 |
local($command, $input) = @_; |
| 1585 |
|
| 1586 |
if (defined($valgrind)) { |
| 1587 |
$valgrindlog = File::Temp::tempnam($tmpdir, "valgrind.log."); |
| 1588 |
$valgrindlogopt = " --log-file=$valgrindlog "; |
| 1589 |
$command = $valgrind . $valgrindlogopt . $command; |
| 1590 |
} |
| 1591 |
return &runcmd($command, $input); |
| 1592 |
} |
| 1593 |
|
| 1594 |
sub runcmd { |
| 1595 |
local($command, $input) = @_; |
| 1596 |
|
| 1597 |
print STDERR "running: ", $command, "\n" if ($verbose); |
| 1598 |
$pid = open3(*Writer, *Reader, '', "exec $command") || |
| 1599 |
die "failed to run $command"; |
| 1600 |
print Writer $input if (defined($input)); |
| 1601 |
close(Writer); |
| 1602 |
@output = <Reader>; |
| 1603 |
close(Reader); |
| 1604 |
waitpid($pid, 0); |
| 1605 |
$exitstatus = $?; |
| 1606 |
$output = join('', @output); |
| 1607 |
print STDERR $output if ($verbose); |
| 1608 |
|
| 1609 |
return ($exitstatus, $output); |
| 1610 |
} |
| 1611 |
|
| 1612 |
sub docogtests { |
| 1613 |
|
| 1614 |
$cogmyproxy = "$ENV{COG_INSTALL_PATH}/bin/myproxy -h $ENV{MYPROXY_SERVER}"; |
| 1615 |
|
| 1616 |
if (defined($ENV{"MYPROXY_SERVER_DN"})) { |
| 1617 |
$cogmyproxy .= " -s \"$ENV{MYPROXY_SERVER_DN}\""; |
| 1618 |
} |
| 1619 |
|
| 1620 |
if (defined($ENV{"MYPROXY_SERVER_PORT"})) { |
| 1621 |
$cogmyproxy .= " -p $ENV{MYPROXY_SERVER_PORT}"; |
| 1622 |
} |
| 1623 |
|
| 1624 |
$cogmyproxy .= " -l $ENV{'LOGNAME'}"; |
| 1625 |
|
| 1626 |
$ENV{"COG_OPTS"} = " -DX509_USER_PROXY=$ENV{X509_USER_PROXY}" |
| 1627 |
. " -DX509_USER_CERT=$ENV{X509_USER_CERT}" |
| 1628 |
. " -DX509_USER_KEY=$ENV{X509_USER_KEY}"; |
| 1629 |
|
| 1630 |
($exitstatus, $output) = |
| 1631 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S", |
| 1632 |
$passphrase . "\n"); |
| 1633 |
if ($exitstatus == 0) { |
| 1634 |
($exitstatus, $output) = |
| 1635 |
&runcmd("$cogmyproxy anonget -o $tmpdir/myproxy-test.$$", |
| 1636 |
$passphrase . "\n"); |
| 1637 |
} |
| 1638 |
if ($exitstatus == 0) { |
| 1639 |
($exitstatus, $output) = |
| 1640 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1641 |
} |
| 1642 |
print "MyProxy CoG Test 1 (anonget of myproxy-init credential): "; |
| 1643 |
if ($exitstatus == 0) { |
| 1644 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1645 |
} else { |
| 1646 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1647 |
} |
| 1648 |
|
| 1649 |
if ($exitstatus == 0) { |
| 1650 |
($exitstatus, $output) = |
| 1651 |
&runcmd("$cogmyproxy get -o $tmpdir/myproxy-test.$$", |
| 1652 |
$passphrase . "\n"); |
| 1653 |
} |
| 1654 |
if ($exitstatus == 0) { |
| 1655 |
($exitstatus, $output) = |
| 1656 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1657 |
} |
| 1658 |
print "MyProxy CoG Test 2 (get of myproxy-init credential): "; |
| 1659 |
if ($exitstatus == 0) { |
| 1660 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1661 |
} else { |
| 1662 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1663 |
} |
| 1664 |
|
| 1665 |
# This test requires a recent Java CoG release |
| 1666 |
# with certificate chain support: |
| 1667 |
# (http://bugzilla.globus.org/globus/show_bug.cgi?id=1914) |
| 1668 |
# |
| 1669 |
($exitstatus, $output) = |
| 1670 |
&runcmd("$cogmyproxy put -a -c 1 -t 1", |
| 1671 |
$passphrase . "\n"); |
| 1672 |
print "MyProxy CoG Test 3 (store credential with default name): "; |
| 1673 |
if ($exitstatus == 0) { |
| 1674 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1675 |
} else { |
| 1676 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1677 |
} |
| 1678 |
|
| 1679 |
if ($exitstatus == 0) { |
| 1680 |
($exitstatus, $output) = |
| 1681 |
&runcmd("$cogmyproxy anonget -o $tmpdir/myproxy-test.$$", |
| 1682 |
$passphrase . "\n"); |
| 1683 |
} |
| 1684 |
if ($exitstatus == 0) { |
| 1685 |
($exitstatus, $output) = |
| 1686 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1687 |
} |
| 1688 |
print "MyProxy CoG Test 4 (anonget of CoG stored credential): "; |
| 1689 |
if ($exitstatus == 0) { |
| 1690 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1691 |
} else { |
| 1692 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1693 |
} |
| 1694 |
|
| 1695 |
if ($exitstatus == 0) { |
| 1696 |
($exitstatus, $output) = |
| 1697 |
&runcmd("$cogmyproxy get -o $tmpdir/myproxy-test.$$", |
| 1698 |
$passphrase . "\n"); |
| 1699 |
} |
| 1700 |
if ($exitstatus == 0) { |
| 1701 |
($exitstatus, $output) = |
| 1702 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1703 |
} |
| 1704 |
print "MyProxy CoG Test 5 (get of CoG stored credential): "; |
| 1705 |
if ($exitstatus == 0) { |
| 1706 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1707 |
} else { |
| 1708 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1709 |
} |
| 1710 |
|
| 1711 |
($exitstatus, $output) = &runcmd("$cogmyproxy info", undef); |
| 1712 |
print "MyProxy CoG Test 6 (get info for stored credentials): "; |
| 1713 |
if ($exitstatus == 0 && $output =~ /Owner/) { |
| 1714 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1715 |
} else { |
| 1716 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1717 |
} |
| 1718 |
|
| 1719 |
|
| 1720 |
($exitstatus, $output) = |
| 1721 |
&runcmd("$cogmyproxy destroy", undef); |
| 1722 |
print "MyProxy CoG Test 7 (remove credential from repository): "; |
| 1723 |
if ($exitstatus == 0 && $output =~ /was succes+fully/) { |
| 1724 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1725 |
} else { |
| 1726 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1727 |
} |
| 1728 |
|
| 1729 |
($exitstatus, $output) = |
| 1730 |
&runcmd("$cogmyproxy put -n -x -R '$cert_subject' -k 'mine' -c 1 -t 1", |
| 1731 |
$passphrase . "\n"); |
| 1732 |
print "MyProxy CoG Test 8 (store credential with renewal policy): "; |
| 1733 |
if ($exitstatus == 0) { |
| 1734 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1735 |
} else { |
| 1736 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1737 |
} |
| 1738 |
|
| 1739 |
($exitstatus, $output) = |
| 1740 |
&runcmd("$cogmyproxy get -k 'mine' -a $ENV{'X509_USER_PROXY'} -t 1 -o $tmpdir/myproxy-test.$$", undef); |
| 1741 |
print "MyProxy CoG Test 9 (renew credential): "; |
| 1742 |
if ($exitstatus == 0) { |
| 1743 |
($exitstatus, $output) = |
| 1744 |
&verifyproxy("$tmpdir/myproxy-test.$$"); |
| 1745 |
} |
| 1746 |
if ($exitstatus == 0) { |
| 1747 |
print "SUCCEEDED\n"; $SUCCESSES++; |
| 1748 |
} else { |
| 1749 |
print "FAILED\n"; $FAILURES++; print STDERR $output; |
| 1750 |
} |
| 1751 |
&runtest("myproxy-destroy -v -k 'mine' -d", undef); |
| 1752 |
} |
| 1753 |
|
| 1754 |
# |
| 1755 |
# verify_proxy |
| 1756 |
# |
| 1757 |
# Check to see if user has a valid proxy, and verify proxy is usable |
| 1758 |
# |
| 1759 |
# Dependencies: (-x grid-proxy-info) |
| 1760 |
# |
| 1761 |
# grid-proxy-info -timeleft |
| 1762 |
# die if no output, or output is less than 60 seconds |
| 1763 |
# $proxy = grid-proxy-info -path |
| 1764 |
# grid-proxy-init -debug -verify -cert $proxy -key $proxy |
| 1765 |
# if $? == 0 then proxy is valid |
| 1766 |
# if $? != 0, die, b/c proxy is invalid and won't work |
| 1767 |
# |
| 1768 |
sub verifyproxy { |
| 1769 |
local($proxyfile) = @_; |
| 1770 |
|
| 1771 |
chomp (my $timeleft = `$grid_proxy_info -file $proxyfile -timeleft`); |
| 1772 |
if (!defined($timeleft) || $timeleft eq "") { |
| 1773 |
$output = "failed to verify proxy\n"; |
| 1774 |
$output .= "'grid-proxy-info -timeleft' failed\n"; |
| 1775 |
return (1, $output); |
| 1776 |
} |
| 1777 |
if ($timeleft < 1) { |
| 1778 |
$output = "proxy is expired\n"; |
| 1779 |
return (1, $output); |
| 1780 |
} |
| 1781 |
chomp (my $proxytype = `$grid_proxy_info -file $proxyfile -type`); |
| 1782 |
local($typeopt) = ""; |
| 1783 |
if ($proxytype =~ /legacy/) { |
| 1784 |
$typeopt = "-old"; |
| 1785 |
} elsif ($proxytype =~ /RFC 3820 compliant/) { |
| 1786 |
$typeopt = "-rfc"; |
| 1787 |
} |
| 1788 |
$output = `$grid_proxy_init $PROXYBITS $typeopt -debug -verify -cert $proxyfile -key $proxyfile -valid 0:1 -out $tmpdir/tmpproxy.$$ 2>&1`; |
| 1789 |
if ($? != 0) { |
| 1790 |
$output = "failed to verify proxy\n" . $output; |
| 1791 |
unlink("$tmpdir/tmpproxy.$$"); |
| 1792 |
return (1, $output); |
| 1793 |
} |
| 1794 |
|
| 1795 |
# remove the new proxy we created for validation |
| 1796 |
# NOTE: this does not affect the user's original proxy in any way |
| 1797 |
unlink("$tmpdir/tmpproxy.$$"); |
| 1798 |
|
| 1799 |
return (0, ""); |
| 1800 |
} |
| 1801 |
|
| 1802 |
# |
| 1803 |
# verifycert |
| 1804 |
# |
| 1805 |
# Check to see if user has a valid usable certificate |
| 1806 |
# |
| 1807 |
# Dependencies: (-x grid-proxy-int) |
| 1808 |
# |
| 1809 |
# grid-proxy-init -debug -verify -cert $certfile -key $keyfile |
| 1810 |
# if $? == 0 then proxy is valid |
| 1811 |
# if $? != 0, die, b/c proxy is invalid and won't work |
| 1812 |
# |
| 1813 |
sub verifycert { |
| 1814 |
local($certfile, $keyfile) = @_; |
| 1815 |
|
| 1816 |
chomp (my $info = `$grid_cert_info -file $certfile`); |
| 1817 |
local($proxytype) = ""; |
| 1818 |
if ($info =~ /Subject: .* CN=proxy|\/CN=limited proxy/) { |
| 1819 |
$proxytype = "-old"; |
| 1820 |
} elsif ($info =~ /1.3.6.1.4.1.3536.1.222/) { |
| 1821 |
# no option for this -- hope for the best |
| 1822 |
} elsif ($info =~ /1.3.6.1.5.5.7.1.14/) { |
| 1823 |
$proxytype = "-rfc"; |
| 1824 |
} elsif ($info =~ /Proxy Certificate Information/) { |
| 1825 |
$proxytype = "-rfc"; |
| 1826 |
} else { |
| 1827 |
# shrug |
| 1828 |
} |
| 1829 |
local($output) = &runcmd("$grid_proxy_init $PROXYBITS $proxytype -debug -verify -cert $certfile -key $keyfile -valid 0:1 -out $tmpdir/tmpproxy.$$ -pwstdin", $passphrase); |
| 1830 |
if ($? != 0) { |
| 1831 |
$output = "failed to verify certificate from: $certfile and $keyfile\n" . $output; |
| 1832 |
unlink("$tmpdir/tmpproxy.$$"); |
| 1833 |
return (1, $output); |
| 1834 |
} |
| 1835 |
|
| 1836 |
# remove the new proxy we created for validation |
| 1837 |
# NOTE: this does not affect the user's original proxy in any way |
| 1838 |
unlink("$tmpdir/tmpproxy.$$"); |
| 1839 |
|
| 1840 |
return (0, ""); |
| 1841 |
} |
| 1842 |
|
| 1843 |
# |
| 1844 |
# verifytrustroots |
| 1845 |
# |
| 1846 |
# Check to see that trustroots were properly installed in |
| 1847 |
# ~/.globus/certificates, then remove that directory. |
| 1848 |
# |
| 1849 |
sub verifytrustroots { |
| 1850 |
if (!(-d $trustrootdir)) { |
| 1851 |
return (1, "trust root directory $trustrootdir doesn't exist!"); |
| 1852 |
} |
| 1853 |
$diritems = 0; |
| 1854 |
opendir(DIRHANDLE, $trustrootdir) or |
| 1855 |
die "couldn't open $trustrootdir : $!"; |
| 1856 |
while (defined($filename = readdir(DIRHANDLE))) { |
| 1857 |
next if $filename =~ /^\.\.?$/; # skip . and .. |
| 1858 |
$diritems++; |
| 1859 |
} |
| 1860 |
closedir(DIRHANDLE); |
| 1861 |
if ($diritems == 0) { |
| 1862 |
rmdir($trustrootdir); |
| 1863 |
return (1, "trust root directory $trustrootdir is empty!"); |
| 1864 |
} |
| 1865 |
`rm -rf $trustrootdir`; |
| 1866 |
return (0, ""); |
| 1867 |
} |
| 1868 |
|
| 1869 |
sub opensslsanitycheck { |
| 1870 |
$testkey = "$tmpdir/myproxy-test.$$.key"; |
| 1871 |
$cmd = "$openssl rsa -des3 -passout stdin -in $ENV{'X509_USER_KEY'} -out $testkey"; |
| 1872 |
($exitstatus, $output) = &runcmd($cmd, $passphrase . "\n"); |
| 1873 |
if ($exitstatus) { |
| 1874 |
print STDERR "$openssl rsa encrypt failed:\n", $cmd, "\n", $output; |
| 1875 |
system("which $openssl"); |
| 1876 |
system("$openssl version"); |
| 1877 |
die; |
| 1878 |
} |
| 1879 |
$cmd = "$openssl rsa -passin stdin -in $testkey > /dev/null"; |
| 1880 |
($exitstatus, $output) = &runcmd($cmd, $passphrase . "\n"); |
| 1881 |
if ($exitstatus) { |
| 1882 |
print STDERR "$openssl rsa decrypt failed:\n", $cmd, "\n", $output; |
| 1883 |
system("which $openssl"); |
| 1884 |
system("$openssl version"); |
| 1885 |
die; |
| 1886 |
} |
| 1887 |
unlink($testkey); |
| 1888 |
} |
| 1889 |
|
| 1890 |
sub debug { |
| 1891 |
print STDERR join('', @_), "\n" if ($verbose); |
| 1892 |
} |
| 1893 |
|
| 1894 |
sub docleanup { |
| 1895 |
unlink("$tmpdir/myproxy-test.$$"); |
| 1896 |
kill('TERM', $serverpid) if (defined($serverpid)); |
| 1897 |
unlink($SERVERPIDFILE) if (defined($SERVERPIDFILE)); |
| 1898 |
unlink($serverconf) if (defined($serverconf)); |
| 1899 |
`rm -rf $serverdir` if (defined($serverdir)); |
| 1900 |
} |
| 1901 |
|
| 1902 |
sub doperftests { |
| 1903 |
&dogpiperftest(); |
| 1904 |
&doinitperftest(); |
| 1905 |
&dogetdelegperftest(); |
| 1906 |
&doinfoperftest(); |
| 1907 |
&docpperftest(); |
| 1908 |
&dodbperftest() if ($dbperformance); |
| 1909 |
&docleanup(); |
| 1910 |
} |
| 1911 |
|
| 1912 |
sub dogpiperftest { |
| 1913 |
$starttime = time(); |
| 1914 |
$i = $perfclients; |
| 1915 |
while ($i--) { |
| 1916 |
$pid = fork(); |
| 1917 |
last if ($pid == 0); |
| 1918 |
} |
| 1919 |
if ($pid == 0) { |
| 1920 |
$i = $perfiters; |
| 1921 |
while ($i--) { |
| 1922 |
($exitstatus, $output) = |
| 1923 |
&runcmd("grid-proxy-init $PROXYBITS -hours 1 -out $tmpdir/myproxy-test.$$", undef); |
| 1924 |
if ($exitstatus != 0) { |
| 1925 |
print "$$: grid-proxy-init FAILED with $i iters to go.\n"; |
| 1926 |
print STDERR $output; |
| 1927 |
exit($exitstatus>>8); |
| 1928 |
} |
| 1929 |
} |
| 1930 |
unlink("$tmpdir/myproxy-test.$$"); |
| 1931 |
&debug("$$ is done."); |
| 1932 |
exit 0; |
| 1933 |
} |
| 1934 |
$i = $perfclients; |
| 1935 |
while ($i--) { |
| 1936 |
wait(); |
| 1937 |
if ($?) { |
| 1938 |
printf "child failed. aborting.\n"; |
| 1939 |
&docleanup(); exit 1; |
| 1940 |
} |
| 1941 |
} |
| 1942 |
$endtime = time(); |
| 1943 |
print $perfiters*$perfclients, " grid-proxy-inits in "; |
| 1944 |
print $endtime-$starttime, " seconds.\n"; |
| 1945 |
} |
| 1946 |
|
| 1947 |
sub doinitperftest { |
| 1948 |
$starttime = time(); |
| 1949 |
$i = $perfclients; |
| 1950 |
while ($i--) { |
| 1951 |
$pid = fork(); |
| 1952 |
last if ($pid == 0); |
| 1953 |
} |
| 1954 |
if ($pid == 0) { |
| 1955 |
$i = $perfiters; |
| 1956 |
while ($i--) { |
| 1957 |
($exitstatus, $output) = |
| 1958 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S -k $$", |
| 1959 |
$passphrase . "\n"); |
| 1960 |
if ($exitstatus != 0) { |
| 1961 |
print "$$: myproxy-init FAILED with $i iters to go.\n"; |
| 1962 |
print STDERR $output; |
| 1963 |
exit($exitstatus>>8); |
| 1964 |
} |
| 1965 |
} |
| 1966 |
&runtest("myproxy-destroy -v -k $$", undef); |
| 1967 |
&debug("$$ is done."); |
| 1968 |
exit 0; |
| 1969 |
} |
| 1970 |
$i = $perfclients; |
| 1971 |
while ($i--) { |
| 1972 |
wait(); |
| 1973 |
if ($?) { |
| 1974 |
printf "child failed. aborting.\n"; |
| 1975 |
&docleanup(); exit 1; |
| 1976 |
} |
| 1977 |
} |
| 1978 |
$endtime = time(); |
| 1979 |
print $perfiters*$perfclients, " myproxy-inits in "; |
| 1980 |
print $endtime-$starttime, " seconds.\n"; |
| 1981 |
} |
| 1982 |
|
| 1983 |
sub dogetdelegperftest { |
| 1984 |
($exitstatus, $output) = |
| 1985 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S", |
| 1986 |
$passphrase . "\n"); |
| 1987 |
if ($exitstatus != 0) { |
| 1988 |
print "myproxy-init failed\n"; print STDERR $output; |
| 1989 |
exit($exitstatus>>8); |
| 1990 |
} |
| 1991 |
$starttime = time(); |
| 1992 |
$i = $perfclients; |
| 1993 |
while ($i--) { |
| 1994 |
$pid = fork(); |
| 1995 |
last if ($pid == 0); |
| 1996 |
} |
| 1997 |
if ($pid == 0) { |
| 1998 |
$i = $perfiters; |
| 1999 |
while ($i--) { |
| 2000 |
($exitstatus, $output) = |
| 2001 |
&runtest("myproxy-logon -t 1 -o $tmpdir/myproxy-test.$$ -v -S", |
| 2002 |
$passphrase . "\n"); |
| 2003 |
if ($exitstatus != 0) { |
| 2004 |
print "$$: myproxy-logon FAILED with $i iters to go.\n"; |
| 2005 |
print STDERR $output; |
| 2006 |
exit($exitstatus>>8); |
| 2007 |
} |
| 2008 |
} |
| 2009 |
unlink("$tmpdir/myproxy-test.$$"); |
| 2010 |
&debug("$$ is done."); |
| 2011 |
exit 0; |
| 2012 |
} |
| 2013 |
$i = $perfclients; |
| 2014 |
while ($i--) { |
| 2015 |
wait(); |
| 2016 |
if ($?) { |
| 2017 |
printf "child failed. aborting.\n"; |
| 2018 |
&docleanup(); exit 1; |
| 2019 |
} |
| 2020 |
} |
| 2021 |
$endtime = time(); |
| 2022 |
print $perfiters*$perfclients, " myproxy-logons in "; |
| 2023 |
print $endtime-$starttime, " seconds.\n"; |
| 2024 |
&runtest("myproxy-destroy -v", undef); |
| 2025 |
} |
| 2026 |
|
| 2027 |
sub doinfoperftest { |
| 2028 |
($exitstatus, $output) = |
| 2029 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S", |
| 2030 |
$passphrase . "\n"); |
| 2031 |
if ($exitstatus != 0) { |
| 2032 |
print "myproxy-init failed\n"; print STDERR $output; |
| 2033 |
exit($exitstatus>>8); |
| 2034 |
} |
| 2035 |
$starttime = time(); |
| 2036 |
$i = $perfclients; |
| 2037 |
while ($i--) { |
| 2038 |
$pid = fork(); |
| 2039 |
last if ($pid == 0); |
| 2040 |
} |
| 2041 |
if ($pid == 0) { |
| 2042 |
$i = $perfiters; |
| 2043 |
while ($i--) { |
| 2044 |
($exitstatus, $output) = &runtest("myproxy-info -v", undef); |
| 2045 |
if ($exitstatus != 0) { |
| 2046 |
print "$$: myproxy-info FAILED with $i iters to go.\n"; |
| 2047 |
print STDERR $output; |
| 2048 |
exit($exitstatus>>8); |
| 2049 |
} |
| 2050 |
} |
| 2051 |
&debug("$$ is done."); |
| 2052 |
exit 0; |
| 2053 |
} |
| 2054 |
$i = $perfclients; |
| 2055 |
while ($i--) { |
| 2056 |
wait(); |
| 2057 |
if ($?) { |
| 2058 |
printf "child failed. aborting.\n"; |
| 2059 |
&docleanup(); exit 1; |
| 2060 |
} |
| 2061 |
} |
| 2062 |
$endtime = time(); |
| 2063 |
print $perfiters*$perfclients, " myproxy-infos in "; |
| 2064 |
print $endtime-$starttime, " seconds.\n"; |
| 2065 |
&runtest("myproxy-destroy -v", undef); |
| 2066 |
} |
| 2067 |
|
| 2068 |
sub docpperftest { |
| 2069 |
$starttime = time(); |
| 2070 |
$i = $perfclients; |
| 2071 |
while ($i--) { |
| 2072 |
$pid = fork(); |
| 2073 |
last if ($pid == 0); |
| 2074 |
} |
| 2075 |
if ($pid == 0) { |
| 2076 |
($exitstatus, $output) = |
| 2077 |
&runtest("myproxy-init -v -a -c 1 -t 1 -S -k $$", |
| 2078 |
$passphrase . "\n"); |
| 2079 |
if ($exitstatus != 0) { |
| 2080 |
print "$$: myproxy-init FAILED with $i iters to go.\n"; |
| 2081 |
print STDERR $output; |
| 2082 |
exit($exitstatus>>8); |
| 2083 |
} |
| 2084 |
$i = $perfiters; |
| 2085 |
while ($i--) { |
| 2086 |
$old_passphrase = $passphrase; |
| 2087 |
$passphrase = sprintf "%010d", int(rand(0x7fffffff)); |
| 2088 |
($exitstatus, $output) = |
| 2089 |
&runtest("myproxy-change-pass-phrase -v -S -k $$", |
| 2090 |
"$old_passphrase\n$passphrase\n"); |
| 2091 |
if ($exitstatus != 0) { |
| 2092 |
print "$$: myproxy-change-pass-phrase FAILED with $i iters to go.\n"; |
| 2093 |
print STDERR $output; |
| 2094 |
exit($exitstatus>>8); |
| 2095 |
} |
| 2096 |
} |
| 2097 |
&runtest("myproxy-destroy -v -k $$", undef); |
| 2098 |
&debug("$$ is done."); |
| 2099 |
exit 0; |
| 2100 |
} |
| 2101 |
$i = $perfclients; |
| 2102 |
while ($i--) { |
| 2103 |
wait(); |
| 2104 |
if ($?) { |
| 2105 |
printf "child failed. aborting.\n"; |
| 2106 |
&docleanup(); exit 1; |
| 2107 |
} |
| 2108 |
} |
| 2109 |
$endtime = time(); |
| 2110 |
print $perfiters*$perfclients, " myproxy-change-pass-phrases in "; |
| 2111 |
print $endtime-$starttime, " seconds.\n"; |
| 2112 |
} |
| 2113 |
|
| 2114 |
sub dodbperftest { |
| 2115 |
foreach $dbsize (10,100,1000,10000) { |
| 2116 |
$i = $dbsize; |
| 2117 |
while ($i--) { |
| 2118 |
($exitstatus, $output) = |
| 2119 |
&runtest("myproxy-admin-load-credential -v -d -l $i" . |
| 2120 |
" -c $ENV{X509_USER_CERT} -y $ENV{X509_USER_KEY}" . |
| 2121 |
(defined($serverdir) ? " -s $serverdir" : ""), undef); |
| 2122 |
if ($exitstatus != 0) { |
| 2123 |
print "myproxy-admin-load-credential FAILED.\n"; |
| 2124 |
print STDERR $output; |
| 2125 |
exit($exitstatus>>8); |
| 2126 |
} |
| 2127 |
} |
| 2128 |
$starttime = time(); |
| 2129 |
$i = $dbsize; |
| 2130 |
while ($i--) { |
| 2131 |
($exitstatus, $output) = &runtest("myproxy-info -v -l $i", undef); |
| 2132 |
if ($exitstatus != 0) { |
| 2133 |
print "myproxy-info FAILED.\n"; |
| 2134 |
print STDERR $output; |
| 2135 |
exit($exitstatus>>8); |
| 2136 |
} |
| 2137 |
} |
| 2138 |
$endtime = time(); |
| 2139 |
print $dbsize, " myproxy-infos in ", $endtime-$starttime, " seconds.\n"; |
| 2140 |
$starttime = $endtime; |
| 2141 |
$i = $dbsize; |
| 2142 |
while ($i--) { |
| 2143 |
($exitstatus, $output) = &runtest("myproxy-destroy -v -l $i", |
| 2144 |
undef); |
| 2145 |
if ($exitstatus != 0) { |
| 2146 |
print "myproxy-destroy FAILED.\n"; |
| 2147 |
print STDERR $output; |
| 2148 |
exit($exitstatus>>8); |
| 2149 |
} |
| 2150 |
} |
| 2151 |
$endtime = time(); |
| 2152 |
print $dbsize, " myproxy-destroys in "; |
| 2153 |
print $endtime-$starttime, " seconds.\n"; |
| 2154 |
} |
| 2155 |
} |
| 2156 |
|
| 2157 |
sub openport { |
| 2158 |
$sockaddr = 'S n a4 x8'; |
| 2159 |
$host = "127.0.0.1"; |
| 2160 |
local($port) = @_; |
| 2161 |
@list = getprotobyname('tcp'); |
| 2162 |
$proto = $list[2]; |
| 2163 |
@list = gethostbyaddr(inet_aton($host), AF_INET); |
| 2164 |
$addr = $list[4]; |
| 2165 |
while ($port < 65535) { |
| 2166 |
$destaddr = pack($sockaddr, AF_INET, $port, $addr); |
| 2167 |
socket(S, AF_INET, SOCK_STREAM, $proto) || die $!; |
| 2168 |
connect(S, $destaddr); |
| 2169 |
if ($! =~ /Connection refused/) { |
| 2170 |
return $port; |
| 2171 |
} |
| 2172 |
close(S); |
| 2173 |
$port++; |
| 2174 |
} |
| 2175 |
die "failed to find available port"; |
| 2176 |
} |
| 2177 |
|
| 2178 |
sub write_myproxy_header_test { |
| 2179 |
open(SRC, ">$tmpdir/myproxy.c") || |
| 2180 |
die "failed to open $tmpdir/myproxy.c, stopped"; |
| 2181 |
print SRC <<EOF; |
| 2182 |
#include <myproxy.h> |
| 2183 |
int main() { return 0; } |
| 2184 |
EOF |
| 2185 |
close(SRC); |
| 2186 |
} |
| 2187 |
|
| 2188 |
sub write_valgrind_supp { |
| 2189 |
open(SUPP, ">$tmpdir/valgrind.supp") || |
| 2190 |
die "failed to open $tmpdir/valgrind.supp, stopped"; |
| 2191 |
print SUPP <<EOF; |
| 2192 |
{ |
| 2193 |
SSL_library_init |
| 2194 |
Memcheck:Leak |
| 2195 |
... |
| 2196 |
fun:SSL_library_init |
| 2197 |
... |
| 2198 |
} |
| 2199 |
{ |
| 2200 |
SSL_load_error_strings |
| 2201 |
Memcheck:Leak |
| 2202 |
... |
| 2203 |
fun:SSL_load_error_strings |
| 2204 |
... |
| 2205 |
} |
| 2206 |
{ |
| 2207 |
ERR_load_SSL_strings |
| 2208 |
Memcheck:Leak |
| 2209 |
... |
| 2210 |
fun:ERR_load_SSL_strings |
| 2211 |
... |
| 2212 |
} |
| 2213 |
{ |
| 2214 |
OpenSSL_add_all_ciphers |
| 2215 |
Memcheck:Leak |
| 2216 |
... |
| 2217 |
fun:OpenSSL_add_all_ciphers |
| 2218 |
... |
| 2219 |
} |
| 2220 |
{ |
| 2221 |
getpwuid |
| 2222 |
Memcheck:Leak |
| 2223 |
... |
| 2224 |
fun:getpwuid |
| 2225 |
... |
| 2226 |
} |
| 2227 |
{ |
| 2228 |
getpw |
| 2229 |
Memcheck:Leak |
| 2230 |
... |
| 2231 |
fun:getpw |
| 2232 |
... |
| 2233 |
} |
| 2234 |
{ |
| 2235 |
tzset |
| 2236 |
Memcheck:Leak |
| 2237 |
... |
| 2238 |
fun:tzset |
| 2239 |
... |
| 2240 |
} |
| 2241 |
{ |
| 2242 |
localtime |
| 2243 |
Memcheck:Leak |
| 2244 |
... |
| 2245 |
fun:localtime |
| 2246 |
... |
| 2247 |
} |
| 2248 |
{ |
| 2249 |
gmtime |
| 2250 |
Memcheck:Leak |
| 2251 |
... |
| 2252 |
fun:gmtime |
| 2253 |
... |
| 2254 |
} |
| 2255 |
{ |
| 2256 |
gethostbyname |
| 2257 |
Memcheck:Leak |
| 2258 |
... |
| 2259 |
fun:gethostbyname |
| 2260 |
... |
| 2261 |
} |
| 2262 |
{ |
| 2263 |
sysloginitnotify |
| 2264 |
Memcheck:Leak |
| 2265 |
... |
| 2266 |
fun:_sl_init_notify |
| 2267 |
... |
| 2268 |
} |
| 2269 |
{ |
| 2270 |
AES_cbc_encrypt |
| 2271 |
Memcheck:Addr4 |
| 2272 |
fun:AES_cbc_encrypt |
| 2273 |
} |
| 2274 |
{ |
| 2275 |
globus_i_gsi_gss_create_cred-fixed-Jan2009 |
| 2276 |
Memcheck:Leak |
| 2277 |
fun:malloc |
| 2278 |
... |
| 2279 |
fun:globus_gsi_cred_get_cert_chain |
| 2280 |
fun:globus_i_gsi_gss_create_cred |
| 2281 |
... |
| 2282 |
} |
| 2283 |
{ |
| 2284 |
globus_gss_assist_acquire_cred |
| 2285 |
Memcheck:Leak |
| 2286 |
... |
| 2287 |
fun:CRYPTO_malloc |
| 2288 |
... |
| 2289 |
fun:X509_STORE_new |
| 2290 |
fun:SSL_CTX_new |
| 2291 |
... |
| 2292 |
fun:globus_gss_assist_acquire_cred |
| 2293 |
... |
| 2294 |
} |
| 2295 |
{ |
| 2296 |
X509_STORE_CTX_get_ex_new_index |
| 2297 |
Memcheck:Leak |
| 2298 |
... |
| 2299 |
fun:CRYPTO_malloc |
| 2300 |
... |
| 2301 |
fun:X509_STORE_CTX_get_ex_new_index |
| 2302 |
... |
| 2303 |
} |
| 2304 |
{ |
| 2305 |
globus_gss_assist_acquire_cred_new_ex_data |
| 2306 |
Memcheck:Leak |
| 2307 |
... |
| 2308 |
fun:CRYPTO_malloc |
| 2309 |
... |
| 2310 |
fun:CRYPTO_new_ex_data |
| 2311 |
... |
| 2312 |
fun:globus_gss_assist_acquire_cred |
| 2313 |
fun:GSI_SOCKET_authentication_init |
| 2314 |
... |
| 2315 |
} |
| 2316 |
{ |
| 2317 |
globus_gss_assist_acquire_cred_asn1_item_d2i |
| 2318 |
Memcheck:Leak |
| 2319 |
... |
| 2320 |
fun:CRYPTO_malloc |
| 2321 |
... |
| 2322 |
fun:ASN1_item_d2i |
| 2323 |
... |
| 2324 |
fun:globus_gss_assist_acquire_cred |
| 2325 |
fun:GSI_SOCKET_authentication_init |
| 2326 |
... |
| 2327 |
} |
| 2328 |
{ |
| 2329 |
gss_release_name |
| 2330 |
Memcheck:Leak |
| 2331 |
... |
| 2332 |
fun:gss_release_name |
| 2333 |
fun:globus_gss_assist_accept_sec_context |
| 2334 |
... |
| 2335 |
} |
| 2336 |
{ |
| 2337 |
globus_i_gsi_gss_handshake |
| 2338 |
Memcheck:Leak |
| 2339 |
... |
| 2340 |
fun:globus_i_gsi_gss_handshake |
| 2341 |
fun:gss_accept_sec_context |
| 2342 |
fun:globus_gss_assist_accept_sec_context |
| 2343 |
... |
| 2344 |
} |
| 2345 |
{ |
| 2346 |
GSI_SOCKET_check_creds |
| 2347 |
Memcheck:Leak |
| 2348 |
... |
| 2349 |
fun:globus_gss_assist_acquire_cred |
| 2350 |
fun:GSI_SOCKET_check_creds |
| 2351 |
... |
| 2352 |
} |
| 2353 |
{ |
| 2354 |
globus_gss_assist_init_sec_context |
| 2355 |
Memcheck:Leak |
| 2356 |
... |
| 2357 |
fun:globus_gss_assist_init_sec_context |
| 2358 |
fun:GSI_SOCKET_authentication_init |
| 2359 |
fun:myproxy_authenticate_init |
| 2360 |
fun:myproxy_bootstrap_client |
| 2361 |
... |
| 2362 |
} |
| 2363 |
{ |
| 2364 |
globus_module_activate |
| 2365 |
Memcheck:Leak |
| 2366 |
... |
| 2367 |
fun:globus_module_activate |
| 2368 |
... |
| 2369 |
} |
| 2370 |
{ |
| 2371 |
__libc_dlopen_mode |
| 2372 |
Memcheck:Addr4 |
| 2373 |
... |
| 2374 |
fun:__libc_dlopen_mode |
| 2375 |
fun:__nss_lookup_function |
| 2376 |
... |
| 2377 |
} |
| 2378 |
{ |
| 2379 |
InitProxyCertInfoExtension |
| 2380 |
Memcheck:Leak |
| 2381 |
... |
| 2382 |
fun:OBJ_txt2obj |
| 2383 |
fun:InitProxyCertInfoExtension |
| 2384 |
... |
| 2385 |
fun:VOMS_Init |
| 2386 |
... |
| 2387 |
} |
| 2388 |
EOF |
| 2389 |
close(SUPP); |
| 2390 |
} |