Code Monkey home page Code Monkey logo

manage-ssh-users-via-iam's Introduction

Manage SSH users via IAM

When this script is called with the parameter to deploy new users it will:

  1. Retrieve a list of IAM users which are member of a group. This group should be named as '<aws_alias>_ssh'
  2. Download the available SSH keys from IAM (available in the console under CodeCommit deploy keys)
  3. Create a local group on the instance
  4. Create local users on the instance
  5. Write downloaded SSH keys to ~/.ssh/authorized_keys for each user
  6. Configure sudo to allow root-access for the users

This script can be run periodically. It will execute the steps above, but also would locallly delete users which are deleted in IAM.

When this script is called with the parameter to undeploy new users it will:

  1. Delete all users which are member of the group
  2. Delete the group

There is a filter to prevent deletion of certain system users.

Requirements

Python packages

$ sudo pip install -r requirements.txt

EC2 resource

This script is written to be used on an EC2 instance. This instance must launched with an instance role and a proper policy attached to make API calls to IAM.

Deploying users

$ sudo ./src/sync_users.py start

Undeploying users

$ sudo ./src/sync_users.py stop

TODO

  • Create deployable packages
  • Provide initscripts, cronjobs, etc.
  • Allow cross-account IAM access

manage-ssh-users-via-iam's People

Contributors

sgzijl avatar steynovich avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

abhinav-badola

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.