Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Feature: ability to specify multiple certificate authorities #709

Open
adongy opened this issue Aug 4, 2020 · 15 comments
Open

Feature: ability to specify multiple certificate authorities #709

adongy opened this issue Aug 4, 2020 · 15 comments

Comments

@adongy
Copy link

adongy commented Aug 4, 2020

Describe the feature:

I'd like to be able to specify multiple certificate authorities for the security settings of my cluster.

Currently, the playbook only supports a single file:

- name: Upload SSL Certificate Authority
become: yes
copy:
src: "{{ es_ssl_certificate_authority }}"
dest: "{{ es_ssl_certificate_path }}/{{ es_ssl_certificate_authority | basename }}"
owner: "{{ es_user }}"
group: "{{ es_group }}"
mode: "640"
#Restart if this changes
notify: restart elasticsearch
when: (es_ssl_certificate_authority is defined) and (es_ssl_certificate_authority|length > 0)

{% if es_ssl_certificate_authority %}
xpack.security.transport.ssl.certificate_authorities: "{{ es_ssl_certificate_path }}/{{ es_ssl_certificate_authority | basename }}"
{% endif %}

{% if es_ssl_certificate_authority %}
xpack.security.http.ssl.certificate_authorities: "{{ es_ssl_certificate_path }}/{{ es_ssl_certificate_authority | basename }}"
{% endif %}

The official documentation describes the parameters as a "List of paths to PEM encoded certificate files that should be trusted." https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html#_pem_encoded_files_2

My usecase is rolling updates of certificate authorities without cluster downtime.

Currently, Elasticsearch dynamically reloads certificates when they are updated.
When the verification_mode is set to certificate or full, if the new certificate is signed by the CA, the update is transparent: other cluster nodes will still validate the certificate and continue communication.

Best practices for CAs recommend rotating the authority regularly. If there is only one file declared in the configuration, as soon as a node reloads the new authority, it will not accept communication with other cluster nodes that have not updated their certificate to be signed by the new authority.

A solution to this is having multiple certificate authorities declared, replace one of them with the new authority while keeping the old one, update each node's certificates to be signed by the new authority, and remove the old authority at the end.


In our case, the playbook could be updated in a retrocompatible way by checking the variable type: variable is string is true when it's a string and false when it's a list (unfortunately, strings will pass both of the string and sequence test). It should work for both the jinja template and the tasks.

Thanks!

@adongy
Copy link
Author

adongy commented Aug 5, 2020

In addition to this, I'd like to add that since elasticsearch dynamically reloads certificates without the need for a restart, I currently need to set es_restart_on_change to false.

One another solution would be to template the tls part in the elasticsearch.yml configuration file, and mange certificate rotation in a different part of my playbook, but I would need to be able to specify a custom template for elasticsearch.yml.j2, as I am unaware of a feature in Ansible that would allow me to override templates in a role.

@jmlrt jmlrt added the feature label Aug 25, 2020
@botelastic
Copy link

botelastic bot commented Nov 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@adongy
Copy link
Author

adongy commented Nov 24, 2020

I'm still looking for this improvement.

@botelastic botelastic bot removed the triage/stale label Nov 24, 2020
@jmlrt
Copy link
Member

jmlrt commented Nov 24, 2020

Hi @adongy,
Thanks for opening this issue.
Unfortunately we currently don't have time to work on it so please be patient.

@iorfix
Copy link

iorfix commented Nov 30, 2020

Another issue is that it should be better to have a CA for transport layer, and another for "public/beat" connection, i.e. different configs for xpack.security.transport.ssl and xpack.security.http.ssl I have an internal CA that manages cluster nodes, while another one is used to validate inblound connections from clients.

@botelastic
Copy link

botelastic bot commented Feb 28, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@jmlrt
Copy link
Member

jmlrt commented Mar 3, 2021

still valid

@botelastic botelastic bot removed the triage/stale label Mar 3, 2021
@jmlrt
Copy link
Member

jmlrt commented Apr 12, 2021

still valid

@botelastic
Copy link

botelastic bot commented Jul 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@jmlrt
Copy link
Member

jmlrt commented Jul 19, 2021

still valid

@botelastic botelastic bot removed the triage/stale label Jul 19, 2021
@botelastic
Copy link

botelastic bot commented Oct 17, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@jmlrt
Copy link
Member

jmlrt commented Oct 18, 2021

still valid

@botelastic botelastic bot removed the triage/stale label Oct 18, 2021
@botelastic
Copy link

botelastic bot commented Jan 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@sahibthg
Copy link

sahibthg commented Feb 1, 2022

still valid

@botelastic botelastic bot removed the triage/stale label Feb 1, 2022
@botelastic
Copy link

botelastic bot commented Jun 24, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants