Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKPCJ-0001Oo-3G for pgsql-admin@arkaria.postgresql.org; Tue, 24 Jan 2023 19:43:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pKPCG-00041B-Ph for pgsql-admin@arkaria.postgresql.org; Tue, 24 Jan 2023 19:43:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKPCG-00040o-EV for pgsql-admin@lists.postgresql.org; Tue, 24 Jan 2023 19:43:08 +0000 Received: from mx1.hexon-is.nl ([82.148.219.134]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pKPCB-0001yv-Ar for pgsql-admin@lists.postgresql.org; Tue, 24 Jan 2023 19:43:05 +0000 Received: from webmail.hexon.nl (liming.hexon-is.nl [10.41.1.21]) (authenticated bits=0) by mx1.hexon-is.nl (8.15.2/8.15.2/Debian-18) with ESMTPA id 30OJgwlK1204322 for ; Tue, 24 Jan 2023 20:42:58 +0100 MIME-Version: 1.0 Date: Tue, 24 Jan 2023 20:42:58 +0100 From: Jille Timmermans To: pgsql-admin@lists.postgresql.org Subject: pgperms: Declarative / config as code for PostgreSQL permissions User-Agent: Roundcube Webmail/1.4.8 Message-ID: <94e773aa6934b303dfce44c0ee46c744@quis.cx> X-Sender: jille@quis.cx Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Hexon-MailScanner-ID: 30OJgwlK1204322 X-Hexon-MailScanner: Found to be clean X-Hexon-MailScanner-From: jille@quis.cx X-Hexon-MailScanner-Watermark: 1675194179.0124@ZRBcDVMLh+87aTHQZS5Tew List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hey all, I wrote a tool that can manage PostgreSQL permissions from a config file. The config file describes your desired roles and grants and syncs them to your PostgreSQL cluster. This allows you to manage your permissions in Git, for example. You can find detailed instructions and the binaries at https://github.com/SnoozeThis-org/pgperms. Here's some example config to show its features: > roles: > yourname: > password: SCRAM-SHA-256$4096:... > createdb: true > databases: > - mydatabase > schemas: > - mydatabase.myschema > database_privileges: > - roles: [yourname] > privileges: [CONNECT, TEMPORARY] > databases: [mydatabase] > schema_privileges: > - roles: [yourname] > privileges: [CREATE, USAGE] > schemas: [mydatabase.myschema] > table_privileges: > - roles: [yourname] > privileges: [SELECT, INSERT, UPDATE] > tables: [mydatabase.otherschema.*] Let me know if you find any bugs or need any missing features. It'd be great to hear people find this useful :) -- Jille Development of pgperms is sponsored by SnoozeThis: a bot that can hold on to your blocked issues until they're actionable (https://www.snoozethis.com).