Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
blog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
blog
Commits
0b14a733
Commit
0b14a733
authored
8 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- Added entry to allow AWS users to change passwords and keys.
parent
a8f01305
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
content/aws_change_own_password.rst
+57
-0
57 additions, 0 deletions
content/aws_change_own_password.rst
content/static/policy.json
+26
-0
26 additions, 0 deletions
content/static/policy.json
with
83 additions
and
0 deletions
content/aws_change_own_password.rst
0 → 100644
+
57
−
0
View file @
0b14a733
Self service AWS IAM policy
###########################
:date: 2016-09-01
:summary: AWS IAM policy to allow users to change their own password and manage
their own keys.
A common practice for me a new member joins the team or when someone forgets
his/ her AWS account password is to change the account password myself, send the
new password over a unsecure channel (email, Slack) but force the account to
change the password on first login. Also, I prefer to have users manage their
own keys to AWS themselves. But without the correct IAM policy users aren't able
to perform either action. Here's an IAM to allow both:
.. code:: json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:GetAccountPasswordPolicy",
"iam:ListAccount*",
"iam:GetAccountSummary",
"iam:GetAccountPasswordPolicy",
"iam:ListUsers"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"iam:ChangePassword",
"iam:*LoginProfile",
"iam:*AccessKey*",
"iam:*SSHPublicKey*"
],
"Resource": "arn:aws:iam::<INSERT AWS ACCOUNT ID HERE>:user/${aws:username}"
}
]
}
If you want a little script with the AWS CLI, here's one for you:
.. code:: shell
tempfile=$(mktemp)
accountid="$(aws ec2 describe-security-groups \
--group-names 'Default' \
--query 'SecurityGroups[0].OwnerId' \
--output text)"
curl https://www.shore.co.il/blog/static/policy.json | sed "s/<INSERT AWS ACCOUNT ID HERE>/$accountid/" > $tempfile
aws iam create-policy \
--policy-name change-own-password \
--policy-document file://$tempfile
rm $tempfile
This diff is collapsed.
Click to expand it.
content/static/policy.json
0 → 100644
+
26
−
0
View file @
0b14a733
{
"Version"
:
"2012-10-17"
,
"Statement"
:
[
{
"Effect"
:
"Allow"
,
"Action"
:
[
"iam:GetAccountPasswordPolicy"
,
"iam:ListAccount*"
,
"iam:GetAccountSummary"
,
"iam:GetAccountPasswordPolicy"
,
"iam:ListUsers"
],
"Resource"
:
"*"
},
{
"Effect"
:
"Allow"
,
"Action"
:
[
"iam:ChangePassword"
,
"iam:*LoginProfile"
,
"iam:*AccessKey*"
,
"iam:*SSHPublicKey*"
],
"Resource"
:
"arn:aws:iam::<INSERT AWS ACCOUNT ID HERE>:user/${aws:username}"
}
]
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment