Git Product home page Git Product logo

aws-auth-refresher's Introduction

aws-auth-refresher

Makes it easier to use AWS EKS with temporary AWS IAM users.

Motivation

Authentication in AWS EKS works only with a fixed, well-known set of AWS IAM users (and roles). This makes it hard to use temporary, dynamically-created users/security credentials (such as when using Vault), with AWS EKS. aws-auth-refresher makes it possible to define kube-system/aws-auth in terms of regular expressions (see the example). It periodically matches these regular expressions against existing AWS IAM users, and updates the kube-system/aws-auth ConfigMap accordingly.

Prerequisites

  • The iam:ListUsers permission attached to your AWS EKS worker nodes.

Installing

To install aws-auth-refresher, start by running

$ kubectl apply -f deploy/common.yaml
serviceaccount/aws-auth-refresher created
role.rbac.authorization.k8s.io/aws-auth-refresher created
rolebinding.rbac.authorization.k8s.io/aws-auth-refresher created

Then, run

kubectl apply -f deploy/deployment.yaml
deployment.apps/aws-auth-refresher created

and make sure that aws-auth-refresher is indeed running:

kubectl -n kube-system get pod -l app=aws-auth-refresher
NAME                                  READY   STATUS    RESTARTS   AGE
aws-auth-refresher-566cb9bf88-vdj46   1/1     Running   0          2s

Example

To configure aws-auth-refresher, create an aws-auth-refresher ConfigMap in the kube-system namespace with a content similar to the following:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth-refresher
  namespace: kube-system
data:
  mapUsers: |
    - arnRegex: ^arn:aws:iam::1234567890:user/tmp-foo-.*$
      username: foo
      groups:
      - system:masters
    - arnRegex: ^arn:aws:iam::1234567890:user/tmp-bar-.*$
      username: bar
      groups:
      - developers

Given this configuration, and assuming only the tmp-foo-one AWS IAM user initially exists, aws-auth-refresher will update kube-system/aws-auth with the following content:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth-refresher
  namespace: kube-system
data:
  mapUsers: |
    - userarn: arn:aws:iam::1234567890:user/tmp-foo-one
      username: foo
      groups:
      - system:masters

Then, assuming tmp-bar-one and tmp-bar-two get created some time after this, aws-auth-refresher will update kube-system/aws-auth with the following content:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth-refresher
  namespace: kube-system
data:
  mapUsers: |
    - userarn: arn:aws:iam::1234567890:user/tmp-foo-one
      username: foo
      groups:
      - system:masters
    - userarn: arn:aws:iam::1234567890:user/tmp-bar-one
      username: bar
      groups:
      - developers
    - userarn: arn:aws:iam::1234567890:user/tmp-bar-two
      username: bar
      groups:
      - developers

When the tmp-foo-one and tmp-bar-two AWS IAM users get deleted, aws-auth-refresher will update kube-system/aws-auth with the following content:

apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth-refresher
  namespace: kube-system
data:
  mapUsers: |
    - userarn: arn:aws:iam::1234567890:user/tmp-bar-one
      username: bar
      groups:
      - developers

License

Copyright 2019 Form3 Financial Cloud

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

aws-auth-refresher's People

Contributors

bmcustodio avatar jeeves-form3 avatar stevo-f3 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ik-terraform

aws-auth-refresher's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.