ark

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2018 License: MIT Imports: 14 Imported by: 0

README

Aws rotate keys Build Status

A very simple script to rotate access & secret keys in AWS. Please see the app folder to see more application command.

This script do theese :

  • use Lambda function to rotate the secret & access keys and store it to parameter store
  • get the latest and active secret & access keys from parameter store and save it local $HOME/.gradle/gradle.properties

To see more details go to the app and read the README.md file for each application.

Documentation

Index

Constants

View Source
const (
	MaxIAMUser = 2
	Active     = "Active"
	Inactive   = "Inactive"
	TypeSecure = "SecureString"

	//key for parameter store
	AccessReaderPathKey = "/bei/developers/s3read/access"
	SecretReaderPathKey = "/bei/developers/s3read/secret"
	GradleDir           = "/.gradle/"

	// accessKey and secretKey for map
	AccessKey = "accessKey"
	SecretKey = "secretKey"

	// for storing to env variable
	AWS_ACCESS_KEY_ID     = "AWS_ACCESS_KEY_ID"
	AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"
	AWS_SESSION_TOKEN     = "AWS_SESSION_TOKEN"
)

Variables

This section is empty.

Functions

func CreateNewAccessKey

func CreateNewAccessKey(sess *session.Session, userName string) (*iam.AccessKey, error)

Create new access/secret keys following the best practice AWS

func CreateSession

func CreateSession(region string) (*session.Session, error)

create session specific region

func CreateSessionWithProfile

func CreateSessionWithProfile(region string, profile string) (*session.Session, error)

func GetValueFromParameterStore

func GetValueFromParameterStore(svc *ssm.SSM, keyName string, decrypt bool) (*ssm.GetParameterOutput, error)

get the keys from parameter store

func RetriveKeys

func RetriveKeys(sess *session.Session)

func SetEnvVariableAWS

func SetEnvVariableAWS(accessKey, secretKey, tokenKey string) error

func StoreKeys

func StoreKeys(sess *session.Session, accessKey *iam.AccessKey) error

Store the keys to parameter store the key is /bei/developers/s3read/access for access key the key is /bei/developers/s3read/secret for secret key to make things easier in the future, the key should be access like a path

func UpdateGradleProperties

func UpdateGradleProperties(configKey map[string]string, accessKeyId string, secretKey string) error

NOTE : be aware if gradle.properties file size too large it will return an error

Types

type Receiver

type Receiver struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
app
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL