-
Notifications
You must be signed in to change notification settings - Fork 471
IAM doc updates #7061
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
Merged
Merged
IAM doc updates #7061
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8efdbfa
Alter role sql diagram
Amruta-Ranade cc74ffc
Added alter role doc + root password updates + misc updates
Amruta-Ranade bbebc02
password null + misc updates
Amruta-Ranade 3066a32
WIP changes
Amruta-Ranade 0d33bbc
nologin and password validity
Amruta-Ranade 976a4f3
added content for createrole
Amruta-Ranade 57ec534
added content for grant zoneconfig
Amruta-Ranade 67f772d
Fixed broken links
Amruta-Ranade 9106450
Worked on Richard's comments
Amruta-Ranade 7a0468d
Working on review comments
Amruta-Ranade b1ae687
Username updates
Amruta-Ranade a3ef602
Worked on Jesse's comments
Amruta-Ranade fc2ccc6
Fixed broken links + minor updates
Amruta-Ranade 6fd3917
broken links
Amruta-Ranade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<div><svg width="751" height="81"> | ||
<polygon points="9 17 1 13 1 21"></polygon> | ||
<polygon points="17 17 9 13 9 21"></polygon> | ||
<rect x="31" y="3" width="62" height="32" rx="10"></rect> | ||
<rect x="29" y="1" width="62" height="32" class="terminal" rx="10"></rect> | ||
<text class="terminal" x="39" y="21">ALTER</text> | ||
<rect x="133" y="3" width="56" height="32" rx="10"></rect> | ||
<rect x="131" y="1" width="56" height="32" class="terminal" rx="10"></rect> | ||
<text class="terminal" x="141" y="21">ROLE</text> | ||
<rect x="133" y="47" width="56" height="32" rx="10"></rect> | ||
<rect x="131" y="45" width="56" height="32" class="terminal" rx="10"></rect> | ||
<text class="terminal" x="141" y="65">USER</text> | ||
<rect x="249" y="35" width="34" height="32" rx="10"></rect> | ||
<rect x="247" y="33" width="34" height="32" class="terminal" rx="10"></rect> | ||
<text class="terminal" x="257" y="53">IF</text> | ||
<rect x="303" y="35" width="70" height="32" rx="10"></rect> | ||
<rect x="301" y="33" width="70" height="32" class="terminal" rx="10"></rect> | ||
<text class="terminal" x="311" y="53">EXISTS</text> | ||
<rect x="413" y="3" width="56" height="32"></rect> | ||
<rect x="411" y="1" width="56" height="32" class="nonterminal"></rect> | ||
<text class="nonterminal" x="421" y="21">name</text><a xlink:href="sql-grammar.html#opt_with" xlink:title="opt_with"> | ||
<rect x="509" y="35" width="74" height="32"></rect> | ||
<rect x="507" y="33" width="74" height="32" class="nonterminal"></rect> | ||
<text class="nonterminal" x="517" y="53">opt_with</text></a><a xlink:href="sql-grammar.html#role_options" xlink:title="role_options"> | ||
<rect x="603" y="35" width="100" height="32"></rect> | ||
<rect x="601" y="33" width="100" height="32" class="nonterminal"></rect> | ||
<text class="nonterminal" x="611" y="53">role_options</text></a><path class="line" d="m17 17 h2 m0 0 h10 m62 0 h10 m20 0 h10 m56 0 h10 m-96 0 h20 m76 0 h20 m-116 0 q10 0 10 10 m96 0 q0 -10 10 -10 m-106 10 v24 m96 0 v-24 m-96 24 q0 10 10 10 m76 0 q10 0 10 -10 m-86 10 h10 m56 0 h10 m40 -44 h10 m0 0 h134 m-164 0 h20 m144 0 h20 m-184 0 q10 0 10 10 m164 0 q0 -10 10 -10 m-174 10 v12 m164 0 v-12 m-164 12 q0 10 10 10 m144 0 q10 0 10 -10 m-154 10 h10 m34 0 h10 m0 0 h10 m70 0 h10 m20 -32 h10 m56 0 h10 m20 0 h10 m0 0 h204 m-234 0 h20 m214 0 h20 m-254 0 q10 0 10 10 m234 0 q0 -10 10 -10 m-244 10 v12 m234 0 v-12 m-234 12 q0 10 10 10 m214 0 q10 0 10 -10 m-224 10 h10 m74 0 h10 m0 0 h10 m100 0 h10 m23 -32 h-3"></path> | ||
<polygon points="741 17 749 13 749 21"></polygon> | ||
<polygon points="741 17 733 13 733 21"></polygon></svg></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
--- | ||
title: ALTER ROLE | ||
summary: The ALTER ROLE statement can be used to add or change a role's password. | ||
toc: true | ||
--- | ||
|
||
<span class="version-tag">New in v20.1</span>: The `ALTER ROLE` [statement](sql-statements.html) can be used to add, change, or remove a [role's](create-role.html) password and to change the login privileges for a role. | ||
|
||
{{site.data.alerts.callout_info}} | ||
Since the keywords `ROLE` and `USER` can now be used interchangeably in SQL statements for enhanced Postgres compatibility, `ALTER ROLE` is now an alias for [`ALTER USER`](alter-user.html). | ||
{{site.data.alerts.end}} | ||
|
||
## Considerations | ||
|
||
- Password creation and alteration is supported only in secure clusters. | ||
|
||
## Required privileges | ||
|
||
<span class="version-tag">New in v20.1:</span> To alter other roles, the role must have the [`CREATEROLE`](create-role.html#allow-the-role-to-create-other-roles) parameter set. | ||
|
||
## Synopsis | ||
|
||
<div>{% include {{ page.version.version }}/sql/diagrams/alter_role.html %}</div> | ||
|
||
## Parameters | ||
|
||
<style> | ||
table td:first-child { | ||
min-width: 225px; | ||
} | ||
</style> | ||
|
||
Parameter | Description | ||
----------|------------- | ||
`name` | The name of the role whose password you want to create or add. | ||
`password` | Let the role [authenticate their access to a secure cluster](authentication.html#client-authentication) using this new password. Passwords should be entered as a [string literal](sql-constants.html#string-literals). For compatibility with PostgreSQL, a password can also be entered as an [identifier](#change-password-using-an-identifier). <br><br>To prevent a role from using [password authentication](authentication.html#client-authentication) and to mandate [certificate-based client authentication](authentication.html#client-authentication), [set the password as `NULL`](#prevent-a-role-from-using-password-authentication). | ||
`VALID UNTIL` | The date and time (in the [`timestamp`](timestamp.html) format) after which the password is not valid. | ||
`LOGIN`/`NOLOGIN` | The `LOGIN` parameter allows a role to login with one of the [client authentication methods](authentication.html#client-authentication). [Setting the parameter to `NOLOGIN`](#change-login-privileges-for-a-role) prevents the role from logging in using any authentication method. | ||
`CREATEROLE`/`NOCREATEROLE` | Allow or disallow the role to create, alter, and drop other roles. <br><br>By default, the parameter is set to `NOCREATEROLE` for all non-admin and non-root roles. | ||
|
||
## Examples | ||
|
||
### Change password using a string literal | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl WITH PASSWORD 'ilov3beefjerky'; | ||
~~~ | ||
~~~ | ||
ALTER ROLE 1 | ||
~~~ | ||
|
||
### Change password using an identifier | ||
|
||
The following statement changes the password to `ilov3beefjerky`, as above: | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl WITH PASSWORD ilov3beefjerky; | ||
~~~ | ||
|
||
This is equivalent to the example in the previous section because the password contains only lowercase characters. | ||
|
||
In contrast, the following statement changes the password to `thereisnotomorrow`, even though the password in the syntax contains capitals, because identifiers are normalized automatically: | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl WITH PASSWORD ThereIsNoTomorrow; | ||
~~~ | ||
|
||
To preserve case in a password specified using identifier syntax, use double quotes: | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl WITH PASSWORD "ThereIsNoTomorrow"; | ||
~~~ | ||
|
||
### Set password validity | ||
|
||
The following statement sets the date and time after which the password is not valid: | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl VALID UNTIL '2021-01-01'; | ||
~~~ | ||
|
||
### Prevent a role from using password authentication | ||
|
||
The following statement prevents the role from using password authentication and mandates certificate-based client authentication: | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl WITH PASSWORD NULL; | ||
~~~ | ||
|
||
### Change login privileges for a role | ||
|
||
The following statement prevents the role from logging in with any [client authentication method](authentication.html#client-authentication): | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl NOLOGIN; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> SHOW ROLES; | ||
~~~ | ||
|
||
~~~ | ||
username | options | member_of | ||
-----------+------------+------------ | ||
admin | CREATEROLE | {} | ||
carl | NOLOGIN | {} | ||
root | CREATEROLE | {admin} | ||
(3 rows) | ||
~~~ | ||
|
||
The following statement allows the role to log in with one of the client authentication methods: | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl LOGIN; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> SHOW ROLES; | ||
~~~ | ||
|
||
~~~ | ||
username | options | member_of | ||
-----------+------------+------------ | ||
admin | CREATEROLE | {} | ||
carl | | {} | ||
root | CREATEROLE | {admin} | ||
(3 rows) | ||
~~~ | ||
|
||
### Allow the role to create other roles | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> SHOW ROLES; | ||
~~~ | ||
|
||
~~~ | ||
username | options | member_of | ||
-----------+------------+------------ | ||
admin | CREATEROLE | {} | ||
carl | | {} | ||
root | CREATEROLE | {admin} | ||
(3 rows) | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> ALTER ROLE carl with CREATEROLE; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
> SHOW ROLES; | ||
~~~ | ||
|
||
~~~ | ||
username | options | member_of | ||
-----------+------------+------------ | ||
admin | CREATEROLE | {} | ||
carl | CREATEROLE | {} | ||
root | CREATEROLE | {admin} | ||
(3 rows) | ||
~~~ | ||
|
||
|
||
## See also | ||
|
||
- [`DROP ROLE`](drop-role.html) | ||
- [`SHOW ROLES`](show-roles.html) | ||
- [`GRANT <privileges>`](grant.html) | ||
- [`SHOW GRANTS`](show-grants.html) | ||
- [Create Security Certificates](cockroach-cert.html) | ||
- [Other SQL Statements](sql-statements.html) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just including it here since this line doesn't show in the diff, but theres a block stating
Can you update this to say
the ALTER USER statement to add or change a users password and role options