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

feature/api: Add TLS detail settings #41

Merged
merged 1 commit into from
Jan 4, 2017
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: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/Icinga/puppet-icinga2-rewrite.svg?branch=master)](https://travis-ci.org/Icinga/puppet-icinga2-rewrite)

# Icinga2 Puppet Module

![Icinga Logo](https://www.icinga.com/wp-content/uploads/2014/06/icinga_logo.png)
Expand Down Expand Up @@ -555,6 +557,15 @@ This module offers following options to create these certificates:
}
```

* Fine tune TLS / SSL settings

``` puppet
class { 'icinga2::feature::api':
ssl_protocolmin => 'TLSv1.2',
ssl_cipher_list => 'HIGH:MEDIUM:!aNULL:!MD5:!RC4',
}
```

### Custom configuration
Sometimes it's necessary to cover very special configurations that you cannot handle with this module. In this case you
can use the `icinga2::config::file` tag on your file ressource. This module collects all file ressource types with this
Expand Down
18 changes: 17 additions & 1 deletion manifests/feature/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
# Hash to configure zone objects. Defaults to { 'ZoneName' => {'endpoints' => ['NodeName']} }.
# ZoneName and NodeName are icinga2 constants.
#
# [*ssl_protocolmin*]
# Minimal TLS version to require. Default undef (e.g. "TLSv1.2")
#
# [*ssl_cipher_list*]
# List of allowed TLS ciphers, to finetune encryption. Default undef (e.g. "HIGH:MEDIUM:!aNULL:!MD5:!RC4")
#
# === Variables
#
# [*node_name*]
Expand Down Expand Up @@ -138,6 +144,8 @@
$ssl_key = undef,
$ssl_cert = undef,
$ssl_cacert = undef,
$ssl_protocolmin = undef,
$ssl_cipher_list = undef,
) {

$conf_dir = $::icinga2::params::conf_dir
Expand Down Expand Up @@ -184,6 +192,13 @@
else {
$_ssl_cacert_path = "${pki_dir}/ca.crt" }

if $ssl_protocolmin {
validate_string($ssl_protocolmin)
}
if $ssl_cipher_list {
validate_string($ssl_cipher_list)
}

# handle the certificate's stuff
case $pki {
'puppet': {
Expand Down Expand Up @@ -291,6 +306,8 @@
accept_commands => $accept_commands,
accept_config => $accept_config,
ticket_salt => $ticket_salt,
tls_protocolmin => $ssl_protocolmin,
cipher_list => $ssl_cipher_list,
}

# create endpoints and zones
Expand All @@ -314,5 +331,4 @@
icinga2::feature { 'api':
ensure => $ensure,
}

}
11 changes: 11 additions & 0 deletions spec/classes/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,17 @@

it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end

context "#{os} with TLS detail settings" do
let(:params) { { ssl_protocolmin: 'TLSv1.2', ssl_cipher_list: 'HIGH:MEDIUM:!aNULL:!MD5:!RC4' } }

it 'should set TLS detail setting' do
is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => '/etc/icinga2/features-available/api.conf' })
.with_content(/tls_protocolmin = "TLSv1.2"/)
.with_content(/cipher_list = "HIGH:MEDIUM:!aNULL:!MD5:!RC4"/)
end
end
end
end

Expand Down