Skip to content

[docs] PostgreSQL auto-user provisioning guide minor edits#48897

Merged
greedy52 merged 3 commits intomasterfrom
STeve/docs/postgres_auto_user_update
Jan 30, 2025
Merged

[docs] PostgreSQL auto-user provisioning guide minor edits#48897
greedy52 merged 3 commits intomasterfrom
STeve/docs/postgres_auto_user_update

Conversation

@greedy52
Copy link
Copy Markdown
Contributor

No description provided.

@greedy52 greedy52 added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v16 backport/branch/v17 labels Nov 13, 2024
@greedy52 greedy52 self-assigned this Nov 13, 2024
Comment on lines -78 to -80
<Admonition type="warning" title="Procedure Privileges in PostgreSQL 15+">
(!docs/pages/includes/database-access/auto-user-provisioning/postgres15-grant-create.mdx!)
</Admonition>
Copy link
Copy Markdown
Contributor Author

@greedy52 greedy52 Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GRANT CREATE ON SCHEMA public TO "teleport-admin";

This shouldn't be necessary any more after @gabrielcorado 's change that moved procedures to pg_temp

@greedy52 greedy52 force-pushed the STeve/docs/postgres_auto_user_update branch from ae82c07 to 4e2eb72 Compare November 13, 2024 15:26
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Vercel preview here: https://docs-iyaz50s9n-goteleport.vercel.app/docs/ver/preview

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Vercel preview here: https://docs-8v6382zn6-goteleport.vercel.app/docs/ver/preview

@Tener
Copy link
Copy Markdown
Contributor

Tener commented Jan 28, 2025

Should we merge this one?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 29, 2025

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
STeve/docs/postgres_auto_user_update 879633f 3 ✅SUCCEED steve-docs-postgres-auto-user-update 2025-01-29 19:26:17

@greedy52 greedy52 force-pushed the STeve/docs/postgres_auto_user_update branch from aa05c9d to 879633f Compare January 29, 2025 19:18
@greedy52 greedy52 requested review from r0mant and smallinsky January 30, 2025 17:47
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from smallinsky January 30, 2025 17:51
@greedy52 greedy52 added this pull request to the merge queue Jan 30, 2025
Merged via the queue into master with commit f44af9b Jan 30, 2025
@greedy52 greedy52 deleted the STeve/docs/postgres_auto_user_update branch January 30, 2025 18:04
@public-teleport-github-review-bot
Copy link
Copy Markdown

@greedy52 See the table below for backport results.

Branch Result
branch/v16 Failed
branch/v17 Create PR

greedy52 added a commit that referenced this pull request Jan 31, 2025
* [docs] PostgreSQL auto-user provisioning guide minor edits

* remove admin option from rds_superuser and add note on admin option for each role
assign permissions directly to specific database objects. For example:

```sql
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema1, schema2, schema3 TO "teleport-admin";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update this if the assumption is that they don't have a superuser role: It should be:

- GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema1, schema2, schema3 TO "teleport-admin";
+ GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema1, schema2, schema3 TO "teleport-admin" WITH GRANT OPTION;

Additionally, in light of #51851
the admin will need this:

GRANT ALL PRIVILEGES ON SCHEMA schema1, schema2, schema3 TO "teleport-admin" WITH GRANT OPTION

Or more specifically, the equivalent:

GRANT USAGE, CREATE ON SCHEMA schema1, schema2, schema3 TO "teleport-admin" WITH GRANT OPTION

cc @greedy52

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it may also be useful for non-superuser admins to alter their default permissions like this so that new tables are also supported:

GRANT USAGE, CREATE ON SCHEMA schema1, schema2, schema3 TO "teleport-admin" WITH GRANT OPTION;
GRANT ALL ON ALL TABLES IN SCHEMA schema1, schema2, schema3 TO "teleport-admin" WITH GRANT OPTION;
ALTER DEFAULT PRIVILEGES IN SCHEMA schema1, schema2, schema3 GRANT ALL ON TABLES TO "teleport-admin" WITH GRANT OPTION;

The same can be done for new tables created in all current/new schemas:

ALTER DEFAULT PRIVILEGES GRANT ALL ON TABLES TO "teleport-admin" WITH GRANT OPTION;

And for any new schemas as well:

ALTER DEFAULT PRIVILEGES GRANT USAGE,CREATE ON SCHEMAS TO "teleport-admin" WITH GRANT OPTION;

Copy link
Copy Markdown
Contributor Author

@greedy52 greedy52 Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! let's track these for #51851. why does admin need CREATE on schemas?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this in call but just to write it down: this would just be future proofing so that we can support permission grants for schema objects.

carloscastrojumo pushed a commit to carloscastrojumo/teleport that referenced this pull request Feb 19, 2025
…onal#48897)

* [docs] PostgreSQL auto-user provisioning guide minor edits

* remove admin option from rds_superuser and add note on admin option for each role
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v17 documentation no-changelog Indicates that a PR does not require a changelog entry size/sm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants