]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/updateCert
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / clxutils / updateCert
1 #! /bin/csh -f
2 #
3 # Test certs; if expired, replace them via ssl PING
4 #
5 # usage: updateCert sslHost certFileBase cert...
6 #
7 # tweak this manually for debug
8 set VERBOSE=NO
9 #
10 if ( $#argv < 3 ) then
11 echo "Usage: updateCert sslHost certFileBase cert..."
12 exit(1)
13 endif
14 set sslHost=$argv[1]
15 shift
16 set certFileBase=$argv[1]
17 shift
18 set certArgs="-c $argv[1]"
19 shift
20 while ( $#argv > 0 )
21 set certArgs="$certArgs -c $argv[1]"
22 shift
23 end
24 set OUTFILE=$LOCAL_BUILD_DIR/.certVerifyOut
25 if($VERBOSE == YES) then
26 echo Testing $certArgs
27 endif
28 $LOCAL_BUILD_DIR/certcrl $certArgs -s >& $OUTFILE
29 grep TP_CERT_EXPIRED $OUTFILE
30 if($status == 1) then
31 if($VERBOSE == YES) then
32 echo "These certs look good."
33 endif
34 exit(0)
35 endif
36 echo "@@@ Warning: replacing certs for $sslHost @@@"
37 $LOCAL_BUILD_DIR/sslViewer $sslHost f $certFileBase
38 if($status == 1) then
39 echo "@@@ Error obtaining new cert for $sslHost @@@"
40 else
41 echo ...certs replaced for $sslHost in `pwd`
42 endif