2021-03-25 16:52:04 +05:30
|
|
|
heat_template_version: wallaby
|
2016-08-26 12:41:53 -04:00
|
|
|
|
|
|
|
description: >
|
|
|
|
Apache service configured with Puppet. Note this is typically included
|
|
|
|
automatically via other services which run via Apache.
|
|
|
|
|
|
|
|
parameters:
|
2016-09-21 13:53:19 +02:00
|
|
|
ApacheMaxRequestWorkers:
|
|
|
|
default: 256
|
|
|
|
description: Maximum number of simultaneously processed requests.
|
|
|
|
type: number
|
|
|
|
ApacheServerLimit:
|
|
|
|
default: 256
|
|
|
|
description: Maximum number of Apache processes.
|
|
|
|
type: number
|
2017-06-22 17:25:03 +02:00
|
|
|
ServiceData:
|
|
|
|
default: {}
|
|
|
|
description: Dictionary packing service data
|
|
|
|
type: json
|
2016-08-26 12:41:53 -04:00
|
|
|
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
|
2017-02-24 06:27:58 -05:00
|
|
|
RoleName:
|
|
|
|
default: ''
|
|
|
|
description: Role name on which the service is applied
|
|
|
|
type: string
|
|
|
|
RoleParameters:
|
|
|
|
default: {}
|
|
|
|
description: Parameters specific to the role
|
|
|
|
type: json
|
2016-08-26 12:41:53 -04:00
|
|
|
EndpointMap:
|
|
|
|
default: {}
|
|
|
|
description: Mapping of service endpoint -> protocol. Typically set
|
|
|
|
via parameter_defaults in the resource registry.
|
|
|
|
type: json
|
2016-09-26 15:34:10 +00:00
|
|
|
EnableInternalTLS:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2017-05-16 16:38:35 +03:00
|
|
|
InternalTLSCAFile:
|
|
|
|
default: '/etc/ipa/ca.crt'
|
|
|
|
type: string
|
|
|
|
description: Specifies the default CA cert to use if TLS is used for
|
|
|
|
services in the internal network.
|
2020-11-26 09:50:35 -03:00
|
|
|
CertificateKeySize:
|
|
|
|
type: string
|
|
|
|
default: '2048'
|
|
|
|
description: Specifies the private key size used when creating the
|
|
|
|
certificate.
|
|
|
|
ApacheCertificateKeySize:
|
|
|
|
type: string
|
|
|
|
default: ''
|
|
|
|
description: Override the private key size used when creating the
|
|
|
|
certificate for this service
|
2016-09-26 15:34:10 +00:00
|
|
|
|
2017-03-27 13:23:53 +03:00
|
|
|
conditions:
|
|
|
|
|
|
|
|
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
|
2020-11-26 09:50:35 -03:00
|
|
|
key_size_override_unset: {equals: [{get_param: ApacheCertificateKeySize}, '']}
|
2016-09-26 15:34:10 +00:00
|
|
|
|
|
|
|
resources:
|
|
|
|
|
2017-03-27 13:23:53 +03:00
|
|
|
ApacheNetworks:
|
|
|
|
type: OS::Heat::Value
|
2016-09-26 15:34:10 +00:00
|
|
|
properties:
|
2017-03-27 13:23:53 +03:00
|
|
|
value:
|
2019-12-02 10:47:29 +01:00
|
|
|
# NOTE(xek) Get unique network names to create certificates.
|
|
|
|
# We skip the tenant and management network (vip != false)
|
|
|
|
# since we don't generate certificates for those.
|
2018-02-07 22:01:38 +00:00
|
|
|
- ctlplane
|
2021-01-21 16:37:32 +01:00
|
|
|
{%- for network in networks if network.enabled|default(true) and network.vip|default(false) %}
|
2018-02-07 22:01:38 +00:00
|
|
|
- {{network.name_lower}}
|
|
|
|
{%- endfor %}
|
2021-01-21 16:37:32 +01:00
|
|
|
{% raw -%}
|
2016-08-26 12:41:53 -04:00
|
|
|
outputs:
|
|
|
|
role_data:
|
|
|
|
description: Role data for the Apache role.
|
|
|
|
value:
|
|
|
|
service_name: apache
|
|
|
|
config_settings:
|
2016-09-26 15:34:10 +00:00
|
|
|
map_merge:
|
|
|
|
-
|
|
|
|
# for the given network; replacement examples (eg. for internal_api):
|
|
|
|
# internal_api -> IP
|
|
|
|
# internal_api_uri -> [IP]
|
|
|
|
# internal_api_subnet - > IP/CIDR
|
2017-12-08 14:09:17 +00:00
|
|
|
apache::ip:
|
|
|
|
str_replace:
|
|
|
|
template:
|
|
|
|
"%{hiera('$NETWORK')}"
|
|
|
|
params:
|
|
|
|
$NETWORK: {get_param: [ServiceNetMap, ApacheNetwork]}
|
2017-04-27 12:11:12 +02:00
|
|
|
apache::default_vhost: false
|
2018-11-02 12:10:55 +05:30
|
|
|
apache::trace_enable: 'Off'
|
2016-09-26 15:34:10 +00:00
|
|
|
apache::server_signature: 'Off'
|
|
|
|
apache::server_tokens: 'Prod'
|
2020-04-08 10:25:02 -04:00
|
|
|
apache::mod::prefork::maxrequestworkers: { get_param: ApacheMaxRequestWorkers }
|
2019-08-02 10:34:07 +00:00
|
|
|
apache::mod::prefork::serverlimit: { get_param: ApacheServerLimit }
|
2016-09-26 15:34:10 +00:00
|
|
|
apache::mod::remoteip::proxy_ips:
|
2018-11-19 23:21:44 +01:00
|
|
|
get_param:
|
|
|
|
- ServiceData
|
|
|
|
- net_cidr_map
|
|
|
|
- {get_param: [ServiceNetMap, ApacheNetwork]}
|
2019-04-01 14:04:09 +09:00
|
|
|
apache::mod::alias::icons_options: 'None'
|
2017-05-17 12:24:22 +03:00
|
|
|
- if:
|
|
|
|
- internal_tls_enabled
|
|
|
|
-
|
2017-05-16 16:38:35 +03:00
|
|
|
apache::mod::ssl::ssl_ca: {get_param: InternalTLSCAFile}
|
2018-04-19 09:51:20 +03:00
|
|
|
apache::mod::ssl::ssl_protocol: ['all', '-SSLv2', '-SSLv3', '-TLSv1']
|
2017-05-17 12:24:22 +03:00
|
|
|
apache_certificates_specs:
|
|
|
|
map_merge:
|
|
|
|
repeat:
|
|
|
|
template:
|
|
|
|
httpd-NETWORK:
|
|
|
|
service_certificate: '/etc/pki/tls/certs/httpd/httpd-NETWORK.crt'
|
|
|
|
service_key: '/etc/pki/tls/private/httpd/httpd-NETWORK.key'
|
|
|
|
for_each:
|
|
|
|
NETWORK: {get_attr: [ApacheNetworks, value]}
|
|
|
|
- {}
|
2016-12-15 16:20:40 +02:00
|
|
|
metadata_settings:
|
2017-03-27 13:23:53 +03:00
|
|
|
if:
|
|
|
|
- internal_tls_enabled
|
|
|
|
-
|
|
|
|
repeat:
|
|
|
|
template:
|
|
|
|
- service: HTTP
|
|
|
|
network: $NETWORK
|
|
|
|
type: node
|
|
|
|
for_each:
|
|
|
|
$NETWORK: {get_attr: [ApacheNetworks, value]}
|
|
|
|
- null
|
2018-12-04 14:36:12 -05:00
|
|
|
upgrade_tasks: []
|
2021-01-21 16:37:32 +01:00
|
|
|
deploy_steps_tasks:
|
2021-03-17 10:19:54 +01:00
|
|
|
- name: Certificate generation
|
|
|
|
when:
|
|
|
|
- step|int == 1
|
|
|
|
- enable_internal_tls
|
|
|
|
block:
|
|
|
|
- name: Create dirs for certificates and keys
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
serole: object_r
|
|
|
|
setype: cert_t
|
|
|
|
seuser: system_u
|
|
|
|
with_items:
|
|
|
|
- '/etc/pki/tls/certs/httpd'
|
|
|
|
- '/etc/pki/tls/private/httpd'
|
|
|
|
- include_role:
|
|
|
|
name: linux-system-roles.certificate
|
|
|
|
vars:
|
|
|
|
certificate_requests:
|
|
|
|
repeat:
|
|
|
|
template:
|
|
|
|
name: httpd-NETWORK
|
|
|
|
dns: "{{fqdn_NETWORK}}"
|
|
|
|
principal: "HTTP/{{fqdn_NETWORK}}@{{idm_realm}}"
|
|
|
|
run_after: |
|
|
|
|
cp /etc/pki/tls/certs/httpd-NETWORK.crt /etc/pki/tls/certs/httpd/httpd-NETWORK.crt
|
|
|
|
cp /etc/pki/tls/private/httpd-NETWORK.key /etc/pki/tls/private/httpd/httpd-NETWORK.key
|
|
|
|
pkill -USR1 httpd
|
|
|
|
key_size:
|
|
|
|
if:
|
|
|
|
- key_size_override_unset
|
|
|
|
- {get_param: CertificateKeySize}
|
|
|
|
- {get_param: ApacheCertificateKeySize}
|
|
|
|
ca: ipa
|
|
|
|
for_each:
|
|
|
|
NETWORK: {get_attr: [ApacheNetworks, value]}
|
2021-01-21 16:37:32 +01:00
|
|
|
{%- endraw %}
|