diff --git a/README.markdown b/README.markdown index 0eb688e..025e90c 100755 --- a/README.markdown +++ b/README.markdown @@ -89,6 +89,29 @@ node 'uchiwa-server.foo.com' { } ``` +## SSL (HTTPS) + +This is an example on how to use Uchiwa with HTTPS: + +Puppet: +``` +class { 'uchiwa': + ssl = { + 'certfile' => '/path/to/certfile', + 'keyfile' => '/path/to/keyfile', + } +} +``` +Simple YAML: +``` +uchiwa::ssl: { 'certfile': '/opt/ssl/public.crt', 'keyfile': '/opt/ssl/private.key' } +``` + +Litle more advanced: +``` +uchiwa::ssl: { 'certfile': '/opt/ssl/%{::hostname}.crt', 'keyfile': '/opt/ssl/%{::hostname}.key' } +``` + ## License See LICENSE file. diff --git a/manifests/init.pp b/manifests/init.pp index 832ff4d..889da8d 100755 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -152,7 +152,8 @@ $refresh = $uchiwa::params::refresh, $sensu_api_endpoints = $uchiwa::params::sensu_api_endpoints, $users = $uchiwa::params::users, - $auth = $uchiwa::params::auth + $auth = $uchiwa::params::auth, + $ssl = $uchiwa::params::ssl, ) inherits uchiwa::params { # validate parameters here @@ -175,6 +176,7 @@ validate_array($sensu_api_endpoints) validate_array($users) validate_hash($auth) + validate_hash($ssl) anchor { 'uchiwa::begin': } -> class { 'uchiwa::install': } -> diff --git a/manifests/params.pp b/manifests/params.pp index f978951..2fc7ccf 100755 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -48,4 +48,5 @@ $refresh = '5' $users = [] $auth = {} + $ssl = {} } diff --git a/templates/etc/sensu/uchiwa.json.erb b/templates/etc/sensu/uchiwa.json.erb index 9b8a1d0..0a25dbe 100644 --- a/templates/etc/sensu/uchiwa.json.erb +++ b/templates/etc/sensu/uchiwa.json.erb @@ -29,7 +29,7 @@ "port": <%= @port %>, "user": "<%= @user %>", "pass": "<%= @pass %>", - "refresh": <%= @refresh %><%= ',' if @users.size > 0 or @auth.size == 2 %> + "refresh": <%= @refresh %><%= ',' if @users.size > 0 or @auth.size == 2 or @ssl.size == 2%> <%- if @users.size > 0 -%> "users": [ <%- @users.each_with_index do |user, i| -%> @@ -47,6 +47,12 @@ "auth": { "publickey": "<%= @auth['publickey'] %>", "privatekey": "<%= @auth['privatekey'] %>" + }<%= ',' if @ssl.size == 2 %> + <%- end -%> + <%- if @ssl.size == 2 -%> + "ssl": { + "certfile": "<%= @ssl['certfile'] %>", + "keyfile": "<%= @ssl['keyfile'] %>" } <%- end -%> }