aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2009-12-26 14:15:51 -0500
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2009-12-26 14:15:51 -0500
commit8d9bded5e977016d13e6521ee383cb3d5918506f (patch)
tree66d01106ccab716edfcfa9ff911f9e002836ecdd
parent0321a3210ef6bb42ef8b536d0964bef081294d1d (diff)
downloadpuppet-autossh-8d9bded5e977016d13e6521ee383cb3d5918506f.tar.gz
puppet-autossh-8d9bded5e977016d13e6521ee383cb3d5918506f.tar.bz2
if 'monitor_port' is defined, don't enable ServerAliveInterval and ServerAliveCountMax
-rw-r--r--manifests/tunnel.pp13
-rw-r--r--templates/autossh-tunnel.erb2
2 files changed, 13 insertions, 2 deletions
diff --git a/manifests/tunnel.pp b/manifests/tunnel.pp
index 6d9c9d1..a90a38a 100644
--- a/manifests/tunnel.pp
+++ b/manifests/tunnel.pp
@@ -6,7 +6,7 @@ define autossh::tunnel (
$host = 'localhost',
$hostport,
$remote_host,
- $monitor_port = 0,
+ $monitor_port = 'absent',
$gatetime = 'absent',
$first_poll = 'absent',
$poll = 'absent',
@@ -17,6 +17,17 @@ define autossh::tunnel (
include autossh
+ # According to the autossh documentation, using OpenSSH ServerAlive
+ # options is better than using a monitor port, so we do that by default.
+ if ($monitor_port == 'absent') {
+ $real_monitor_port = 0
+ $ssh_extra_options = "-o ServerAliveInterval=30 -o ServerAliveCountMax=3"
+ }
+ else {
+ $real_monitor_port = $monitor_port
+ $ssh_extra_options = ''
+ }
+
if ($ensure == 'present') {
file { "/etc/init.d/autossh-tunnel-${name}":
diff --git a/templates/autossh-tunnel.erb b/templates/autossh-tunnel.erb
index 3302f5a..f19cb51 100644
--- a/templates/autossh-tunnel.erb
+++ b/templates/autossh-tunnel.erb
@@ -26,7 +26,7 @@ SCRIPTNAME=/etc/init.d/$NAME
#
# AutoSSH configuration
#
-AUTOSSH_ARGS="-M <%= monitor_port %> -N -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= remote_host %>"
+AUTOSSH_ARGS="-M <%= real_monitor_port %> -N -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= ssh_extra_options %> <%= remote_host %>"
<% if gatetime != 'absent' -%>
AUTOSSH_GATETIME=<%= gatetime %>
<% end -%>