Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set kafka_broker.key permissions (removes when) Fixes #1590 #1591

Open
wants to merge 1 commit into
base: 7.6.1-post
Choose a base branch
from

Conversation

linsomniac
Copy link

@linsomniac linsomniac commented May 9, 2024

This patch is related to issue #1590, see that for further discussion.

edit: I was referring to the wrong task when I originally wrote this up, updating below.

Permissions on the /var/ssl/private/kafka_broker.key file are publicly readable. Upon further investigation it looks to be conditional, dependent on
export_certs ansible var, and if that is set to true, the key file is protected. export_certs is set based on kafka_broker_export_certs, which in turn is set to ssl_mutual_auth_enabled.

It seems like in any case you'd want the broker key to be protected.

- name: Set Cert and Key File Permissions
  file:
    path: "{{item}}"
    owner: "{{user}}"
    group: "{{group}}"
    mode: '640'
  loop:
    - "{{ca_cert_path}}"
    - "{{cert_path}}"
    - "{{key_path}}"
  when: export_certs|bool

In reading the git history (and checking back in 6.2.15-post where the 640 permission was last changed from int to string), I'm under the impression that the "when" condition was blanket applied to the tasks in this role, when it probably shouldn't have been applied to this permission setting. In 7.5.3, this when condition was when: export_certs|bool where export_certs: "{{ssl_mutual_auth_enabled}}"

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

I have not tested this.

Checklist:

  • Any variable/code changes have been validated to be backwards compatible (doesn't break upgrade)
  • I have added tests that prove my fix is effective or that my feature works
  • If required, I have ensured the changes can be discovered by cp-ansible discovery codebase
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

This patch is related to issue confluentinc#1590, see that for further discussion.

Permissions on the /var/ssl/private/kafka_broker.key file are
publicly readable.  Upon further investigation it looks to be
conditional, dependent on
`ssl_provided_keystore_and_truststore_remote_src`, and if that is
set to false, the keystore is protected.

It seems like in any case you'd want it to be protected.

This looks like in 7.5.3 it is related to the
setting ssl_mutual_auth_enabled and in 7.6.1 the
ssl_provided_keystore_and_trustore_remote_src setting. The block in
question is, in 7.6.1-post:

- name: Set Truststore and Keystore File Permissions
  file:
    path: "{{item}}"
    owner: "{{user}}"
    group: "{{group}}"
    mode: '640'
  loop:
    - "{{keystore_path}}"
    - "{{truststore_path}}"
  when: not ( ssl_provided_keystore_and_truststore_remote_src|bool )

In reading the git history (and checking back in 6.2.15-post where
the 640 permission was last changed from int to string), I'm under the
impression that the "when" condition was blanket applied to the tasks in
this role, when it probably shouldn't have been applied to this permission
setting. In 7.5.3, this when condition was when: export_certs|bool where
export_certs: "{{ssl_mutual_auth_enabled}}"
@linsomniac linsomniac requested a review from a team as a code owner May 9, 2024 22:20
Copy link

cla-assistant bot commented May 9, 2024

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

1 participant