Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFeiM-0000Ym-Ja for pgsql-general@arkaria.postgresql.org; Sun, 14 Apr 2019 12:58:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hFeiL-00073l-8m for pgsql-general@arkaria.postgresql.org; Sun, 14 Apr 2019 12:58:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFeiK-00073e-Sc for pgsql-general@lists.postgresql.org; Sun, 14 Apr 2019 12:58:28 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFeiI-0004Gt-Bi for pgsql-general@lists.postgresql.org; Sun, 14 Apr 2019 12:58:28 +0000 Received: by mail-oi1-x231.google.com with SMTP id v10so11625939oib.1 for ; Sun, 14 Apr 2019 05:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Bxw5e/1GAPmCSXkPYOlyUTJsAFc59rOQwgQo8225goY=; b=BQKgVQ2Hkf8sr6tOvJN+cbjOHgVVwQzW5p0tczqKdZKjFc5xYu9fBC8iJgAOfOnoF3 6Wt4G4Rx2TBJrSWzTw7UKWf3st4VXibmgNxK9Zrq0oCMz+NGyGzpLAj04a51oIf11DKr aUEVAPN5aIzzizFZFZIJd9saOy8PUZdgk7thxl3yVj2Vort8LwOaW6GpfYrFdEl5Lj5g O3AFd1t0b96ysToW/c++SQ01L+jtUy4337LJPBXF9QE4Ic+G0PJyq0MMw8z199XQ4HFL b4hcioPOOPT+LrH4CiDUPvf17Ku7Cn/d62jcAvR40uragjbB4ABWSAH1owkUGT3HwdkG UZHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Bxw5e/1GAPmCSXkPYOlyUTJsAFc59rOQwgQo8225goY=; b=fQ6JBKzljG4qc3KUahmGZdp6HHRJ3+yQdMKDQolGJ4oGQcASLhpbTG/V9DICIZjcsJ cfkZYoZGnDEYLwolZMDsqRupv8JyKj758csguL9EKcn59dCcW/dDJDV9CN6YxVX7PQNz rQrfwYfZxNh/DmktDPilPV+KhaMMSPSXlY9//jP3GoqPVKBicOP+K7vshUIX/W373vib O4uCyU+746w6ZdYX//Tkg3xbhJe2R2I/4cWBCvKclcbat/v5+JjYk7WnrkPQ14WBkvbn y4BifVuCAQEIVQtY24f+mLI4JwSRjkg2d7KuMRAganLSJ3uzFQ4CiCmHeen2OmA99yMg 7ubA== X-Gm-Message-State: APjAAAVmr+8rg7WuPbvizfzfIxdrxpS/2bDuhtcxtXgDmmcL/eEjcV48 VXX6dOyh48tBSQWsedefrys1dnCyUeo= X-Google-Smtp-Source: APXvYqxEwlJ8n2YAgvqC9VadL6Kiz3FKzhp2i7nlD8+1A2fOsHN27a6EhYZ9FZvHbCIwqrFKPYCqug== X-Received: by 2002:aca:5055:: with SMTP id e82mr16204500oib.1.1555246703896; Sun, 14 Apr 2019 05:58:23 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id y129sm17523060oig.27.2019.04.14.05.58.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Apr 2019 05:58:23 -0700 (PDT) Subject: Re: Trigger when user logs in To: pgsql-general@lists.postgresql.org References: <21272.1555035161@sss.pgh.pa.us> <22830.1555037562@sss.pgh.pa.us> <46D55D2C-5496-4867-9B87-3D865D71BCD2@amazon.com> <6f77e98b-49f3-ecaa-f9d4-ef699999143a@gmail.com> <20190414090552.gopz6g2i3l2fruxm@hjp.at> From: Ron Message-ID: <106b546b-194a-36f6-b249-3f8dfb18c5bb@gmail.com> Date: Sun, 14 Apr 2019 07:58:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190414090552.gopz6g2i3l2fruxm@hjp.at> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/14/19 4:05 AM, Peter J. Holzer wrote: > On 2019-04-13 22:22:16 -0500, Ron wrote: >> In our case, another looming Auditor requirement is to be able to instantly >> kick off -- or at least send a warning email -- when certain roles log in >> from unapproved IP addresses or programs.  For example, service accounts >> should only be able to log in from IP addresses and certain applications. >> Humans logging in via service accounts using pgAdmin should, for example, be >> instantly kicked off. > If you want to prevent a user from logging in (which is functionally > equivalent but a bit stronger than "instantly kick off"), then this is > definitely something that could and should be implemented via PAM (I'm > not sure what information is passed to PAM, so you might get the IP > address Doesn't this require all Postgres roles to also be OS users? > but not the application name (the latter can't be trusted > anyway), for example). -- Angular momentum makes the world go 'round.