Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Make crl_file, ca_file, chroot, user, and group optional. Add support for capath. #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions manifests/tun.pp
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@
define stunnel::tun(
$certificate,
$private_key,
$ca_file,
$crl_file,
$chroot,
$user,
$group,
$client,
$accept,
$connect,
$user = undef,
$group = undef,
$ca_file = undef,
$ca_path = undef,
$crl_file = undef,
$chroot = undef,
$ssl_version = 'TLSv1',
$pid_file = "/${name}.pid",
$debug_level = '0',
Expand Down Expand Up @@ -137,10 +138,12 @@
require => File[$conf_dir],
}

file { $chroot:
ensure => directory,
owner => $user,
group => $group,
mode => '0600',
if $chroot {
file { $chroot:
ensure => directory,
owner => $user,
group => $group,
mode => '0600',
}
}
}
14 changes: 13 additions & 1 deletion templates/stunnel.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@

cert = <%= @certificate %>
key = <%= @private_key %>
<%- if @ca_file != nil -%>
CAfile = <%= @ca_file %>
<%- end -%>
<%- if @ca_path != nil -%>
capath = <%= @ca_path %>
<%- end -%>
<%- if @crl_file != nil -%>
CRLfile = <%= @crl_file %>
<%- end -%>
sslVersion = <%= @ssl_version_real %>
verify = 2

<%- if @chroot != nil -%>
chroot = <%= @chroot %>
<%- end -%>
<%- if @user != nil -%>
setuid = <%= @user %>
<%- end -%>
<%- if @group != nil -%>
setgid = <%= @group %>
<%- end -%>
pid = <%= @pid_file %>

socket = l:TCP_NODELAY=1
Expand Down