GTUTO
https://www.gtuto.com/tunnel-ssh/
Export date: Fri Apr 19 20:04:10 2024 / +0000 GMT

TUNNEL SSH


ssh-keygen -t rsa -b 4096      // création clef ssh ( si pas déjà fait)

ssh  user@dev.monserveur.com  <-password // première connexion serveur relais manuelle

ssh-copy-id root@ monserveur.com  // copie clef

dans sshd_config ajouter :  GatewayPorts yes
/etc/init.d/ssh restart  //(debian)

ssh -R 4444:localhost:80 user@dev.monserveur.com
en se connectant sur dev.monserveur.com:4444 c'est localhost:80 qui répond.

autossh   -M 0 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3"  -R 4444:localhost:80 user@dev.monserveur.com 
même chose mais en tache de fond avec reconnexion automatique

Lancement au boot ajouter un fichier /etc/systemd/system/autossh-tunnel.service
[Unit]
Description=AutoSSH tunnel service local 80 port 4444 dev.monserveur.mobi
After=network.target

[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NR 4444:localhost:80 root@dev.monserveur.mobi
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

puis:
sudo systemctl start autossh-tunnel.service
sudo systemctl stop autossh-tunnel.service
sudo systemctl enable autossh-tunnel.service  pour démarrage auto

https://wiki.archlinux.fr/Autossh 1

Links:
  1. https://wiki.archlinux.fr/Autossh
Post date: 2019-05-12 23:07:47
Post date GMT: 2019-05-12 23:07:47

Post modified date: 2020-04-11 02:07:39
Post modified date GMT: 2020-04-11 02:07:39

Export date: Fri Apr 19 20:04:10 2024 / +0000 GMT
This page was exported from GTUTO [ https://www.gtuto.com ]
Export of Post and Page has been powered by [ Universal Post Manager ] plugin from www.ProfProjects.com