Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2VcK-003blj-2D for pgsql-general@arkaria.postgresql.org; Thu, 02 May 2024 12:32:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s2VcG-000KDw-VP for pgsql-general@arkaria.postgresql.org; Thu, 02 May 2024 12:32:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2VcG-000KDJ-I5 for pgsql-general@lists.postgresql.org; Thu, 02 May 2024 12:32:49 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s2VcF-00153o-1A for pgsql-general@postgresql.org; Thu, 02 May 2024 12:32:48 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-2343ae31a9bso3748260fac.1 for ; Thu, 02 May 2024 05:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714653165; x=1715257965; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=tB+ITn7OlNgpwwexG0/wzxuegFTKqIr3MGCd0oB20hI=; b=fyQha8h6JHVfSMxqZaKVwnv6YLWB53Oxe61k6u14+vX+YnO14/cIbEG2WCPbHwSM7m 0DC+hX3361RARWDwuC/EUrtp42JDc9I+vD7DX1XMDRZZCqlS+wQ8ESE2dMAXVlXcgn9R emOwxDqh0YBYIwJWBu2KqK2DtUraIA+xqW3a8+04SsZdVZ9jEduXPfn8uVa713dCUWMq CpoPgRteRVS6Uhow9woRYlldFiy9SDrZgTs4orvrjMcorTuEj3przNoDc3fZq1HKGB7e sHZY9T/GwYm38WpRfzIWzVZCxIve+7jS6geBR9RU0qJUNwA6kS2hIxcPyKWh6OvhSBXj Mn1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714653165; x=1715257965; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tB+ITn7OlNgpwwexG0/wzxuegFTKqIr3MGCd0oB20hI=; b=JrCWCcyJ5gKkD3HWIaUWZLFdKEtJIxQSKznfWnosvC32jOFJyfZo3X7RfmsBY5tsqE 78Kes/ke/zaOVTSP/QNdsWXxWCXUnFlvxoRIgWA2J3tzhlp7WQWxgbosAmNAUe3mduZ8 RmAiwJtrwhT9TE1gEKAlM1gars9rTMlidWM1LGVDEB9OtEd4VpDZ6gQiDvlHozH2f0pp yvGWdLAbOVJNFHO/P/20uFeru4Xpg8FGkYGz85wLlgCadsU+FGT3l3+yop5SrVrwph57 tsSHM5DTOaMaUTA90kWYQwnp2oCWs0m9hU78B3mGH7A39dfLBH5LPynM8mpEOPhRRcsN t+Qg== X-Gm-Message-State: AOJu0YwCwIyew0sezYGm3Dg8FRVPPiXPhVBW/e57Y9h0KfW7xh3oIHja FCISUJHThHyHg3etzbB64aAxGjfQbTkKxAfXQSZjzeCk3Fq5TDEXIbVsmhS0HhZzVVikd2O3ATD OsFAYV+bfjCglIajZwQaC9B1lR27Y3EN1 X-Google-Smtp-Source: AGHT+IF87xJNnSm9IbtFS5UgYzsQOQ/sr1INqieZv3gfw/Jmbyery4q7CEClJFKqm4gYBzQT222P2HNGWUqtPfB5qks= X-Received: by 2002:a05:6870:a3cc:b0:23c:42eb:8787 with SMTP id h12-20020a056870a3cc00b0023c42eb8787mr2040931oak.38.1714653165127; Thu, 02 May 2024 05:32:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Thu, 2 May 2024 08:32:34 -0400 Message-ID: Subject: Re: Prevent users from executing pg_dump against tables To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000d2121d061777cc5c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d2121d061777cc5c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 2, 2024 at 1:47=E2=80=AFAM RAJAMOHAN wr= ote: > Hello all, > > In our production db infrastructure, we have one read_only role which has > read privileges against all tables in schema A. > > We are planning to grant this role to some developers for viewing the > data, but also I want to limit the users from executing statements like > copy or using pg_dump. Main reason being I don't want the data to be copi= ed > from the database to their local machines. > > I tried by implementing triggers, but was not able to figure out a way to > restrict the pg_dump and allow only select statements. > > Is there a way to implement this? Please advise. > > If you can query a table, then you can save the query contents to your local context. That's a fundamental law of nature, since you gave them read privs. For example: psql --host=3DSomeEC2Node $DB -Xc "SELECT * FROM read_only_table;" > read_only_table.txt That even works on Windows. --000000000000d2121d061777cc5c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, May 2, 2024 at 1:47=E2=80=AFAM RA= JAMOHAN <garajamohan@gmail.com<= /a>> wrote: