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

issue #604 : compatibility for ssl connections to the database #658

Closed
wants to merge 2 commits into from
Closed
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
27 changes: 27 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6441,6 +6441,9 @@ The following parameters are available in the `prometheus::mysqld_exporter` clas
* [`cnf_port`](#-prometheus--mysqld_exporter--cnf_port)
* [`cnf_socket`](#-prometheus--mysqld_exporter--cnf_socket)
* [`cnf_user`](#-prometheus--mysqld_exporter--cnf_user)
* [`cnf_ssl_ca`](#-prometheus--mysqld_exporter--cnf_ssl_ca)
* [`cnf_ssl_cert`](#-prometheus--mysqld_exporter--cnf_ssl_cert)
* [`cnf_ssl_key`](#-prometheus--mysqld_exporter--cnf_ssl_key)
* [`arch`](#-prometheus--mysqld_exporter--arch)
* [`bin_dir`](#-prometheus--mysqld_exporter--bin_dir)
* [`config_mode`](#-prometheus--mysqld_exporter--config_mode)
Expand Down Expand Up @@ -6521,6 +6524,30 @@ The mysql user to use when connecting.

Default value: `login`

##### <a name="-prometheus--mysqld_exporter--cnf_ssl_ca"></a>`cnf_ssl_ca`

Data type: `Optional[Stdlib::Absolutepath]`

The path name of the Certificate Authority (CA) certificate file in PEM format. The file may contain a list of trusted SSL Certificate Authorities.

Default value: `undef`

##### <a name="-prometheus--mysqld_exporter--cnf_ssl_cert"></a>`cnf_ssl_cert`

Data type: `Optional[Stdlib::Absolutepath]`

The path name of the client SSL public key certificate file in PEM format.

Default value: `undef`

##### <a name="-prometheus--mysqld_exporter--cnf_ssl_key"></a>`cnf_ssl_key`

Data type: `Optional[Stdlib::Absolutepath]`

The path name of the client SSL private key file in PEM format.

Default value: `undef`

##### <a name="-prometheus--mysqld_exporter--arch"></a>`arch`

Data type: `String[1]`
Expand Down
12 changes: 12 additions & 0 deletions manifests/mysqld_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
# The socket which the mysql host is running. If defined, host and port are not used.
# @param cnf_user
# The mysql user to use when connecting.
# @param cnf_ssl_ca
# The path name of the Certificate Authority (CA) certificate file in PEM format. The file may contain a list of trusted SSL Certificate Authorities.
# @param cnf_ssl_cert
# The path name of the client SSL public key certificate file in PEM format.
# @param cnf_ssl_key
# The path name of the client SSL private key file in PEM format.
# @param arch
# Architecture (amd64 or i386)
# @param bin_dir
Expand Down Expand Up @@ -80,6 +86,9 @@
String[1] $cnf_user = login,
Variant[Sensitive[String],String] $cnf_password = 'password',
Optional[Stdlib::Absolutepath] $cnf_socket = undef,
Optional[Stdlib::Absolutepath] $cnf_ssl_ca = undef,
Optional[Stdlib::Absolutepath] $cnf_ssl_cert = undef,
Optional[Stdlib::Absolutepath] $cnf_ssl_key = undef,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Expand Down Expand Up @@ -124,6 +133,9 @@
'cnf_port' => $cnf_port,
'cnf_host' => $cnf_host,
'cnf_socket' => $cnf_socket,
'cnf_ssl_ca' => $cnf_ssl_ca,
'cnf_ssl_cert' => $cnf_ssl_cert,
'cnf_ssl_key' => $cnf_ssl_key,
},
)
),
Expand Down
11 changes: 11 additions & 0 deletions templates/my.cnf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
Stdlib::Port $cnf_port,
Stdlib::Host $cnf_host,
Optional[Stdlib::Absolutepath] $cnf_socket = undef,
Optional[Stdlib::Absolutepath] $cnf_ssl_ca = undef,
Optional[Stdlib::Absolutepath] $cnf_ssl_cert = undef,
Optional[Stdlib::Absolutepath] $cnf_ssl_key = undef,
| -%>
# THIS FILE IS MANAGED BY PUPPET
[client]
Expand All @@ -21,3 +24,11 @@ socket = <%= $cnf_socket %>
host = <%= $cnf_host %>
port = <%= $cnf_port %>
<% } -%>
<% if $cnf_ssl_ca { -%>
ssl-ca = <%= $cnf_ssl_ca %>
<% } -%>
<%# client ssl cert and key, only used if both provided %>
<% if $cnf_ssl_cert and $cnf_ssl_key { -%>
ssl-cert = <%= $cnf_ssl_cert %>
ssl-key = <%= $cnf_ssl_key %>
<% } -%>