Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

greedy52
Copy link
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
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
Copy link

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

Copy link

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

@Tener
Copy link
Contributor

Tener commented Jan 28, 2025

Should we merge this one?

Copy link

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
40 of 41 checks passed
@greedy52 greedy52 deleted the STeve/docs/postgres_auto_user_update branch January 30, 2025 18:04
@public-teleport-github-review-bot

@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
`rds_superuser` role for RDS databases.

For improved security through the principle of least privilege, you can also
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
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
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
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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants