Re: Trigger when user logs in - Mailing list pgsql-general

From Tom Lane
Subject Re: Trigger when user logs in
Date
Msg-id 22830.1555037562@sss.pgh.pa.us
Whole thread Raw
In response to Re: Trigger when user logs in  (Ron <ronljohnsonjr@gmail.com>)
Responses Re: Trigger when user logs in  (Ron <ronljohnsonjr@gmail.com>)
Re: Trigger when user logs in  ("Schneider, Jeremy" <schnjere@amazon.com>)
List pgsql-general
Ron <ronljohnsonjr@gmail.com> writes:
> On 4/11/19 9:12 PM, Tom Lane wrote:
>> PAM is the usual suggestion

> Can you be more specific?

I'm suggesting that you use PAM auth

https://www.postgresql.org/docs/current/auth-pam.html

and then configure the email behavior on the PAM side.

The PAM doc link we provided there leads to a page that looks kind of
moribund, but Mr. Google finds much more useful resources, eg


https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/managing_smart_cards/pluggable_authentication_modules

https://www.freebsd.org/doc/en/articles/pam/pam-freebsd-modules.html

https://web.archive.org/web/20180303034326/http://www.tuxradar.com/content/how-pam-works

I would have guessed that there was a PAM module that does what you
want out-of-the-box, but it looks like maybe you have to resort to
invoking an MUA via the generic pam_exec module, as in one of the
responses here:

https://askubuntu.com/questions/179889/how-do-i-set-up-an-email-alert-when-a-ssh-login-is-successful

>> when you need off-the-beaten-path login behavior.

> I bet requests like this will start to make it onto the beaten path.

Meh.  I'm not that excited about inventing our own versions of wheels
that already exist, especially when there's nothing very Postgres-specific
about the requirements.  Notice that the example I pointed you at is for
sshd not Postgres.  IMO the fact that you can use the same tool to solve
both cases is a good thing.

            regards, tom lane



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: Trigger when user logs in
Next
From: Ron
Date:
Subject: Re: Trigger when user logs in