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

Commit

Permalink
add parameter to specify connections to client
Browse files Browse the repository at this point in the history
  • Loading branch information
trefzer committed Feb 7, 2021
1 parent 6946ef6 commit 14de165
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
31 changes: 16 additions & 15 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@
# Example: ['2001:db8::/32']
#
define openvpn::client (
String $server,
String $auth = 'SHA1',
String $port = '1194',
String $proto = 'udp',
String $dev = 'tun',
String $ca = 'ca.crt',
String $cert = $name,
String $ns_cert_type = 'server',
Integer $verb = 3,
String $cipher = 'AES-192-CBC',
String $compression = 'lzo',
Optional[String] $tls_auth_key = undef,
Array $custom_options = [],
Array $route_ipv4 = [],
Array $route_ipv6 = [],
String $server,
String $auth = 'SHA1',
String $port = '1194',
String $proto = 'udp',
String $dev = 'tun',
String $ca = 'ca.crt',
String $cert = $name,
String $ns_cert_type = 'server',
Integer $verb = 3,
String $cipher = 'AES-192-CBC',
String $compression = 'lzo',
Optional[String] $tls_auth_key = undef,
Optional[Array[Hash]] $connections = undef,
Array $custom_options = [],
Array $route_ipv4 = [],
Array $route_ipv6 = [],
) {

include openvpn
Expand Down
10 changes: 10 additions & 0 deletions templates/client.conf.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
client
dev <%= @dev %>
proto <%= @proto %>
<% if @connections -%>
<%- @connections.each do | connection | -%>
<%- %><connection>
<%- connection.each do | key, val | -%>
<%= key %> <%= val %>
<%- end -%>
<%- %></connection>
<%- end -%>
<% else -%>
remote <%= @server %> <%= @port %>
<% end -%>
resolv-retry infinite
nobind
persist-key
Expand Down

0 comments on commit 14de165

Please sign in to comment.