Skip to content
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
36 changes: 36 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ The following parameters are available in the `openvpn::client` defined type:
* [`remote_host`](#-openvpn--client--remote_host)
* [`cipher`](#-openvpn--client--cipher)
* [`tls_cipher`](#-openvpn--client--tls_cipher)
* [`data_ciphers`](#-openvpn--client--data_ciphers)
* [`data_ciphers_fallback`](#-openvpn--client--data_ciphers_fallback)
* [`resolv_retry`](#-openvpn--client--resolv_retry)
* [`auth_retry`](#-openvpn--client--auth_retry)
* [`verb`](#-openvpn--client--verb)
Expand Down Expand Up @@ -575,6 +577,22 @@ TLS Ciphers to use

Default value: `'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256'`

##### <a name="-openvpn--client--data_ciphers"></a>`data_ciphers`

Data type: `String`

Ciphers to allow for packet encryption

Default value: `'AES-256-GCM:AES-128-GCM'`

##### <a name="-openvpn--client--data_ciphers_fallback"></a>`data_ciphers_fallback`

Data type: `Optional[String]`

Cipher to use if peer cipher config cannot be determined

Default value: `undef`

##### <a name="-openvpn--client--resolv_retry"></a>`resolv_retry`

Data type: `String`
Expand Down Expand Up @@ -1030,6 +1048,8 @@ The following parameters are available in the `openvpn::server` defined type:
* [`verb`](#-openvpn--server--verb)
* [`cipher`](#-openvpn--server--cipher)
* [`tls_cipher`](#-openvpn--server--tls_cipher)
* [`data_ciphers`](#-openvpn--server--data_ciphers)
* [`data_ciphers_fallback`](#-openvpn--server--data_ciphers_fallback)
* [`persist_key`](#-openvpn--server--persist_key)
* [`persist_tun`](#-openvpn--server--persist_tun)
* [`key_expire`](#-openvpn--server--key_expire)
Expand Down Expand Up @@ -1627,6 +1647,22 @@ TLS Ciphers to use

Default value: `'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256'`

##### <a name="-openvpn--server--data_ciphers"></a>`data_ciphers`

Data type: `String`

Ciphers to allow for packet encryption

Default value: `'AES-256-GCM:AES-128-GCM'`

##### <a name="-openvpn--server--data_ciphers_fallback"></a>`data_ciphers_fallback`

Data type: `Optional[String]`

Cipher to use if peer cipher config cannot be determined

Default value: `undef`

##### <a name="-openvpn--server--persist_key"></a>`persist_key`

Data type: `Boolean`
Expand Down
4 changes: 4 additions & 0 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# @param remote_host The IP or hostname of the openvpn server service.
# @param cipher Cipher to use for packet encryption
# @param tls_cipher TLS Ciphers to use
# @param data_ciphers Ciphers to allow for packet encryption
# @param data_ciphers_fallback Cipher to use if peer cipher config cannot be determined
# @param resolv_retry How many seconds should the openvpn client try to resolve the server's hostname
# @param auth_retry Controls how OpenVPN responds to username/password verification errors such as the client-side response to an AUTH_FAILED message from the server or verification failure of the private key password.
# @param verb Level of logging verbosity
Expand Down Expand Up @@ -61,6 +63,8 @@
Boolean $pam = false,
String $cipher = 'AES-256-GCM',
String $tls_cipher = 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256',
String $data_ciphers = 'AES-256-GCM:AES-128-GCM',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is potentially a breaking change. Can it default to the same value as ciphers instead of a hard coded value that could be different than what the user expects?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The manpage of my OpenVPN (2.6.14-0ubuntu0.24.04.3) states that the default for data-ciphers is

AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 when Chacha20-Poly1305 is available and otherwise AES-256-GCM:AES-128-GCM.

I've used the default here, and the value is only added to the config if changed from the default, so if the user explicitly specifies something else. I though that should ensure it's not a breaking change. Please let me know if you want it differently.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW It's perfectly fine if you modify this as you see fit, it's been a while since I've worked with this and I don't really have the time to polish it to a large extent I'm afraid.

Optional[String] $data_ciphers_fallback = undef,
Boolean $authuserpass = false,
Hash $setenv = {},
Hash $setenv_safe = {},
Expand Down
4 changes: 4 additions & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
# @param verb Level of logging verbosity
# @param cipher Cipher to use for packet encryption
# @param tls_cipher TLS Ciphers to use
# @param data_ciphers Ciphers to allow for packet encryption
# @param data_ciphers_fallback Cipher to use if peer cipher config cannot be determined
# @param persist_key Try to retain access to resources that may be unavailable because of privilege downgrades
# @param persist_tun Try to retain access to resources that may be unavailable because of privilege downgrades
# @param key_expire The number of days to certify the server certificate for
Expand Down Expand Up @@ -225,6 +227,8 @@
Optional[String] $verb = undef,
String $cipher = 'AES-256-GCM',
String $tls_cipher = 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256',
String $data_ciphers = 'AES-256-GCM:AES-128-GCM',
Optional[String] $data_ciphers_fallback = undef,
Boolean $persist_key = false,
Boolean $persist_tun = false,
Boolean $tls_auth = false,
Expand Down
4 changes: 4 additions & 0 deletions spec/defines/openvpn_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
'persist_tun' => false,
'cipher' => 'AES-256-GCM',
'tls_cipher' => 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA',
'data_ciphers' => 'AES-256-GCM',
'data_ciphers_fallback' => 'AES-128-GCM',
'port' => '123',
'proto' => 'udp',
'remote_host' => %w[somewhere galaxy],
Expand Down Expand Up @@ -233,6 +235,8 @@
with_content(%r{^setenv_safe\s+FORWARD_COMPATIBLE\s+1$}).
with_content(%r{^cipher\s+AES-256-GCM$}).
with_content(%r{^tls-cipher\s+TLS-DHE-RSA-WITH-AES-256-CBC-SHA$}).
with_content(%r{^data-ciphers\s+AES-256-GCM$}).
with_content(%r{^data-ciphers-fallback\s+AES-128-GCM$}).
with_content(%r{^tls-client$}).
with_content(%r{^verify-x509-name\s+"test_server"\s+name$}).
with_content(%r{^sndbuf\s+393216$}).
Expand Down
4 changes: 4 additions & 0 deletions spec/defines/openvpn_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@
'verb' => 'mute',
'cipher' => 'DES-CBC',
'tls_cipher' => 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA',
'data_ciphers' => 'AES-256-GCM',
'data_ciphers_fallback' => 'AES-128-GCM',
'persist_key' => true,
'persist_tun' => true,
'duplicate_cn' => true,
Expand Down Expand Up @@ -517,6 +519,8 @@
with_content(%r{^verb mute$}).
with_content(%r{^cipher DES-CBC$}).
with_content(%r{^tls-cipher\s+TLS-DHE-RSA-WITH-AES-256-CBC-SHA$}).
with_content(%r{^data-ciphers\s+AES-256-GCM$}).
with_content(%r{^data-ciphers-fallback\s+AES-128-GCM$}).
with_content(%r{^persist-key$}).
with_content(%r{^persist-tun$}).
with_content(%r{^up "/tmp/up"$}).
Expand Down
6 changes: 6 additions & 0 deletions templates/client.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ cipher <%= @cipher %>
<% if @tls_cipher != '' -%>
tls-cipher <%= @tls_cipher %>
<% end -%>
<% if @data_ciphers != 'AES-256-GCM:AES-128-GCM' -%>
data-ciphers <%= @data_ciphers %>
<% end -%>
<% if @data_ciphers_fallback -%>
data-ciphers-fallback <%= @data_ciphers_fallback %>
<% end -%>
<% if @mute_replay_warnings -%>
mute-replay-warnings
<% end -%>
Expand Down
6 changes: 6 additions & 0 deletions templates/server.erb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ cipher <%= @cipher %>
<% if @tls_cipher != '' -%>
tls-cipher <%= @tls_cipher %>
<% end -%>
<% if @data_ciphers != 'AES-256-GCM:AES-128-GCM' -%>
data-ciphers <%= @data_ciphers %>
<% end -%>
<% if @data_ciphers_fallback -%>
data-ciphers-fallback <%= @data_ciphers_fallback %>
<% end -%>
<% if @c2c -%>
client-to-client
<% end -%>
Expand Down
Loading