From 702f66596bb942092717427cf73b3b422c5c6015 Mon Sep 17 00:00:00 2001 From: Phil Fenstermacher Date: Wed, 30 Nov 2016 23:52:11 -0500 Subject: [PATCH] Add timeout options to tunnel settings --- manifests/tun.pp | 26 +++++++++++++++++++++----- templates/stunnel.conf.erb | 13 +++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/manifests/tun.pp b/manifests/tun.pp index fa4c211..f72aab7 100644 --- a/manifests/tun.pp +++ b/manifests/tun.pp @@ -72,6 +72,18 @@ # By default we look this value up in a stunnel::data class, which has a # list of common answers. # +# [*timeout_busy*] +# Time to wait for expected data +# +# [*timeout_close*] +# Time to wait for close_notify (set to 0 for buggy MSIE) +# +# [*timeout_connect*] +# Time to wait to connect to a remote host +# +# [*timeout_idle*] +# Time to keep an idle connection +# # === Examples # # stunnel::tun { 'rsyncd': @@ -107,11 +119,15 @@ $client, $accept, $connect, - $ssl_version = 'TLSv1', - $pid_file = "/${name}.pid", - $debug_level = '0', - $log_dest = "/var/log/${name}.log", - $conf_dir = $stunnel::params::conf_dir + $timeout_busy = undef, + $timeout_close = undef, + $timeout_connect = undef, + $timeout_idle = undef, + $ssl_version = 'TLSv1', + $pid_file = "/${name}.pid", + $debug_level = '0', + $log_dest = "/var/log/${name}.log", + $conf_dir = $stunnel::params::conf_dir ) { $ssl_version_real = $ssl_version ? { diff --git a/templates/stunnel.conf.erb b/templates/stunnel.conf.erb index 18ea32d..4b8c48b 100644 --- a/templates/stunnel.conf.erb +++ b/templates/stunnel.conf.erb @@ -20,6 +20,19 @@ output = <%= @log_dest %> client = <%= @client_on %> +<%- if @timeout_busy != nil -%> +TIMEOUTbusy = <%= @timeout_busy %> +<%- end -%> +<%- if @timeout_close != nil -%> +TIMEOUTclose = <%= @timeout_close %> +<%- end -%> +<%- if @timeout_connect != nil -%> +TIMEOUTconnect = <%= @timeout_connect %> +<%- end -%> +<%- if @timeout_idle != nil -%> +TIMEOUTidle = <%= @timeout_idle %> +<%- end -%> + [<%= @name -%>] accept = <%= @accept %> connect = <%= @connect %>