Outils pour utilisateurs

Outils du site


informatique:reseau:ssh

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
informatique:reseau:ssh [17/05/2010 21:03] cyrilleinformatique:reseau:ssh [19/02/2024 10:42] (Version actuelle) – [Proxying] cyrille
Ligne 1: Ligne 1:
-====== Secure SHell ======+====== Secure SHell (SSH) ======
  
 ===== Configuration ===== ===== Configuration =====
  
-Dans /etc/ssh/sshd_config tu change la ligne  +Dans /etc/ssh/sshd_config tu change la ligne 
-  PermitRootLogin Yes  + 
-  en  +<code> 
-  PermitRootLogin No+PermitRootLogin Yes 
 +en 
 +PermitRootLogin No 
 +</code> 
 Et si tu veux autoriser l'accès ssh en root uniquement avec clé ssh tu mets : Et si tu veux autoriser l'accès ssh en root uniquement avec clé ssh tu mets :
-  PermitRootLogin without-password + 
-Mais bon ça marche pas ...+<code> 
 +PermitRootLogin without-password 
 +</code> 
 + 
 +Mais bon ça marche pas 
  
 Voici une config qui fontionne : Voici une config qui fontionne :
-  UsePAM no + 
-  RSAAuthentication yes +<code> 
-  PermitRootLogin without-password +UsePAM no 
-  PermitEmptyPasswords no +RSAAuthentication yes 
-  PasswordAuthentication no +PermitRootLogin without-password 
 +PermitEmptyPasswords no 
 +PasswordAuthentication no 
 +</code> 
 et une autre : et une autre :
-  UsePAM no + 
-  Subsystem sftp /usr/libexec/openssh/sftp-server +<code> 
-  IgnoreRhosts yes +UsePAM no 
-  IgnoreUserKnownHosts no +Subsystem    sftp    /usr/libexec/openssh/sftp-server 
-  PrintMotd yes +IgnoreRhosts yes 
-  StrictModes yes +IgnoreUserKnownHosts no 
-  RSAAuthentication yes +PrintMotd yes 
-  PermitRootLogin no +StrictModes yes 
-  PermitEmptyPasswords no +RSAAuthentication yes 
-  PasswordAuthentication no+PermitRootLogin no 
 +PermitEmptyPasswords no 
 +PasswordAuthentication no 
 +</code> 
 +==== Maintien de la connexion ==== 
 + 
 +<code>ServerAliveInterval 
 +ServerAliveCountMax 
 +</code> 
 + 
 +''ClientAliveInterval'' dit d'envoyer un paquet de vérification toutes les xx secondes (défaut: 0) et ''ClientAliveCountMax'' dit de couper la connexion après x messages sans réponse (défaut: 3) 
  
 ===== Clients ===== ===== Clients =====
  
-==== Clients pour Windows ====+==== ClusterSSH ====
  
-http://www.openssh.com/windows.html \\ +http://sourceforge.net/apps/mediawiki/clusterssh/
-http://www.funix.org/fr/windows/ssh.htm+
  
-SSH Tectia Client (previously SSH Secure Shell for Workstations) :\\ +ClusterSSH is a tool for making the same change on multiple servers at the same timeThe 'cssh' command opens an administration console and an xterm to all specified hostsAny text typed into the administration console is replicated to all windowsAll windows may also be typed into directly. 
-http://www.ssh.com/support/downloads/secureshellwks/non-commercial.html+ 
 +This tool is intended for (but not limited to) cluster administration where the same configuration or commands must be run on each node within the cluster. Performing these commands all at once via this tool ensures all nodes are kept in sync.  
 + 
 + 
 +==== Clients pour Windows ====
  
 Tunnelier : http://www.bitvise.com/tunnelier.html Tunnelier : http://www.bitvise.com/tunnelier.html
  
-PuTTY : http://www.chiark.greenend.org.uk/~sgtatham/putty/+PuTTY : [[http://www.putty.org/]], https://www.chiark.greenend.org.uk/~sgtatham/putty/
  
-SharpSSH - A Secure Shell (SSH) library for .NET: http://www.tamirgal.com/blog/page/SharpSSH.aspx+SharpSSH - A Secure Shell (SSH) library for .NET: http://www.tamirgal.com/blog/page/SharpSSH.aspx  (old: 2007) 
 + 
 +==== Linux Keychain Guide ==== 
 + 
 +  * Keychain 
 +http://www.gentoo.org/doc/en/keychain-guide.xml, http://manpages.ubuntu.com/manpages/intrepid/man1/keychain.1.html, [[https://help.ubuntu.com/community/QuickTips#Tip%20#3%20Keychain%20-%20Manage%20ssh%20keys]] 
 +  * [[http://live.gnome.org/GnomeKeyring|GNOME Keyring]], [[wpen>GNOME_Keyring]], [[http://library.gnome.org/devel/gnome-keyring/stable/|gnome-keyring Reference Manual]] 
 +  * ssh-agent
  
 ===== Tips ===== ===== Tips =====
Ligne 55: Ligne 88:
   # ATTENTION : local5 est utilisé notamment par sshd   # ATTENTION : local5 est utilisé notamment par sshd
   local5.info /var/log/sshd   local5.info /var/log/sshd
 +
 +Le port 22 est scanné en permanence, ce qui rempli le disque (risque [[glossaire/DDOS]]):
 +<code bash>
 +root@seriously:~# ls -lhS /var/log/|head
 +total 13M
 +-rw-rw----  1 root  utmp  36M Jul 10 12:09 btmp
 +-rw-r-----  1 root  adm   25M Jul  4 06:13 auth.log.1
 +-rw-r-----  1 root  adm   24M Jul 10 12:09 auth.log
 +-rw-------  1 root  utmp  13M Jul  1 06:12 btmp.1
 +</code>
  
 ==== Email automatique lors de la connexion ==== ==== Email automatique lors de la connexion ====
Ligne 67: Ligne 110:
 ==== Blacklister les Ips indésirables ==== ==== Blacklister les Ips indésirables ====
  
-Avec le script ssh-blacklist, voir [[informatique/security#ssh_scanning]].+SSH scanning ssh-blacklist 
 + 
 +Blacklister les Ips indésirables avec le script http://www.frit.net/scripts/ {{:informatique:ssh-blacklist.zip|copie locale}}
  
 ==== Chroot Jail ==== ==== Chroot Jail ====
Ligne 78: Ligne 123:
  
 RSSH: http://www.pizzashack.org/rssh RSSH: http://www.pizzashack.org/rssh
 +
 +
 +==== Tunnel ====
 +
 +Ssh tunneling (Encrypt your HTTP Traffic and more):
 +
 +Vous créez un port d'écoute qui se charge de prendre toute trame réseau qui rentre “telle quelle” et de la faire exécuter depuis l'autre bout du tunnel.
 + ssh -D port-local nomutilisateur@nomhôte
 +
 +=== Forwarding ===
 +
 +  ssh -C -NL 9999:localhost:5900 USER@REMOTE_HOST
 +
 +  * -C parameter to compress data (optional - useful for low bandwidth connections)
 +  * -N parameter to not execute a remote command (i.e. no prompt on the remote machine)
 +  * -L parameter for port forwarding from port 9999 on localhost to port 5900 on REMOTE_HOST.
 +
 +Ne fonctionne pas toujours avec 'localhost', utiliser alors '127.0.0.1'
 +  ssh -N -L 127.0.0.1:3307:127.0.0.1:3306 -p 30001 USER@REMOTE_HOST
 +
 +
 +=== Proxying ===
 +
 +<code bash>
 +scp -o 'ProxyJump user@proxy.openstreetmap.fr' ./file user@vm.openstreetmap.fr:/home/user/
 +</code>
 +
 +Se connecter à un serveur via un autre serveur (forwarding agent):
 +
 +  ssh -p <public port> -t -A root@<public ip> ssh -t root@<private-ip>
 +
 +Via la configuration du client SSH, ce qui du coup fonctionne avec SCP:
 +
 +  #~/.ssh/config
 +  Host machineC
 + ProxyCommand ssh -p XXX user@machineB nc %h %p
 +
 +Ouvrir une console via une autre machine:
 +
 +  ssh -t -A toto@s1.artefacts.coop ssh -t toto@s2.artefacts.coop
 +
  
informatique/reseau/ssh.1274122981.txt.gz · Dernière modification : 19/05/2012 00:15 (modification externe)

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki