Peculiar SSH(1) · [email protected], \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \...

64
Peculiar SSH(1)

Transcript of Peculiar SSH(1) · [email protected], \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \...

Page 1: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Peculiar SSH(1)

Page 3: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Raise your hand!

Page 4: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Peculiar SSH(1)Somewhat advanced SSH things…

Page 5: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

From Zero to Hero*ineToday 16:00 - 18:00

Room: PUPINSSH beginners’ workshop

with Hetti and MacLemon

Page 6: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

SSH(1)

Works on

my machine!101%

Page 7: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Two-Factor Authentication

Page 9: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.
Page 10: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.
Page 11: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.
Page 12: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Time base One-Time Pads

Page 13: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.
Page 14: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Time-Based One-Time Password Algorithm

RFC 6238

Page 15: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.
Page 16: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.
Page 17: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

HOTP: An HMAC-Based One-Time Password Algorithm

RFC 4226

Page 18: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

AuthenticationMethods publickey, publickey, keyboard-interactive:pam

ChallengeResponseAuthentication yes

Page 19: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Crypto Configkex, mac, key, key-plain, key-cert, cipher, cipher-auth

Page 20: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Crypto Configkex, mac, key, key-plain, key-cert, cipher, cipher-auth

Ideal WorldEdition2017

Page 21: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Server HostKey

Page 22: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

/etc/sshd_config

# HostKey /etc/ssh/ssh_host_rsa_key# HostKey /etc/ssh/ssh_host_ecdsa_key# HostKey /etc/ssh/ssh_host_dsa_key# HostKey /etc/ssh/ssh_host_ed25519_key

Page 23: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

/etc/sshd_config

# HostKey /etc/ssh/ssh_host_rsa_key# HostKey /etc/ssh/ssh_host_ecdsa_key# HostKey /etc/ssh/ssh_host_dsa_keyHostKey /etc/ssh/ssh_host_ed25519_key

Page 24: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

KexAlgorithmsssh -Q kex

Page 26: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

PubkeyAcceptedKeyTypesssh -Q key

Page 27: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Host *

PubkeyAcceptedKeyTypes [email protected], \ ssh-ed25519

Page 28: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

MACsssh -Q mac

Page 30: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Ciphersssh -Q cipher-auth

Page 32: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Bastion Hosts

Page 33: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Host balccon ProxyJump jumpjump

Host jumpjump […]

Page 34: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Host balccon ProxyJump krisskross,jumpjump

Page 35: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

$ ssh -J krisskross,jumpjump balccon

Page 36: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Legacy SystemsThe real world

Page 37: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Host vintagebox KexAlgorithms diffie-hellman-group14-sha256 Ciphers aes256-ctr PubkeyAcceptedKeyTypes ssh-rsa MACs [email protected]

Page 38: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

DebuggingY U NO CONNECT?

Page 39: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh -G <Host>Applied config directive

Page 40: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh vintageboxUnable to negotiate with 203.0.113.17 port 2017: no matching cipher found. Their offer: aes256-ctr, aes128-ctr

Page 41: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

# Setting defaultsHost * Ciphers [email protected]

Host vintagebox Ciphers aes256-ctr

Page 42: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh vintagebox -G | grep ciphersciphers [email protected]

Page 43: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

# Setting defaultsHost * Ciphers [email protected]

Host vintagebox Ciphers +aes256-ctr

Page 44: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh vintagebox -G | grep ciphers

ciphers [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc

Page 45: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Host vintagebox Ciphers aes256-ctr

# Setting directives not already set!Host * Ciphers [email protected]

Page 46: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh vintagebox -G | grep ciphers

aes256-ctr

Page 47: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh -v <Host>verbosity, up to -vvv

Page 48: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

$ ssh example.maclemon.at -v

OpenSSH_7.4p1, LibreSSL 2.5.0debug1: Reading configuration data /Users/MacLemon/.ssh/configdebug1: /Users/MacLemon/.ssh/config line 3: Applying options for *debug1: /Users/MacLemon/.ssh/config line 500: Applying options for mirrordebug1: /Users/MacLemon/.ssh/config line 1198: Applying options for *debug1: /Users/MacLemon/.ssh/config line 1228: Deprecated option "useroaming"debug1: Reading configuration data /etc/ssh/ssh_configdebug1: UpdateHostKeys=ask is incompatible with ControlPersist; disablingdebug1: auto-mux: Trying existing masterdebug1: Requesting forwarding of local forward LOCALHOST:16901 -> 127.0.0.1:16901debug1: mux_client_request_session: master session id: 12Last login: Sat Sep 16 11:48:08 2017 from 82.117.211.154

Page 49: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh_scanhttps://github.com/mozilla/ssh_scan

Page 50: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

ssh_scan installation

Page 51: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

gem install ssh_scan

Page 52: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

git clone https://github.com/mozilla/ssh_scan.git

cd ssh_scan

gem install bundlerbundle install

Page 53: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

./ssh_scan -t example.maclemon.at -p 2017

Page 54: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

[ { "ssh_scan_version": "0.0.27", "ip": "203.0.113.17", "hostname": "example.maclemon.at", "port": 2017, "server_banner": "SSH-2.0-OpenSSH_5.2", "ssh_version": 2.0, "os": "unknown", "os_cpe": "o:unknown", "ssh_lib": "openssh", "ssh_lib_cpe": "a:openssh:openssh:5.2", "key_algorithms": [ "diffie-hellman-group-exchange-sha256", "diffie-hellman-group-exchange-sha1",

Page 55: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

"compliance": { "policy": "Mozilla Modern", "compliant": false, "recommendations": [ "Add these key exchange algorithms: [email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256", "Add these MAC algorithms: [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,[email protected]", "Add these encryption ciphers:

Page 56: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

"grade": "F"

Page 57: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

The Future…OpenSSH 7.5+

Page 58: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

RC4, BlowfishRIPE-MD160

Page 59: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

RSA < 1.024bits

Page 60: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

CBC mode ciphers

Page 61: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

You have been warned!

Page 62: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

Questions?

Page 63: Peculiar SSH(1) · ssh-ed25519-cert-v01@openssh.com, \ ssh-ed25519. MACs ssh -Q mac. Host * MACs \ hmac-sha2-512-etm@openssh.com, \ hmac-sha2-256-etm@openssh.com. Ciphers ssh -Q cipher-auth.

More questions……over a beverage!