Skip to content

Commit

Permalink
Add key option for tunnels (ucbpi#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
micah committed May 3, 2017
1 parent 2c6e85e commit 411a0c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions manifests/tun.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# [*cert*]
# Certificate to use for this tunnel
#
# [*key*]
# Key to use for this tunnel
#
# [*client*]
# Whether this tunnel should be setup in client mode.
#
Expand Down Expand Up @@ -68,6 +71,7 @@
$connect,
$cafile = '',
$cert = 'UNSET',
$key = '',
$client = false,
$options = [ ],
$failover = 'rr',
Expand Down Expand Up @@ -95,6 +99,11 @@
default => $cafile,
}

$key_real = $key ? {
'UNSET' => '',
default => $key,
}

# Clients don't require a certificate but servers do
if $client {
$cert_default = ''
Expand All @@ -113,6 +122,9 @@
if $cert_real != '' {
validate_absolute_path( $cert_real )
}
if $key_real != '' {
validate_absolute_path( $key_real )
}
validate_bool( str2bool($client) )

if is_string($options) {
Expand Down
3 changes: 3 additions & 0 deletions templates/tun.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ CAfile = <%= @cafile_real %>
<% else -%>
# CAfile = /path/to/cafile.crt
<% end -%>
<% if @key_real != '' -%>
key = <%= @key_real %>
<% end -%>
<% if @accept -%>
accept=<%= @accept %>
<% end -%>
Expand Down

0 comments on commit 411a0c3

Please sign in to comment.