Socket
Book a DemoInstallSign in
Socket

nc-aws-ssh

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nc-aws-ssh

AWS SSH Client

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Introduction

This tool is used to get a list of dynamic ec2 instances and establish ssh connection to them.

Features

  • Generate ssh command for connection
  • Use bastion for ssh connection (see Jump Hosts)
  • Receive vault otp keys and use them for connection (see SSH Secret Backend -> One-Time-Password)
  • Use multiple aws profiles (see AWS CLI Profiles)

It uses ec2 instance tags to search for metadata, such as available users, vault otp role, vault otp mount point, instance role.

Installation

npm install -g nc-aws-ssh

Setup

AWS

You need to configure your aws profiles and credentials. You can use AWS CLI to manage profile and credentials: Configuration and Credential Files.

  • Environment variables AWS_CONFIG_FILE and AWS_SHARED_CREDENTIALS_FILE supported as well
  • Environment variable AWS_REGION are used to specify aws region fallback, if profile doesn't contain it

Config file ~/.aws/config:

[profile my_awesome_profile]
source_profile = default
role_arn = arn:aws:iam::12345678901:role/OrganizationAccountAccessRole
region = us-west-1
  • my_awesome_profile - profile name that is used as menu point
  • role_arn - arn of aws role, that will be assumed for aws api calls
  • region - aws region for aws api calls (if not specified, fallback to AWS_REGION environment variable is used)
  • source_profile - profile credentials (see below)

Credentials file ~/.aws/credentials:

[default]
aws_access_key_id = YAIAT7G7HEYH7YCQAA5Q
aws_secret_access_key = Hi0ohk8voo6RoTMPbuqdpP/Cpsa3+iekoothiC4

Vault OTP

To use Vault OTP you need to:

  • Use VAULT_ADDR environment variable, e.g. https://vault.example.com
  • Use VAULT_TOKEN environment variable or create ~/.vault-token file that contains vault token (see vault auth)
  • Install sshpass locally.
  • If you use bastion, install sshpass there, and configure ssh server with AllowTcpForwarding on option.

See vault auth (vault auth -method=ldap username=...)

Instances metadata

Tags

Role (tag: role)

If a list of instances contains bastion (role=bastion), it will be used to connect to other instance through bastion, otherwise (if role != bastion) use direct connection.

Users (nc_aws_ssh:users)

A comma-separated list of usernames that can be used to login to the instance (e.g. "ubuntu,visitor")

Vault OTP Role (nc_aws_ssh:vault_otp_role)

Vault ssh otp backend role name. See Vault OTP Role

Vault OTP Mount (nc_aws_ssh:vault_otp_mount)

Vault mount point for ssh otp backend. See Vault OTP Mount

CLI

Dry run

Generate and print to terminal ssh connection command, without executing it:

nc-aws-ssh --dry-run 
# sshpass -p ... ssh -o StrictHostKeyChecking=no  -o ProxyCommand="sshpass -p ... ssh -o StrictHostKeyChecking=no  "ubuntu@172.31.41.148" -W %h:%p" "core@172.31.48.138"

Verbose

To retrieve extended optput, add verbose (-v) option to generated ssh connection command:

nc-aws-ssh --verbose

FAQs

Package last updated on 07 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts