oriolrius.cat

Des del 2000 compartiendo sobre…

Podcast 2×04: SSH avançat

Reading time: 53 – 88 minutes

El podcast

[display_podcast]

Notes sobre el podcast

  • -L: connecta per SSH a un HOST Un cop allà obre una connexió TCP a un altre HOST:PORT i obre un port TCP local que al connectar-hi ens envia al HOST:PORT anteriors, o sigui, portforwarding.
    • -L [bind_address:]port:host:hostport]
  • -W: connecta per SSH a un HOST un cop allà obre una connexió TCP a un altre HOST:PORT i ens retorna a la stdin/stdout el contingut d’aquest darrer enllaç TCP
    • -W host:hostport
  • -R publicar un port: connecta per SSH a un host i un cop allà publica un port TCP, quan un client es connecta a aquest port TCP accedeix per SSH a la màquina que ha llença l’enllaç SSH i obre un altre enllaç TCP a una altre IP:PORT.
    • -R[bind_address:]port:host:hostport
  • -D socks5: connecta per SSH a un HOST i després publica un port SOCKS5/TCP, és a dir, que podem connectar a aquest port local i sortir a internet a través de la IP del HOST on hem connectat per SSH
    • -D [bind_address:]port
  • -w tunel: connecta per SSH a un HOST i el socket que s’ha usat per fer l’enllaç SSH es connecta a dues interficies de tipus TUN, una a cada extrem del socket. Així doncs, si configurem les corresponents IPs a les interficies TUN tenim un tunel/VPN montada entre els extrems.
    • -w local_tun[:remote_tun]

HPN-SSH

La web de: HPN-SSH -> especialment interessant: Dynamic Windows and None Cipher

  • treballa amb mida de finestra dinàmica
  • treballa sense xifrat quan un enllaç no té terminal associat, sovint usat per pas de fitxers

Les proves:

  • Openssh 5.3p1 + hpn-13 (només el patch: Dynamic Windows and None Cipher)
  • després d’aplicar el patch: openssh5.3-dynwindow_noneswitch.diff.gz
  • modifiquem el fitxer: sshconnect2.c
    linia: 366
    - if (!tty_flag) /* no null on tty sessions */
    + if (1) /* no null on tty sessions */

  • així podem fer SSH sense xifrar només després d’haver fet el login.

exemple ampla de banada d’un SSH amb xifrat aes128-ctr, usant finestra dinàmica:

scp -v -oNoneEnabled=no -oNoneSwitch=yes fitxer root@127.0.0.1:/tmp/ssh
o
ssh -v -oNoneEnabled=no -oNoneSwitch=yes root@127.0.0.1 "dd if=/dev/zero"|pv > /dev/null

velocitat de transferència:  <strong>13.7MB/s</strong>
  • debug ciphers, una única negociació de ciphers:
debug1: AUTH STATE IS 0
debug1: REQUESTED ENC.NAME is '<strong>aes128-ctr</strong>'
debug1: kex: server-><strong>client</strong> aes128-ctr hmac-md5 none
debug1: REQUESTED ENC.NAME is '<strong>aes128-ctr</strong>'
debug1: kex: client-><strong>server</strong> aes128-ctr hmac-md5 none

exemple sense xifrat, usant finestra dinàmica:

scp -v -oNoneEnabled=yes -oNoneSwitch=yes fitxer root@127.0.0.1:/tmp/ssh
o
ssh -v -oNoneEnabled=yes -oNoneSwitch=yes root@127.0.0.1 "dd if=/dev/zero"|pv > /dev/null

velocitat de transferència:  <strong>37.4MB/s</strong>
  • abans del pass de login:
debug1: <strong>AUTH</strong> STATE IS <strong>0</strong>
debug1: REQUESTED ENC.NAME is '<strong>aes128-ctr</strong>'
debug1: kex: server-><strong>client</strong> aes128-ctr hmac-md5 none
debug1: REQUESTED ENC.NAME is '<strong>aes128-ctr</strong>'
debug1: kex: client-><strong>server</strong> aes128-ctr hmac-md5 none
  • després d’autenticar-se:
debug1: <strong>AUTH</strong> STATE IS <strong>1</strong>
debug1: REQUESTED ENC.NAME is '<strong>none</strong>'
debug1: Requesting NONE. Authflag is 1
debug1: None requested post authentication.
debug1: kex: server-><strong>client</strong> none hmac-md5 none
debug1: REQUESTED ENC.NAME is '<strong>none</strong>'
debug1: Requesting NONE. Authflag is 1
debug1: None requested post authentication.
debug1: kex: client-><strong>server</strong> none hmac-md5 none

Últimas entradas

Resumen 2023

Reading time: 14 – 22 minutes El 2023 comenzó con una sensación de renovación y optimismo. Tras un período marcado

Leer más »
Archivo
Scroll to Top