-
Notifications
You must be signed in to change notification settings - Fork 16
/
SSH.protocol.txt
58 lines (49 loc) · 2.99 KB
/
SSH.protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SSH
Deux versions : SSH1 et SSH2
Port TCP 22.
Client SSH -> daemon (server) SSH
Permet :
- d'exécuter des commandes sur la machine hôte
- de télécharger/uploader des fichiers (via SFTP ou SCP)
- de lire les données provenant d'une socket TCP de l'hôte (dont X ou HTTP)
- de mount une partition sur la machine hôte (SSHFS)
Paquet (d'abord pas chiffré, puis chiffré obligatoirement):
- 4 octets de packet_length (0 à 35000)
- 1 octet de padding_length (>= 4)
- (packet_length - padding_length - 1) octets de data (d'abord pas compressées, puis compressées éventuellement)
- padding_length octets de padding aléatoire
==OPENSSH==
Paquets : openssh-server et openssh-client
OpenSSH : implémentation de SSH sous Unix (sous Windows, c'est PuTTY)
Commandes :
- ssh, se connecter sur un terminal de l'hôte
- sshd, daemon (=~ serveur) associé
- scp, pour SCP
- stfp, pour SFTP
- sftp-server, serveur associé
- ssh-keygen, générateur de clefs asymétriques
- ssh-keyscan, récupère les clefs publiques d'hôtes
Manières de s'authentifier :
- password
- public-key authentification
- host-based (public keys)
- keyboard-interactive (challenge-response)
- Kerberos
ssh [USER@]HOST #Connect to SSH daemon on HOST
#Will ask for password if current public key is not in server authorized_keys
ssh-keygen #Creates public/private key pairs:
# - ~/.ssh/id_rsa is private key
# Private key is encrypted itself with a passphrase (in case local filesystem is compromised)
# - ~/.ssh/id_rsa.pub is public key
# Can be sent to anyone.
#Public keys on ~/.ssh/authorized_keys are accepted to connect on this machine.
-p #Recreates the pair
ssh-agent $SHELL #Keep passwords (actually decrypted private keys) into memory to avoid retyping them during current
#session.
sshd #SSH daemon, usually:
# - started at startup with /etc/init.d/ssh
# - Can include options with env. var SSHD_OPTS, or by modifying /etc/default/ssh
#Config file is /etc/ssh/sshd_config, reloaded on SIGHUP
-4|6 #Forces only Ipv4|6