Skip to content

Commit

Permalink
Merge pull request #235 from invidian/add-openvpn-ifconfig-ipv6-support
Browse files Browse the repository at this point in the history
client_specific_config: add support for ifconfig-ipv6-push
  • Loading branch information
bastelfreak authored Jul 3, 2019
2 parents f70882a + ae8e6c6 commit 63fc931
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/client_specific_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# @param iroute_ipv6 Array of IPv6 iroute combinations.
# @param route Array of route combinations pushed to client.
# @param ifconfig IP configuration to push to the client.
# @param ifconfig_ipv6 IPv6 configuration to push to the client.
# @param dhcp_options DHCP options to push to the client.
# @param redirect_gateway Redirect all traffic to gateway
# @param ensure Sets the client specific configuration file status (present or absent)
Expand All @@ -27,6 +28,7 @@
Array[String] $iroute_ipv6 = [],
Array[String] $route = [],
Variant[Boolean, String] $ifconfig = false,
Optional[String[1]] $ifconfig_ipv6 = undef,
Array[String] $dhcp_options = [],
Boolean $redirect_gateway = false,
) {
Expand Down
2 changes: 2 additions & 0 deletions spec/defines/openvpn_client_specific_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
iroute: ['10.0.1.0 255.255.255.0'],
iroute_ipv6: ['2001:db8:1234::/64'],
ifconfig: '10.10.10.2 255.255.255.0',
ifconfig_ipv6: '2001:db8:0:123::2/64 2001:db8:0:123::1',
route: ['10.200.100.0 255.255.255.0 10.10.10.1'],
dhcp_options: ['DNS 8.8.8.8'],
redirect_gateway: true
Expand All @@ -51,6 +52,7 @@
it { is_expected.to contain_file('/etc/openvpn/test_server/client-configs/test_client').with_content(%r{^iroute 10.0.1.0 255.255.255.0$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server/client-configs/test_client').with_content(%r{^iroute-ipv6 2001:db8:1234::/64$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server/client-configs/test_client').with_content(%r{^ifconfig-push 10.10.10.2 255.255.255.0$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server/client-configs/test_client').with_content(%r{^ifconfig-ipv6-push 2001:db8:0:123::2/64 2001:db8:0:123::1$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server/client-configs/test_client').with_content(%r{^push "dhcp-option DNS 8.8.8.8"$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server/client-configs/test_client').with_content(%r{^push "redirect-gateway def1"$}) }
it { is_expected.to contain_file('/etc/openvpn/test_server/client-configs/test_client').with_content(%r{^push "route 10.200.100.0 255.255.255.0 10.10.10.1"$}) }
Expand Down
3 changes: 3 additions & 0 deletions templates/client_specific_config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ iroute-ipv6 <%= iroute_ipv6 %>
<% if ifconfig = @ifconfig -%>
ifconfig-push <%= ifconfig %>
<% end -%>
<% if @ifconfig_ipv6 -%>
ifconfig-ipv6-push <%= @ifconfig_ipv6 %>
<% end -%>
<% @dhcp_options.each do |option| -%>
push "dhcp-option <%= option %>"
<% end -%>
Expand Down

0 comments on commit 63fc931

Please sign in to comment.