Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Commit

Permalink
Introducing auth parameter in puppet-uchiwa
Browse files Browse the repository at this point in the history
This commit introduces the auth paramter, which can be used - starting
from uchiwa 0.13.0 in order to specify a static RSA keypair for JWT
signature validation.
  • Loading branch information
Simon Aquino committed Dec 8, 2015
1 parent f4f0fa1 commit 1f12108
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
16 changes: 15 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@
# }]
# ```
#
# [*auth*]
# Hash
# A hash containing the static public and private key paths for generating and
# validating JSON Web Token (JWT) signatures.
# Example:
# ```
# {
# 'publickey' => '/path/to/uchiwa.rsa.pub',
# 'privatekey' => '/path/to/uchiwa.rsa'
# }
# ```
#
class uchiwa (
$package_name = $uchiwa::params::package_name,
$service_name = $uchiwa::params::service_name,
Expand All @@ -130,7 +142,8 @@
$pass = $uchiwa::params::pass,
$refresh = $uchiwa::params::refresh,
$sensu_api_endpoints = $uchiwa::params::sensu_api_endpoints,
$users = $uchiwa::params::users
$users = $uchiwa::params::users,
$auth = $uchiwa::params::auth
) inherits uchiwa::params {

# validate parameters here
Expand All @@ -151,6 +164,7 @@
validate_integer($refresh)
validate_array($sensu_api_endpoints)
validate_array($users)
validate_hash($auth)

anchor { 'uchiwa::begin': } ->
class { 'uchiwa::install': } ->
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@
$pass = ''
$refresh = '5'
$users = []
$auth = {}
}
10 changes: 8 additions & 2 deletions templates/etc/sensu/uchiwa.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"port": <%= @port %>,
"user": "<%= @user %>",
"pass": "<%= @pass %>",
"refresh": <%= @refresh %><%= ',' if @users.size > 0 %>
"refresh": <%= @refresh %><%= ',' if @users.size > 0 or @auth.size == 2 %>
<%- if @users.size > 0 -%>
"users": [
<%- @users.each_with_index do |user, i| -%>
Expand All @@ -32,7 +32,13 @@
}
}<%= ',' if i < (@users.size - 1) %>
<%- end -%>
]
]<%= ',' if @auth.size == 2 %>
<%- end -%>
<%- if @auth.size == 2 -%>
"auth": {
"publickey": "<%= @auth['publickey'] %>",
"privatekey": "<%= @auth['privatekey'] %>"
}
<%- end -%>
}
}

0 comments on commit 1f12108

Please sign in to comment.