Skip to content

Commit 243f9a0

Browse files
author
Tristan Stevens
committed
Merge branch 'devel' into main
2 parents d6a96c4 + f6dc87c commit 243f9a0

15 files changed

+1141
-1
lines changed

docs/freeipa.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# FreeIPA
2+
3+
FreeIPA is a product that provides (not exhaustive):
4+
5+
- CA
6+
- KDC
7+
- LDAP
8+
- Host management (including SSSD)
9+
10+
The playbook is able to provision a FreeIPA server, or use an existing FreeIPA server, and automatically setup the cluster to make use of the CA, KDC and LDAP.
11+
12+
Before continuing, a few questions you may want to ask yourself are:
13+
14+
1. Are you using an existing FreeIPA server(s) or do you want the playbook to provision one?
15+
2. Do you want to use the FreeIPA CA to sign the certificates or do you want to sign them externally?
16+
3. Are you using AutoTLS or do you want the playbook to configure the host keys and certificates?
17+
18+
## Common steps
19+
20+
Regardless of how you choose to use FreeIPA in your deployment, you'll have to set the following variables via the definition file:
21+
22+
- `krb5_realm` (e.g. `CLOUDERA.LOCAL`)
23+
- `krb5_kdc_admin_user` (e.g. the FreeIPA default `admin@{{ krb5_realm }}`)
24+
- `krb5_kdc_admin_password` (e.g. `{{ ipaadmin_password }}`)
25+
- `krb5_enc_types` (e.g. `aes256-cts aes128-cts`)
26+
27+
You must also set `krb5_kdc_type: "Red Hat IPA"`.
28+
29+
## Existing FreeIPA or playbook-provisioned?
30+
31+
### Existing FreeIPA
32+
33+
This case is simple:
34+
35+
Please set `krb5_kdc_host` to you FreeIPA server hostname.
36+
37+
### Playbook-provisioned
38+
39+
Here, you'll need to add a host to `krb5_server` and set the following variables:
40+
41+
- `ipaadmin_password`
42+
- `ipadm_password`
43+
44+
The playbook will recognize that `krb5_kdc_type` is set to `Red Hat IPA` and bring up a FreeIPA server instead of MIT KDC.
45+
46+
The playbook will not provision a firewall around the FreeIPA server.
47+
48+
## FreeIPA CA signed certificates or externally signed certificates?
49+
50+
In both cases, you'll want to refer to each CA certificate used (particularly important if you are using a different CA) by adding entries to `tls_ca_certs` e.g. (IPA CA)
51+
52+
```
53+
tls_ca_certs:
54+
- path: /etc/ipa/ca.crt
55+
alias: ipaca
56+
```
57+
58+
### FreeIPA CA signed certificates
59+
60+
Here, nothing has to be done.
61+
62+
Provided each host is enrolled as a FreeIPA client then the playbook will automatically sign (~~and enable the renewal of~~ ZOOKEEPER-3832) the host certificates using the hosts principal.
63+
64+
### Externally signed certificates
65+
66+
In this case, please set `skip_ipa_signing` to `true`.
67+
68+
This will cause the playbook to stop after generating CSRs – identical to the non-FreeIPA case.
69+
70+
## AutoTLS or playbook configured?
71+
72+
### AutoTLS
73+
74+
#### CM provisioned CA
75+
76+
Remove any mention of TLS from the cluster definition and enable AutoTLS using the API or wizard.
77+
78+
You may need to add the FreeIPA to the CA certs (via the API or wizard).
79+
80+
#### FreeIPA or externally provisioned certificates
81+
82+
Here, you'll want to unset any TLS configurations in the `definition.yml` file. This is because AutoTLS takes on the role of configuring the cluster here.
83+
84+
You'll then need to enable AutoTLS using the certificates provisioned (by default) under `/opt/cloudera/security/pki` using the API https://blog.cloudera.com/auto-tls-in-cloudera-data-platform-data-center/ immediately after installing the Cloudera Manager.
85+
86+
You can then continue with the playbook installation.
87+
88+
## LDAP configs
89+
90+
To setup LDAP in CM and services automatically, we'll need to first define an auth provider.
91+
92+
For FreeIPA, it might look something like:
93+
94+
```
95+
base_dn: "dc={{ (krb5_realm | lower).split('.') | join(',dc=') }}"
96+
user_dn: "cn=users,cn=accounts,{{ base_dn }}"
97+
group_dn: "cn=groups,cn=accounts,{{ base_dn }}"
98+
99+
auth_providers:
100+
freeipa:
101+
ldap_bind_user_dn: "uid=admin,{{ user_dn }}"
102+
ldap_bind_password: "{{ ipaadmin_password }}"
103+
ldap_search_base:
104+
user: "{{ user_dn }}"
105+
group: "{{ group_dn }}"
106+
ldap_object_class:
107+
user: "person"
108+
group: "groupofnames"
109+
ldap_attribute:
110+
user: "uid"
111+
group: "cn"
112+
member: "member"
113+
type: LDAP
114+
ldap_url: "ldaps://{{ groups.krb5_server | first }}"
115+
```
116+
117+
Once the auth provider is defined, we need to configure the playbook to use it to:
118+
119+
Configure CM:
120+
121+
```
122+
cloudera_manager_external_auth:
123+
provider: freeipa
124+
external_first: yes
125+
external_only: no
126+
role_mappings:
127+
- group: CMTestGroup1
128+
roles: [ROLE_ADMIN]
129+
```
130+
131+
Configure the services:
132+
133+
```
134+
service_auth_provider: freeipa
135+
```

docs/getting-started.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Getting Started
2+
3+
cloudera.cluster is now an Ansible Galaxy collection and must therefore be used as part of a standalone playbook.
4+
5+
For further details, please see https://github.com/cloudera-labs/cloudera-deploy
6+
7+
Note: The docs in this section cover how to configure various aspects of this collection.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# How to: Clear CA Server state
2+
3+
The CA Server (using `openssl ca`) can be used to sign the host certificates used to deploy the cluster.
4+
5+
There may be cases where you wish to replace the host keys and certificates.
6+
7+
# Replace the CA
8+
9+
On each host in the cluster, move or delete the following directory:
10+
11+
```
12+
/opt/cloudera/security/pki
13+
```
14+
15+
On the `ca_server` host, move or delete the following directory:
16+
17+
```
18+
/ca
19+
```
20+
21+
Re-run the playbook.
22+
23+
# Keep the CA but replace host certificates
24+
25+
On each host in the cluster where you wish to replace the host keys and certificates, move or delete the following directory:
26+
27+
```
28+
/opt/cloudera/security/pki
29+
```
30+
31+
On the `ca_server` host, execute the following for each host you wish to replace:
32+
33+
```
34+
openssl ca -config /ca/intermediate/openssl.cnf -revoke /ca/intermediate/cert/<host-certificate>.pem -passin pass:<ca-password>
35+
```
36+
37+
__Note:__ The default CA password is `password` and can be configured by setting:
38+
39+
- `ca_server_root_key_password`
40+
- `ca_server_intermediate_key_password`
41+
42+
Now move or delete the corresponding host certificates from:
43+
44+
```
45+
/ca/intermediate/cert
46+
```
47+
48+
Re-run the playbook.
49+
50+
__Note:__ You can skip the revoke step by setting `unique_subject` in `/ca/intermediate/index.txt.attr` to `no`.
51+
52+
__Note:__ The CA Server is meant for testing only. Please use an enterprise CA Server in production.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# How to: Database Configuration
2+
3+
This guide will run through the specifics of explicitly configuring databases for Cloudera Manager and the cluster services.
4+
5+
It assumes you are already familiar with deploying standard clusters using these playbooks.
6+
7+
### Create a cluster definition
8+
9+
Create the cluster definition you wish to deploy.
10+
11+
### Configure the Cloudera Manager database
12+
13+
Add the following variables to `definition.yml`:
14+
15+
- `cloudera_manager_database_host`
16+
- `cloudera_manager_database_name`
17+
- `cloudera_manager_database_user`
18+
- `cloudera_manager_database_password`
19+
20+
You can also set the following variable if the Cloudera Manager database type is different from the global `database_type` setting:
21+
22+
- `cloudera_manager_database_type`
23+
24+
### Configure the cluster service databases
25+
26+
**Note:** The type of every service database is expected match `database_type` (default postgres).
27+
28+
For each cluster in the cluster list, add a dictionary entry `databases:`, level with `configs:`.
29+
30+
Add an entry to the `databases:` dictionary for each service that requires a database. The service label should match the label in `services:` and `configs:`.
31+
32+
For each service, set the following variables:
33+
34+
- `name` (name of the database)
35+
- `host`
36+
- `user`
37+
- `password`
38+
39+
Following these changes, your clusters should look like:
40+
41+
```
42+
clusters:
43+
- name: Test Cluster
44+
services: [HDFS, ...]
45+
databases:
46+
HIVE:
47+
name: "metastore"
48+
host: "db-1.example.com"
49+
user: "hive"
50+
password: "{{ hive_password }}"
51+
...
52+
...
53+
...
54+
```
55+
56+
### Configure the mgmt databases
57+
58+
**Note:** The type of every mgmt role database is expected match `database_type` (default postgres).
59+
60+
To config mgmt databases, following the method explained above for clusters, placing `databases:` in `mgmt:`.
61+
62+
Following these changes, mgmt should look like:
63+
64+
```
65+
mgmt:
66+
name: Cloudera Management Service
67+
services: [REPORTSMANAGER, ...]
68+
databases:
69+
REPORTSMANAGER:
70+
name: "rman"
71+
host: "db-2.example.com"
72+
user: "rman"
73+
password: "{{ rman_password }}"
74+
...
75+
...
76+
```
77+
78+
### **Deploy!**
79+
80+
**Note:** If the configured database host is provisioned by the playbook (part of the `db_servers` host group) the database will be created automatically.

docs/how-to/externally-signed.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# How to: Setup externally signed TLS certificates
2+
3+
The playbook is able to provision an internal CA and automatically sign the host certificates.
4+
5+
However, it is more likely that an external CA will be used in production environments.
6+
7+
This guide will run through specifics for deploying clusters using an external CA to sign the host certificates.
8+
9+
At a high-level, the playbook generates and distributes the TLS keys and certificates in three steps:
10+
11+
- Phase 1 (generation)
12+
* Create the host keys
13+
* Generate the keystores
14+
* Generate the CSRs
15+
* Copy the CSRs to the Ansible controller
16+
- Phase 2 (signing)
17+
* Sign the certificates
18+
- Phase 3 (installation)
19+
* Copy the signed certificates to the hosts
20+
* Copy the CA certificates to the hosts
21+
22+
When `ca_server` is used, this all occurs automatically.
23+
24+
However, when an external CA is used, a few manual steps are required to complete the deployment:
25+
26+
Starting with the definition, assuming nothing has been deployed:
27+
28+
## Ensure that `ca_server` is **not** present in the inventory
29+
30+
The `ca_server` is the playbook's internal CA.
31+
32+
As we wish to use an external CA, it should be omitted from the inventory file.
33+
34+
## Set `tls_ca_certs` to point to the external CA certificates
35+
36+
Here, we need to set `tls_ca_certs` in `defintion.yml` to point to the external CA certificates (on the Ansible controller):
37+
38+
```
39+
tls_ca_certs:
40+
- alias: ipaca
41+
path: /root/ca.crt
42+
```
43+
44+
In this example, our CA certificate exists on the Ansible controller at `/root/ca.crt`.
45+
46+
**Note:** If you have an intermediate CA and a root CA, please include both certificates here.
47+
48+
## Run the playbook deployment as usual
49+
50+
If everything is configured correctly, it should run as usual until we reach `prepare_tls.yml`.
51+
52+
Here, in `prepare_tls.yml`, it will fail with a message:
53+
54+
> Signed cert for <hostname> could not be found. If manual signing is required, do this now and re-run the playbook with 'tls_signed_certs_dir' variable set.
55+
56+
E.g.
57+
58+
```
59+
TASK [security/tls_install_certs : fail] **************************************************************************************************************
60+
fatal: [host-1.example.com] FAILED! => {"changed": false, "msg": "\"Signed cert for host-1.example.com could not be found. If manual signing is required, do this now and re-run the playbook with 'tls_signed_certs_dir' variable set.\n"}
61+
fatal: [host-2.example.com] FAILED! => {"changed": false, "msg": "\"Signed cert for host-1.example.com could not be found. If manual signing is required, do this now and re-run the playbook with 'tls_signed_certs_dir' variable set.\n"}
62+
fatal: [host-3.example.com] FAILED! => {"changed": false, "msg": "\"Signed cert for host-1.example.com could not be found. If manual signing is required, do this now and re-run the playbook with 'tls_signed_certs_dir' variable set.\n"}
63+
fatal: [host-4.example.com] FAILED! => {"changed": false, "msg": "\"Signed cert for host-1.example.com could not be found. If manual signing is required, do this now and re-run the playbook with 'tls_signed_certs_dir' variable set.\n"}
64+
```
65+
66+
This is expected.
67+
68+
At this point, the playbook will have generated the TLS keys and CSRs and copied the CSRs to the Ansible controller (stage 1).
69+
70+
It is up to us now to sign the CSRs and copy the signed certificates back to the Ansible controller:
71+
72+
## Sign the CSRs generated by the playbook
73+
74+
You will find copies of the TLS CSRs in `{{ local_temp_dir }}/csrs` on the Ansible controller (default `/tmp/csrs`).
75+
76+
```
77+
# ls /tmp/csrs
78+
host-1.example.com.csr host-3.example.com.csr
79+
host-2.example.com.csr host-4.example.com.csr
80+
```
81+
82+
Sign the CSRs and copy the signed certificates to the Ansible controller using the same filename, replacing `.csr` with `.pem`.
83+
84+
Place these signed certificates in `{{ local_temp_dir }}/certs` on the Ansible controller (default `/tmp/certs`).
85+
86+
```
87+
# ls /tmp/certs
88+
host-1.example.com.pem host-3.example.com.pem
89+
host-2.example.com.pem host-4.example.com.pem
90+
```
91+
92+
## Rerun the playbook
93+
94+
The playbook can be restarted now that the signed certificates exist on the Ansible controller (stage 2).
95+
96+
The playbook will distribute the new signed certificates and continue as usual.
97+
98+
No other steps are required.

0 commit comments

Comments
 (0)