|
8 | 8 |
|
9 | 9 | if ($ENV{with_openssl} eq 'yes') |
10 | 10 | { |
11 | | - plan tests => 65; |
| 11 | + plan tests => 71; |
12 | 12 | } |
13 | 13 | else |
14 | 14 | { |
|
309 | 309 | qr/SSL error/, |
310 | 310 | "does not connect with client-side CRL"); |
311 | 311 |
|
| 312 | +# pg_stat_ssl |
| 313 | +command_like([ |
| 314 | + 'psql', '-X', '-A', '-F', ',', '-P', 'null=_null_', |
| 315 | + '-d', "$common_connstr sslrootcert=invalid", |
| 316 | + '-c', "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()" |
| 317 | + ], |
| 318 | + qr{^pid,ssl,version,cipher,bits,compression,clientdn\n |
| 319 | + ^\d+,t,TLSv[\d.]+,[\w-]+,\d+,f,$}mx, |
| 320 | + 'pg_stat_ssl view without client certificate'); |
| 321 | + |
312 | 322 | ### Server-side tests. |
313 | 323 | ### |
314 | 324 | ### Test certificate authorization. |
|
331 | 341 | "user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key", |
332 | 342 | "certificate authorization succeeds with correct client cert"); |
333 | 343 |
|
| 344 | +# pg_stat_ssl |
| 345 | +command_like([ |
| 346 | + 'psql', '-X', '-A', '-F', ',', '-P', 'null=_null_', |
| 347 | + '-d', "$common_connstr user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key", |
| 348 | + '-c', "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()" |
| 349 | + ], |
| 350 | + qr{^pid,ssl,version,cipher,bits,compression,clientdn\n |
| 351 | + ^\d+,t,TLSv[\d.]+,[\w-]+,\d+,f,/CN=ssltestuser$}mx, |
| 352 | + 'pg_stat_ssl with client certificate'); |
| 353 | + |
334 | 354 | # client key with wrong permissions |
335 | 355 | test_connect_fails( |
336 | 356 | $common_connstr, |
|
0 commit comments