Ohio LinuxFest
2020Nov06 @ 12.15 ET (17:15 UTC)
Online
der.hans
CDE
Object Rocket, a rackspace company
https://www.ObjectRocket.com/
Yes, we’re hiring :)
ObjectRocket
https://www.objectrocket.com/careers/
Rackspace Technologies
https://rackspace.jobs/
Basic SSH usage
Filesystem permissions required by SSH
Basic SSH key and fingerprint usage
SSH == Secure SHell
OpenSSH is an OpenBSD project
Essential tool for system administrators and DevOps
Creates secure, authenticated, encrypted connections between computers
Allows passing data across encrypted TCP connections
Requires an account on the remote computer
ssh -p 22 remote.example.com
ssh -L 2222:firewall.example.com:22 firewall.example.com
ssh -p 2222 localhost
ssh -L 2222:firewall.example.com:22 firewall.example.com
ssh -p 2222 localhost
scp -P 2222 -pr dir_to_sync localhost:
host1$ ssh -R 2222:host2.example.com:22 host2.example.com
host2$ ssh -p 2222 localhost
host1$ ssh -R 2222:host2.example.com:22 host2.example.com
host1$ ssh -R 2222:localhost:22 host2.example.com
ssh -N -f -L 3306:db.example.com:3306 firewall.example.com
$ grep 3306 /etc/services
mysql 3306/tcp
mysql 3306/udp
desktop ⇐===encrypted===⇒ firewall ←---UNencrypted---→ internalserver
ssh -D 1080 firewall.example.com
Tip
|
FoxyProxy |
See Nixie Pixel video in references
host1$ ssh -L 3333:firewall.example.com:3333 -R 2222:firewall.example.com:22 firewall.example.com
host2$ ssh -L 2222:firewall.example.com:2222 -R 3333:firewall.example.com:22 firewall.example.com
host1$ ssh -L 3333:localhost:3333 -R 2222:localhost:22 firewall.example.com
host2$ ssh -L 2222:localhost:2222 -R 3333:localhost:22 firewall.example.com
laptop$ ssh -Y desktop.example.com
desktop$ firefox -new-instance -ProfileManager presentation
desktop$ ssh -Y vm.example.com
vm$ firefox -new-instance -ProfileManager javascriptIsDangerous
ssh-keygen -f .ssh/id_new
authorized_keys
ssh-copy-id
ssh -N -f -L 3306:db.example.com:3306 firewall.example.com
mysql -h localhost -p 3306 --protocol=TCP
mysql -h 127.0.0.1
ssh -L 2143:imap.example.com:143 -L 2993:imap.example.com:993 -L 2025:smtp.example.com:25 firewall.example.com
ssh -L 8080:www.example.com:80 firewall.example.com
links -http.extra-header "Host: www.example.com" http://localhost:8080/
ssh -D 1080 firewall.example.com
FoxyProxy
.
A ;
| ,--,-/ \---,-/| ,
_|\,'. /| /| `/|-.
\`.' /| , `;.
,'\ A A A A _ /| `.;
,/ _ A _ / _ /| ;
/\ / \ , , A / / `/|
/_| | _ \ , , ,/ \
// | |/ `.\ ,- , , ,/ ,/ \/
/ @| |@ / /' \ \ , > /| ,--.
|\_/ \_/ / | | , ,/ \ ./' __:..
| __ __ | | | .--. , > > |-' / `
,/| / ' \ | | | \ , | /
/ |<--.__,->| | | . `. > > / (
/_,' \\ ^ / \ / / `. >-- /^\ |
\\___/ \ / / \__' \ \ \/ \ |
`. |/ , , /`\ \ )
\ ' |/ , V \ / `-\
`|/ ' V V \ \.' \_
'`-. V V \./'\
`|/-. \ / \ /,---`\ kat
/ `._____V_____V'
' '
Specify multiple known_hosts files in ~/.ssh/config
For instance, one for normal use, one imported regularly from orchestration
UserKnownHostsFile ~/.ssh/known_hosts ~/.ssh/known_hosts_automagic
Specify per key restictions in authorized_keys entries in ~/.ssh/authorized_keys
Important for keys for automated tasks
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
Force a per key specific command (aka forced command ) in ~/.ssh/authorized_keys
Runs the specified command rather than whatever was requested by the client
command="hostname"
Specify per key network access restrictions in ~/.ssh/authorized_keys
from="localhost,127.0.0.1"
-N == no remote command
-f == background after authentication
ssh -N -f -L 2222:localhost:22 firewall.example.com
-v == verbosity, maximum of 3
-G == show configuration that would be used
-t == force pseudo-terminal
ssh -p 2222 localhost screen -x myScreen
-o == specify any configuration file option on the command line
ssh -o FingerprintHash=md5 firewall.example.com
PS1 : make sure remote prompt has enough information
SSH_AUTH_SOCK
ssh-copy-id
sshfs
rsync
scp now considered dangerous
sftp
autossh
Do not use ssh-keyscan. It does’t verify keys!
ssh firewall.example.com "sudo tar -C /etc cfz -" | tar -C /tmp xfz -
ssh firewall.example.com "ps auxw" | tee /tmp/firewall_ps.txt | less
rsync -e ssh -avHS photos/ mybackupserver:photos/