Add notBefore and notAfter to SSL cert info display
commit6acb0a628eccab8764e0306582c2b7e2a1441b9b
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Fri, 22 Mar 2024 20:25:25 +0000 (22 21:25 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Fri, 22 Mar 2024 20:25:25 +0000 (22 21:25 +0100)
tree35e13c67443d52319f7bc4c9d4c21e27aa01816d
parentb670b93a66fc554714e0fe8e51a944912bb9fd68
Add notBefore and notAfter to SSL cert info display

This adds the X509 attributes notBefore and notAfter to sslinfo
as well as pg_stat_ssl to allow verifying and identifying the
validity period of the current client certificate. OpenSSL has
APIs for extracting notAfter and notBefore, but they are only
supported in recent versions so we have to calculate the dates
by hand in order to make this work for the older versions of
OpenSSL that we still support.

Original patch by Cary Huang with additional hacking by Jacob
and myself.

Author: Cary Huang <cary.huang@highgo.ca>
Co-author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-author: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/182b8565486.10af1a86f158715.2387262617218380588@highgo.ca
19 files changed:
contrib/sslinfo/Makefile
contrib/sslinfo/meson.build
contrib/sslinfo/sslinfo--1.2--1.3.sql [new file with mode: 0644]
contrib/sslinfo/sslinfo.c
contrib/sslinfo/sslinfo.control
doc/src/sgml/monitoring.sgml
doc/src/sgml/sslinfo.sgml
src/backend/catalog/system_views.sql
src/backend/libpq/be-secure-openssl.c
src/backend/utils/activity/backend_status.c
src/backend/utils/adt/pgstatfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/libpq/libpq-be.h
src/include/utils/backend_status.h
src/test/regress/expected/rules.out
src/test/ssl/t/001_ssltests.pl
src/test/ssl/t/003_sslinfo.pl
src/tools/pgindent/typedefs.list