Last active
July 14, 2019 23:31
-
-
Save drAlberT/b7410358beaa74e5b57382c5aecc173c to your computer and use it in GitHub Desktop.
Revisions
-
drAlberT revised this gist
Jul 14, 2019 . 1 changed file with 2 additions and 6 deletions.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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,7 @@ #!/bin/bash # A shell script to help getting SAML credentials into `~/.aws/credentials` # Login URL https://sts.asdasd.com/adfs/ls/idpinitiatedsignon.aspx?loginToRp=urn:amazon:webservices LSE_AWS_ACCOUNT=0123456789 LSE_AWS_ROLE="asdasdasd-role" @@ -23,5 +21,3 @@ aws sts assume-role-with-saml \ /SessionToken/{ print "aws_session_token = " $2 } END { print "\n" } ' -
drAlberT revised this gist
Jul 14, 2019 . 1 changed file with 1 addition and 1 deletion.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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # A shell script to help getting SAML credentials into `~/.aws/credentials` ``` #!/bin/bash # Login URL https://sts.lseg.com/adfs/ls/idpinitiatedsignon.aspx?loginToRp=urn:amazon:webservices -
drAlberT revised this gist
Jul 14, 2019 . 1 changed file with 5 additions and 0 deletions.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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ # A shell script to help getting SAML credentials into `~/.aws/credentials` ```shell #!/bin/bash # Login URL https://sts.lseg.com/adfs/ls/idpinitiatedsignon.aspx?loginToRp=urn:amazon:webservices @@ -20,3 +23,5 @@ aws sts assume-role-with-saml \ /SessionToken/{ print "aws_session_token = " $2 } END { print "\n" } ' ``` -
drAlberT revised this gist
Jul 14, 2019 . 1 changed file with 22 additions and 0 deletions.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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/bin/bash # Login URL https://sts.lseg.com/adfs/ls/idpinitiatedsignon.aspx?loginToRp=urn:amazon:webservices LSE_AWS_ACCOUNT=0123456789 LSE_AWS_ROLE="asdasdasd-role" LSE_AWS_PROFILE="asdasd-saml" LSE_SAML_PROVIDER="STS.ASDASD.COM" LSE_SAML_RESPONSE="PHNhbWxwOlJlc3 [..] vbnNlPg==" aws sts assume-role-with-saml \ --role-arn "arn:aws:iam::${LSE_AWS_ACCOUNT}:role/${LSE_AWS_ROLE}" \ --principal-arn "arn:aws:iam::${LSE_AWS_ACCOUNT}:saml-provider/${LSE_SAML_PROVIDER}" \ --saml-assertion "${LSE_SAML_RESPONSE}" \ | awk -F: ' BEGIN { RS = "[,{}]"; print "['${LSE_AWS_PROFILE}']"} /:/{ gsub(/"/, "", $2) } /AccessKeyId/{ print "aws_access_key_id = " $2 } /SecretAccessKey/{ print "aws_secret_access_key = " $2 } /SessionToken/{ print "aws_session_token = " $2 } END { print "\n" } ' -
drAlberT revised this gist
Jul 14, 2019 . 1 changed file with 1 addition and 1 deletion.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 charactersOriginal file line number Diff line number Diff line change @@ -4,5 +4,5 @@ _allow only RFC 1918 classes, excluding localhost and being between /16 and /28_ ``` AllowedPattern: '^(?:10\.(?:25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})|172\.(?:1[6-9]|2[0-9]|3[0-1])|192\.168)(?:\.(?:25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){2}/(?:2[0-8]|1[6-9])$' ``` -
drAlberT revised this gist
Jul 14, 2019 . 1 changed file with 2 additions and 2 deletions.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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # A collection of usefull regexp ### Validate AWS CloudFormation CIDR Blocks (VPC and subnets) _allow only RFC 1918 classes, excluding localhost and being between /16 and /28_ ``` -
drAlberT created this gist
Jul 14, 2019 .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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ # Validation regular expressions for common AWS resources ## CIDR Blocks (VPC and subnets) _allow only RFC 1918 classes, excluding localhost and being between /16 and /28_ ``` AllowedPattern: '^(?:10\\.(?:25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})|172\\.(?:1[6-9]|2[0-9]|3[0-1])|192\\.168)(?:\\.(?:25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){2}/(?:2[0-8]|1[6-9])$' ```