Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how .conf and .ovpn files are generated #190

Merged
merged 1 commit into from
May 3, 2016
Merged
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
11 changes: 5 additions & 6 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
owner => root,
group => $::openvpn::params::root_group,
mode => '0444',
content => template('openvpn/client.erb'),
content => template('openvpn/client.erb', 'openvpn/client_external_auth.erb'),
}

exec { "tar the thing ${server} with ${name}":
Expand All @@ -326,22 +326,21 @@
mode => '0400',
notify => Exec["tar the thing ${server} with ${name}"],
require => [
File["${etc_directory}/openvpn/${server}/download-configs/${name}/${name}.conf"],
File["${etc_directory}/openvpn/${server}/download-configs/${name}/keys/${name}/ca.crt"],
File["${etc_directory}/openvpn/${server}/download-configs/${name}/keys/${name}/${name}.key"],
File["${etc_directory}/openvpn/${server}/download-configs/${name}/keys/${name}/${name}.crt"],
],
}

concat::fragment { "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn/client_config":
target => "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn",
source => "${etc_directory}/openvpn/${server}/download-configs/${name}/${name}.conf",
order => '01'
target => "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn",
content => template('openvpn/client.erb'),
order => '01'
}

concat::fragment { "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn/ca_open_tag":
target => "${etc_directory}/openvpn/${server}/download-configs/${name}.ovpn",
content => "<ca>\n",
content => "# Authentication \n<ca>\n",
order => '02'
}

Expand Down
10 changes: 1 addition & 9 deletions templates/client.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
client
ca keys/<%= @name %>/ca.crt
cert keys/<%= @name %>/<%= @name %>.crt
key keys/<%= @name %>/<%= @name %>.key
dev <%= @dev %>
proto <%= @proto %>
remote <%= @remote_host %> <%= @port %>
Expand Down Expand Up @@ -55,12 +52,6 @@ up "<%= @up %>"
<% if @down != '' -%>
down "<%= @down %>"
<% end -%>
<% if @tls_auth -%>

# tls authentification
tls-client
tls-auth keys/<%= @name %>/ta.key 1
<% end -%>
<% if @x509_name -%>

# x509 name verification
Expand All @@ -71,3 +62,4 @@ verify-x509-name "<%= @x509_name %>" name
<% @custom_options.each_pair do |key, value| -%>
<%= key %> <%= value %>
<% end -%>

9 changes: 9 additions & 0 deletions templates/client_external_auth.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ca keys/<%= @name %>/ca.crt
cert keys/<%= @name %>/<%= @name %>.crt
key keys/<%= @name %>/<%= @name %>.key
<% if @tls_auth -%>

# tls authentification
tls-client
tls-auth keys/<%= @name %>/ta.key 1
<% end -%>