Changeset 1313:cc2f17cd9677 in nginx-tests


Ignore:
Timestamp:
03/30/18 12:28:22 (2 years ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Phase:
public
Message:

Tests: very basic grpc ssl verify and passphrase tests added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grpc_ssl.t

    r1312 r1313  
    5353        ssl_certificate_key localhost.key;
    5454        ssl_certificate localhost.crt;
     55
     56        ssl_verify_client optional;
     57        ssl_client_certificate client.crt;
    5558
    5659        http2_max_field_size 128k;
     
    7477        location / {
    7578            grpc_pass grpcs://127.0.0.1:8081;
     79            grpc_ssl_name localhost;
     80            grpc_ssl_verify on;
     81            grpc_ssl_trusted_certificate localhost.crt;
     82
     83            grpc_ssl_certificate client.crt;
     84            grpc_ssl_certificate_key client.key;
     85            grpc_ssl_password_file password;
    7686
    7787            if ($arg_if) {
     
    109119                or die "Can't create certificate for $name: $!\n";
    110120}
     121
     122foreach my $name ('client') {
     123        system("openssl genrsa -out $d/$name.key -passout pass:$name "
     124                . "-aes128 1024 >>$d/openssl.out 2>&1") == 0
     125                or die "Can't create private key: $!\n";
     126        system('openssl req -x509 -new '
     127                . "-config $d/openssl.conf -subj /CN=$name/ "
     128                . "-out $d/$name.crt "
     129                . "-key $d/$name.key -passin pass:$name"
     130                . ">>$d/openssl.out 2>&1") == 0
     131                or die "Can't create certificate for $name: $!\n";
     132}
     133
     134$t->write_file('password', 'client');
    111135
    112136$t->try_run('no grpc')->plan(33);
Note: See TracChangeset for help on using the changeset viewer.