comparison ssl_crl.t @ 1220:0af58b78df35

Tests: removed single quotes from system() calls. Single quotes were used to escape paths with spaces but are neither supported in the Windows CMD shell, nor sufficient without proper %%TESTDIR%% expansion.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 20 Sep 2017 14:46:51 +0300
parents 97a6cb846926
children 8c764fd93b5e
comparison
equal deleted inserted replaced
1219:f373a718f646 1220:0af58b78df35
103 commonName = supplied 103 commonName = supplied
104 EOF 104 EOF
105 105
106 foreach my $name ('root', 'localhost') { 106 foreach my $name ('root', 'localhost') {
107 system('openssl req -x509 -new ' 107 system('openssl req -x509 -new '
108 . "-config '$d/openssl.conf' -subj '/CN=$name/' " 108 . "-config $d/openssl.conf -subj /CN=$name/ "
109 . "-out '$d/$name.crt' -keyout '$d/$name.key' " 109 . "-out $d/$name.crt -keyout $d/$name.key "
110 . ">>$d/openssl.out 2>&1") == 0 110 . ">>$d/openssl.out 2>&1") == 0
111 or die "Can't create certificate for $name: $!\n"; 111 or die "Can't create certificate for $name: $!\n";
112 } 112 }
113 113
114 foreach my $name ('int', 'end') { 114 foreach my $name ('int', 'end') {
115 system("openssl req -new " 115 system("openssl req -new "
116 . "-config '$d/openssl.conf' -subj '/CN=$name/' " 116 . "-config $d/openssl.conf -subj /CN=$name/ "
117 . "-out '$d/$name.csr' -keyout '$d/$name.key' " 117 . "-out $d/$name.csr -keyout $d/$name.key "
118 . ">>$d/openssl.out 2>&1") == 0 118 . ">>$d/openssl.out 2>&1") == 0
119 or die "Can't create certificate for $name: $!\n"; 119 or die "Can't create certificate for $name: $!\n";
120 } 120 }
121 121
122 $t->write_file('certserial', '1000'); 122 $t->write_file('certserial', '1000');
123 $t->write_file('certindex', ''); 123 $t->write_file('certindex', '');
124 124
125 system("openssl ca -batch -config '$d/ca.conf' " 125 system("openssl ca -batch -config $d/ca.conf "
126 . "-keyfile '$d/root.key' -cert '$d/root.crt' " 126 . "-keyfile $d/root.key -cert $d/root.crt "
127 . "-subj '/CN=int/' -in '$d/int.csr' -out '$d/int.crt' " 127 . "-subj /CN=int/ -in $d/int.csr -out $d/int.crt "
128 . ">>$d/openssl.out 2>&1") == 0 128 . ">>$d/openssl.out 2>&1") == 0
129 or die "Can't sign certificate for int: $!\n"; 129 or die "Can't sign certificate for int: $!\n";
130 130
131 system("openssl ca -batch -config '$d/ca.conf' " 131 system("openssl ca -batch -config $d/ca.conf "
132 . "-keyfile '$d/int.key' -cert '$d/int.crt' " 132 . "-keyfile $d/int.key -cert $d/int.crt "
133 . "-subj '/CN=end/' -in '$d/end.csr' -out '$d/end.crt' " 133 . "-subj /CN=end/ -in $d/end.csr -out $d/end.crt "
134 . ">>$d/openssl.out 2>&1") == 0 134 . ">>$d/openssl.out 2>&1") == 0
135 or die "Can't sign certificate for end: $!\n"; 135 or die "Can't sign certificate for end: $!\n";
136 136
137 system("openssl ca -gencrl -config '$d/ca.conf' " 137 system("openssl ca -gencrl -config $d/ca.conf "
138 . "-keyfile '$d/root.key' -cert '$d/root.crt' " 138 . "-keyfile $d/root.key -cert $d/root.crt "
139 . "-out '$d/empty.crl' -crldays 1 " 139 . "-out $d/empty.crl -crldays 1 "
140 . ">>$d/openssl.out 2>&1") == 0 140 . ">>$d/openssl.out 2>&1") == 0
141 or die "Can't create empty crl: $!\n"; 141 or die "Can't create empty crl: $!\n";
142 142
143 system("openssl ca -config '$d/ca.conf' -revoke '$d/int.crt' " 143 system("openssl ca -config $d/ca.conf -revoke $d/int.crt "
144 . "-keyfile '$d/root.key' -cert '$d/root.crt' " 144 . "-keyfile $d/root.key -cert $d/root.crt "
145 . ">>$d/openssl.out 2>&1") == 0 145 . ">>$d/openssl.out 2>&1") == 0
146 or die "Can't revoke int.crt: $!\n"; 146 or die "Can't revoke int.crt: $!\n";
147 147
148 system("openssl ca -gencrl -config '$d/ca.conf' " 148 system("openssl ca -gencrl -config $d/ca.conf "
149 . "-keyfile '$d/root.key' -cert '$d/root.crt' " 149 . "-keyfile $d/root.key -cert $d/root.crt "
150 . "-out '$d/root.crl' -crldays 1 " 150 . "-out $d/root.crl -crldays 1 "
151 . ">>$d/openssl.out 2>&1") == 0 151 . ">>$d/openssl.out 2>&1") == 0
152 or die "Can't update crl: $!\n"; 152 or die "Can't update crl: $!\n";
153 153
154 $t->write_file('int-root.crt', 154 $t->write_file('int-root.crt',
155 $t->read_file('int.crt') . $t->read_file('root.crt')); 155 $t->read_file('int.crt') . $t->read_file('root.crt'));