Pasword expiration warning

From: Gilles Darold <gilles(at)migops(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Pasword expiration warning
Date: 2021-11-19 14:49:37
Message-ID: 129bcfbf-47a6-e58a-190a-62fc21a17d03@migops.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Now that the security policy is getting stronger, it is not uncommon to
create users with a password expiration date (VALID UNTIL). The problem
is that the user is only aware that his password has expired when he can
no longer log in unless the application with which he is connecting
notifies him beforehand.

I'm wondering if we might be interested in having this feature in psql?
For example for a user whose password expires in 3 days:

gilles=# CREATE ROLE foo LOGIN PASSWORD 'foo' VALID UNTIL '2021-11-22';
CREATE ROLE
gilles=# \c - foo
Password for user foo:
psql (15devel, server 14.1 (Ubuntu 14.1-2.pgdg20.04+1))
** Warning: your password expires in 3 days **
You are now connected to database "gilles" as user "foo".

My idea is to add a psql variable that can be defined in psqlrc to
specify the number of days before the user password expires to start
printing a warning. The warning message is only diplayed in interactive
mode Example:

$ cat /etc/postgresql-common/psqlrc
\set PASSWORD_EXPIRE_WARNING 7

Default value is 0 like today no warning at all.

Of course any other client application have to write his own beforehand
expiration notice but with psql we don't have it for the moment. If
there is interest for this psql feature I can post the patch.

--
Gilles Darold

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-11-19 14:59:17 Re: dfmgr additional ABI version fields
Previous Message Masahiko Sawada 2021-11-19 14:10:57 Re: Failed transaction statistics to measure the logical replication progress