Skip to content

Commit bba405c

Browse files
committed
Tests: loading "engine:..." keys with certificate variable.
1 parent 2f8407d commit bba405c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

ssl_engine_keys.t

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ plan(skip_all => 'may not work, leaves coredump')
2828
unless $ENV{TEST_NGINX_UNSAFE};
2929

3030
my $t = Test::Nginx->new()->has(qw/http proxy http_ssl/)->has_daemon('openssl')
31-
->has_daemon('softhsm')->has_daemon('pkcs11-tool')->plan(1);
31+
->has_daemon('softhsm')->has_daemon('pkcs11-tool');
3232

3333
$t->write_file_expand('nginx.conf', <<'EOF');
3434
@@ -53,9 +53,28 @@ http {
5353
location / {
5454
# index index.html by default
5555
}
56+
5657
location /proxy {
5758
proxy_pass https://127.0.0.1:8081/;
5859
}
60+
61+
location /var {
62+
proxy_pass https://127.0.0.1:8082/;
63+
proxy_ssl_name localhost;
64+
proxy_ssl_server_name on;
65+
}
66+
}
67+
68+
server {
69+
listen 127.0.0.1:8082 ssl;
70+
server_name localhost;
71+
72+
ssl_certificate $ssl_server_name.crt;
73+
ssl_certificate_key engine:pkcs11:slot_0-id_00;
74+
75+
location / {
76+
# index index.html by default
77+
}
5978
}
6079
}
6180
@@ -118,12 +137,13 @@ foreach my $name ('localhost') {
118137
or die "Can't create certificate for $name: $!\n";
119138
}
120139

121-
$t->run();
140+
$t->try_run('no ssl_certificate variables')->plan(2);
122141

123142
$t->write_file('index.html', '');
124143

125144
###############################################################################
126145

127146
like(http_get('/proxy'), qr/200 OK/, 'ssl engine keys');
147+
like(http_get('/var'), qr/200 OK/, 'ssl_certificate with variable');
128148

129149
###############################################################################

0 commit comments

Comments
 (0)