Användarverktyg

Webbverktyg


teknik:guider:security:ssh_tunnel_with_systemd_service

Skillnader

Här visas skillnader mellan den valda versionen och den nuvarande versionen av sidan.

Länk till den här jämförelsesidan

Both sides previous revision Föregående version.
teknik:guider:security:ssh_tunnel_with_systemd_service [2019-02-26 14:57]
stemid
teknik:guider:security:ssh_tunnel_with_systemd_service [2019-06-07 07:25] (aktuell)
stemid
Rad 6: Rad 6:
 [Unit] [Unit]
 Description=SSH Tunnel %i Description=SSH Tunnel %i
-After=network.target+ 
 +# This whole mess is so the service won't start until WiFi is online. 
 +Wants=network-online.target NetworkManager-wait-online.service ​                                                                                                                                                                         
 +After=network.target ​network-online.target NetworkManager-wait-online.service ​                                                                                                                                                         ​
  
 [Service] [Service]
 Type=exec Type=exec
-ExecStart=/​usr/​bin/​autossh ​-CN -o "​ExitOnForwardFailure yes" %i+ExecStart=/​usr/​bin/​ssh -vCN -o "​ExitOnForwardFailure yes" %i
 KillMode=process KillMode=process
 Restart=always Restart=always
Rad 24: Rad 27:
  
 I don't know of a way to write dependencies between the tunnels but it doesn'​t matter much because the tunnels I have that depend on other tunnels will restart every 5 seconds until they'​re live. I don't know of a way to write dependencies between the tunnels but it doesn'​t matter much because the tunnels I have that depend on other tunnels will restart every 5 seconds until they'​re live.
 +
 +To figure out your dependencies in After and Wants you can run this command.
 +
 +<​file>​$ systemctl is-enabled NetworkManager-wait-online.service systemd-networkd-wait-online.service
 +enabled
 +disabled</​file>​
 +
 +Only one of those should be enabled, that's the one you should use as a dependency. I've input both to be on the safe side.
teknik/guider/security/ssh_tunnel_with_systemd_service.txt · Senast uppdaterad: 2019-06-07 07:25 av stemid