pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ron <ronljohnsonjr@gmail.com>
Cc: Forums postgresql <pgsql-general@postgresql.org>
Subject: Re: Trigger when user logs in
Date: Thu, 11 Apr 2019 22:52:42 -0400
Message-ID: <22830.1555037562@sss.pgh.pa.us> (raw)
In-Reply-To: <d0b376b1-dedf-64c7-8d00-8aaa132177d4@gmail.com>
References: <eb44b902-9c08-8489-7d32-79d889d9e229@gmail.com>
	<21272.1555035161@sss.pgh.pa.us>
	<d0b376b1-dedf-64c7-8d00-8aaa132177d4@gmail.com>

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/p...

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





view thread (12+ messages)  latest in thread

Message-ID: <22830.1555037562@sss.pgh.pa.us>
Permalink:  ../22830.1555037562@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22830.1555037562@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ronljohnsonjr@gmail.com
  Subject: Re: Trigger when user logs in
  In-Reply-To: <22830.1555037562@sss.pgh.pa.us>
  References: <eb44b902-9c08-8489-7d32-79d889d9e229@gmail.com> <21272.1555035161@sss.pgh.pa.us> <d0b376b1-dedf-64c7-8d00-8aaa132177d4@gmail.com> <22830.1555037562@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox