Add user parameter to allow running the service as a non-root user
This commit is contained in:
parent
4c080ffbe3
commit
da9eb4a323
@ -17,6 +17,7 @@
|
||||
# A define to add an autossh tunnel
|
||||
define autossh::tunnel (
|
||||
$ensure = running,
|
||||
$user,
|
||||
$ssh_port = '22',
|
||||
$ssh_host,
|
||||
$ssh_user,
|
||||
|
@ -1 +1,5 @@
|
||||
<% if @user == 'root' %>
|
||||
/usr/lib/autossh/autossh -M 0 -N -f -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -o "StrictHostKeyChecking no" <% if @local_forward_args %> -L <%= @local_forward_args %> <% end %> <% if @remote_forward_args %> -R <%= @remote_forward_args %> <% end %> -i <%= @ssh_key %> <%= @ssh_user %>@<%= @ssh_host %> -p <%= @ssh_port %>
|
||||
<% else %>
|
||||
su <%= @user %> -c '/usr/lib/autossh/autossh -M 0 -N -f -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -o "StrictHostKeyChecking no" <% if @local_forward_args %> -L <%= @local_forward_args %> <% end %> <% if @remote_forward_args %> -R <%= @remote_forward_args %> <% end %> -i <%= @ssh_key %> <%= @ssh_user %>@<%= @ssh_host %> -p <%= @ssh_port %>'
|
||||
<% end %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user