Add tunnel back service

This commit is contained in:
Keith Whyte 2021-05-29 20:50:38 +02:00
parent d7187daadf
commit 59519dd23f
2 changed files with 28 additions and 0 deletions

View file

@ -81,6 +81,9 @@ class rhizo_base {
$webphone_prefix = hiera('rhizo::webphone_prefix', '[]') $webphone_prefix = hiera('rhizo::webphone_prefix', '[]')
$latency_check_address = hiera('rhizo::latency_check_address','1.1.1.1') $latency_check_address = hiera('rhizo::latency_check_address','1.1.1.1')
$latency_check_vpn = hiera('rhizo::latency_check_vpn','10.23.0.2') $latency_check_vpn = hiera('rhizo::latency_check_vpn','10.23.0.2')
$ssh_addr = hiera('rhizo::ssh_t_address','127.0.0.1')
$ssh_user = hiera('rhizo::ssh_user','')
$ssh_p = split($vpn_ip_address, '\.')[3]
$stats_disk = hiera('rhizo::stats_disk','sda1') $stats_disk = hiera('rhizo::stats_disk','sda1')
$stats_if = hiera('rhizo::stats_if','eth0') $stats_if = hiera('rhizo::stats_if','eth0')
@ -708,4 +711,14 @@ schedule { 'never':
content => template('rhizo_base/msmtprc.erb') content => template('rhizo_base/msmtprc.erb')
} }
systemd::unit_file { 'sshtunnel.service':
content => template("rhizo_base/sshtunnel.service.erb")
}
service { [ 'sshtunnel' ]:
provider => 'systemd',
enable => true,
ensure => 'running'
}
} }

View file

@ -0,0 +1,15 @@
[Unit]
Description=SSH Tunnel
Requires=sysinit.target system.slice
After=network.target
[Service]
Type=simple
WorkingDirectory=/
ExecStart=/usr/bin/ssh -v -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -N -c none -i /root/.ssh/bsc_dev <%= @ssh_user %>@<%= @ssh_addr %> -R 220<%= @ssh_p %>:0:22
TimeoutStopSec=5
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target