Pass hieradata for internal TLS for RabbitMQ

As with other services, this passes the necessary hieradata to enable
TLS for RabbitMQ. This will mean (once we set it via puppet-tripleo)
that there will only be TLS connections, as the ssl_only option is being
used.

bp tls-via-certmonger

Change-Id: I960bf747cd5e3040f99b28e2fc5873ca3a7472b5
Depends-On: Ic2a7f877745a0a490ddc9315123bd1180b03c514
This commit is contained in:
Juan Antonio Osorio Robles 2016-12-09 15:22:42 +02:00
parent 1f79a5b76c
commit 1992282b88
5 changed files with 123 additions and 46 deletions

View File

@ -2,6 +2,7 @@
# a TLS for in the internal network via certmonger # a TLS for in the internal network via certmonger
parameter_defaults: parameter_defaults:
EnableInternalTLS: true EnableInternalTLS: true
RabbitClientUseSSL: true
# Required for novajoin to enroll the overcloud nodes # Required for novajoin to enroll the overcloud nodes
ServerMetadata: ServerMetadata:
@ -11,6 +12,8 @@ resource_registry:
OS::TripleO::Services::HAProxyInternalTLS: ../puppet/services/haproxy-internal-tls-certmonger.yaml OS::TripleO::Services::HAProxyInternalTLS: ../puppet/services/haproxy-internal-tls-certmonger.yaml
OS::TripleO::Services::ApacheTLS: ../puppet/services/apache-internal-tls-certmonger.yaml OS::TripleO::Services::ApacheTLS: ../puppet/services/apache-internal-tls-certmonger.yaml
OS::TripleO::Services::MySQLTLS: ../puppet/services/database/mysql-internal-tls-certmonger.yaml OS::TripleO::Services::MySQLTLS: ../puppet/services/database/mysql-internal-tls-certmonger.yaml
OS::TripleO::Services::RabbitMQTLS: ../puppet/services/rabbitmq-internal-tls-certmonger.yaml
# We use apache as a TLS proxy # We use apache as a TLS proxy
OS::TripleO::Services::TLSProxyBase: ../puppet/services/apache.yaml OS::TripleO::Services::TLSProxyBase: ../puppet/services/apache.yaml

View File

@ -169,6 +169,7 @@ resource_registry:
OS::TripleO::Services::PacemakerRemote: OS::Heat::None OS::TripleO::Services::PacemakerRemote: OS::Heat::None
OS::TripleO::Services::NeutronSriovAgent: OS::Heat::None OS::TripleO::Services::NeutronSriovAgent: OS::Heat::None
OS::TripleO::Services::RabbitMQ: puppet/services/rabbitmq.yaml OS::TripleO::Services::RabbitMQ: puppet/services/rabbitmq.yaml
OS::TripleO::Services::RabbitMQTLS: OS::Heat::None
OS::TripleO::Services::HAproxy: puppet/services/haproxy.yaml OS::TripleO::Services::HAproxy: puppet/services/haproxy.yaml
OS::TripleO::Services::HAProxyPublicTLS: OS::Heat::None OS::TripleO::Services::HAProxyPublicTLS: OS::Heat::None
OS::TripleO::Services::HAProxyInternalTLS: OS::Heat::None OS::TripleO::Services::HAProxyInternalTLS: OS::Heat::None

View File

@ -68,3 +68,5 @@ outputs:
fi fi
pcs resource update rabbitmq set_policy='ha-all ^(?!amq\\.).* {"ha-mode":"exactly","ha-params":'"$nr_queues}" --wait=600 pcs resource update rabbitmq set_policy='ha-all ^(?!amq\\.).* {"ha-mode":"exactly","ha-params":'"$nr_queues}" --wait=600
when: is_bootstrap_node and migrate_rabbit_ha_mode when: is_bootstrap_node and migrate_rabbit_ha_mode
metadata_settings:
get_attr: [RabbitMQServiceBase, role_data, metadata_settings]

View File

@ -0,0 +1,47 @@
heat_template_version: ocata
description: >
RabbitMQ configurations for using TLS via certmonger.
parameters:
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
# The following parameters are not needed by the template but are
# required to pass the pep8 tests
DefaultPasswords:
default: {}
type: json
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
outputs:
role_data:
description: RabbitMQ configurations for using TLS via certmonger.
value:
service_name: rabbitmq_internal_tls_certmonger
config_settings:
generate_service_certificates: true
tripleo::profile::base::rabbitmq::certificate_specs:
service_certificate: '/etc/pki/tls/certs/rabbitmq.crt'
service_key: '/etc/pki/tls/private/rabbitmq.key'
hostname:
str_replace:
template: "%{hiera('fqdn_NETWORK')}"
params:
NETWORK: {get_param: [ServiceNetMap, RabbitmqNetwork]}
principal:
str_replace:
template: "rabbitmq/%{hiera('fqdn_NETWORK')}"
params:
NETWORK: {get_param: [ServiceNetMap, RabbitmqNetwork]}
metadata_settings:
- service: rabbitmq
network: {get_param: [ServiceNetMap, RabbitmqNetwork]}
type: node

View File

@ -48,6 +48,18 @@ parameters:
MonitoringSubscriptionRabbitmq: MonitoringSubscriptionRabbitmq:
default: 'overcloud-rabbitmq' default: 'overcloud-rabbitmq'
type: string type: string
EnableInternalTLS:
type: boolean
default: false
resources:
RabbitMQTLS:
type: OS::TripleO::Services::RabbitMQTLS
properties:
ServiceNetMap: {get_param: ServiceNetMap}
DefaultPasswords: {get_param: DefaultPasswords}
EndpointMap: {get_param: EndpointMap}
outputs: outputs:
role_data: role_data:
@ -56,51 +68,62 @@ outputs:
service_name: rabbitmq service_name: rabbitmq
monitoring_subscription: {get_param: MonitoringSubscriptionRabbitmq} monitoring_subscription: {get_param: MonitoringSubscriptionRabbitmq}
config_settings: config_settings:
rabbitmq::file_limit: {get_param: RabbitFDLimit} map_merge:
rabbitmq::default_user: {get_param: RabbitUserName} - get_attr: [RabbitMQTLS, role_data, config_settings]
rabbitmq::default_pass: {get_param: RabbitPassword} -
rabbit_ipv6: {get_param: RabbitIPv6} rabbitmq::file_limit: {get_param: RabbitFDLimit}
tripleo.rabbitmq.firewall_rules: rabbitmq::default_user: {get_param: RabbitUserName}
'109 rabbitmq': rabbitmq::default_pass: {get_param: RabbitPassword}
dport: rabbit_ipv6: {get_param: RabbitIPv6}
- 4369 tripleo.rabbitmq.firewall_rules:
- 5672 '109 rabbitmq':
- 25672 dport:
rabbitmq::delete_guest_user: false - 4369
rabbitmq::wipe_db_on_cookie_change: true - 5672
rabbitmq::port: '5672' - 25672
rabbitmq::package_provider: yum rabbitmq::delete_guest_user: false
rabbitmq::package_source: undef rabbitmq::wipe_db_on_cookie_change: true
rabbitmq::repos_ensure: false rabbitmq::port: '5672'
rabbitmq::tcp_keepalive: true rabbitmq::package_provider: yum
rabbitmq_environment: rabbitmq::package_source: undef
NODE_PORT: '' rabbitmq::repos_ensure: false
NODE_IP_ADDRESS: '' rabbitmq::tcp_keepalive: true
RABBITMQ_NODENAME: "rabbit@%{::hostname}" rabbitmq_environment:
RABBITMQ_SERVER_ERL_ARGS: '"+K true +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]"' NODE_PORT: ''
'export ERL_EPMD_ADDRESS': "%{hiera('rabbitmq::interface')}" NODE_IP_ADDRESS: ''
rabbitmq_kernel_variables: RABBITMQ_NODENAME: "rabbit@%{::hostname}"
inet_dist_listen_min: '25672' RABBITMQ_SERVER_ERL_ARGS: '"+K true +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]"'
inet_dist_listen_max: '25672' 'export ERL_EPMD_ADDRESS': "%{hiera('rabbitmq::interface')}"
rabbitmq_config_variables: rabbitmq_kernel_variables:
cluster_partition_handling: 'pause_minority' inet_dist_listen_min: '25672'
queue_master_locator: '<<"min-masters">>' inet_dist_listen_max: '25672'
loopback_users: '[]' rabbitmq_config_variables:
rabbitmq::erlang_cookie: cluster_partition_handling: 'pause_minority'
yaql: queue_master_locator: '<<"min-masters">>'
expression: $.data.passwords.where($ != '').first() loopback_users: '[]'
data: rabbitmq::erlang_cookie:
passwords: yaql:
- {get_param: RabbitCookie} expression: $.data.passwords.where($ != '').first()
- {get_param: [DefaultPasswords, rabbit_cookie]} data:
# NOTE: bind IP is found in Heat replacing the network name with the passwords:
# local node IP for the given network; replacement examples - {get_param: RabbitCookie}
# (eg. for internal_api): - {get_param: [DefaultPasswords, rabbit_cookie]}
# internal_api -> IP # NOTE: bind IP is found in Heat replacing the network name with the
# internal_api_uri -> [IP] # local node IP for the given network; replacement examples
# internal_api_subnet - > IP/CIDR # (eg. for internal_api):
rabbitmq::interface: {get_param: [ServiceNetMap, RabbitmqNetwork]} # internal_api -> IP
rabbitmq::nr_ha_queues: {get_param: RabbitHAQueues} # internal_api_uri -> [IP]
# internal_api_subnet - > IP/CIDR
rabbitmq::interface: {get_param: [ServiceNetMap, RabbitmqNetwork]}
rabbitmq::nr_ha_queues: {get_param: RabbitHAQueues}
rabbitmq::ssl: {get_param: EnableInternalTLS}
rabbitmq::ssl_port: '5672'
rabbitmq::ssl_depth: 1
rabbitmq::ssl_only: {get_param: EnableInternalTLS}
rabbitmq::ssl_interface: {get_param: [ServiceNetMap, RabbitmqNetwork]}
# TODO(jaosorior): Remove this once we set a proper default in
# puppet-tripleo
tripleo::profile::base::rabbitmq::enable_internal_tls: {get_param: EnableInternalTLS}
step_config: | step_config: |
include ::tripleo::profile::base::rabbitmq include ::tripleo::profile::base::rabbitmq
upgrade_tasks: upgrade_tasks:
@ -110,4 +133,5 @@ outputs:
- name: Start rabbitmq service - name: Start rabbitmq service
tags: step4 tags: step4
service: name=rabbitmq-server state=started service: name=rabbitmq-server state=started
metadata_settings:
get_attr: [RabbitMQTLS, role_data, metadata_settings]