1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#
# Sets up stunnel and firewall configuration for
# a single stunnel client
#
# As a client, we accept connections on localhost,
# and connect to a remote $connect:$connect_port
#
define site_stunnel::client (
$accept_port,
$connect_port,
$connect,
$original_port,
$verify = '2',
$pid = $name,
$rndfile = '/var/lib/stunnel4/.rnd',
$debuglevel = 'warning' ) {
$logfile = "/var/log/stunnel4/${name}.log"
include site_config::x509::cert
include site_config::x509::key
include site_config::x509::ca
include x509::variables
$ca_path = "${x509::variables::local_CAs}/${site_config::params::ca_name}.crt"
$cert_path = "${x509::variables::certs}/${site_config::params::cert_name}.crt"
$key_path = "${x509::variables::keys}/${site_config::params::cert_name}.key"
stunnel::service { $name:
accept => "127.0.0.1:${accept_port}",
connect => "${connect}:${connect_port}",
client => true,
cafile => $ca_path,
key => $key_path,
cert => $cert_path,
verify => $verify,
pid => "/var/run/stunnel4/${pid}.pid",
rndfile => $rndfile,
debuglevel => $debuglevel,
sslversion => 'TLSv1',
syslog => 'no',
output => $logfile;
}
# define the log files so that we can purge the
# files from /var/log/stunnel4 that are not defined.
file {
$logfile:;
"${logfile}.1.gz":;
"${logfile}.2.gz":;
"${logfile}.3.gz":;
"${logfile}.4.gz":;
"${logfile}.5.gz":;
}
site_shorewall::stunnel::client { $name:
accept_port => $accept_port,
connect => $connect,
connect_port => $connect_port,
original_port => $original_port
}
include site_check_mk::agent::stunnel
}
|