Skip to content

Instantly share code, notes, and snippets.

@JonTheNiceGuy
Last active April 15, 2020 22:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonTheNiceGuy/bd18ad339d52915c56fb6b6230160ce2 to your computer and use it in GitHub Desktop.
Save JonTheNiceGuy/bd18ad339d52915c56fb6b6230160ce2 to your computer and use it in GitHub Desktop.
SSH Key Info
# All subsequent files, prefixed config.d_ should be in the config.d/ directory, so config.d_aws becomes config.d/aws
Include config.d/*
# Note this assumes you're working with the "YOUR-REGION" (should be something like us-east-1)
# Also assumes you have the aws CLI installed.
host i-* mi-*
ProxyCommand sh -c "aws ssm --region YOUR-REGION start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
Host github.com gist.github.com gitlab.com
User git
# Only for use with really legacy gear which MUST LIVE inside your management network!
# Thanks to Stuart (https://yetiops.net/) for these lines of config.
Host *.switch.management.lan
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
# DSA auth *might* be required. If so, generate a DSA key with
# ssh-keygen -t id_dsa
# and use this setting... But if not, comment it out and use RSA or ED25519!
IdentityFile ~/.ssh/id_dsa
# Note that you can have lots of different aliases for the same server in here,
# perhaps if you have a VPS with several DNS names on you might want to put them all in here.
# You can also put wildcards in here :)
Host server.example.com *.server.example.com my_server server
Hostname server.example.com
Port 12345
User someuser
# This provides a direct forward to your internal proxy, from it's port 8080 to your local port 18080
# It also allows you to use a SOCKS proxy, using localhost:1080
Host SomeProxy
Hostname gateway.example.org
User someuser
Port 12345
LocalForward 18080 proxy.example.lan:8080
DynamicForward 1080
Host mail.system.example.org web.system.example.org dns.system.example.org
Port 12345
Host *.system.example.org
User someuser
IdentityFile ~/.ssh/id_ed25519.system.example.org
Host JumpHost
Hostname jumphost.mycorp.example.net
User someuser
Host *.mycorp.example.net
ProxyJump JumpHost
User someuser
# Note that this turns off security on some key things, but if you're connecting to lots of cloud machines, it's useful!
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment