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

Move wazuh certificates #647

Merged

Conversation

jovial
Copy link
Contributor

@jovial jovial commented Sep 15, 2023

Wazuh certificates were stored in etc/kayobe/ansible/wazuh/certificates or etc/kayobe/ansible/wazuh/custom_certificates. There are a few issues with these locations:

  • they are in the base configuration, so not scoped to a Kayobe environment. This means that multiple environments could have duplicate certificates

  • it’s under the ansible directory, but isn’t really Ansible code - it’s configuration

@jackhodgkiss pointed out that we can use the same directory for custom certificates and auto-generated certificates

@jovial jovial requested a review from a team as a code owner September 15, 2023 17:41
Wazuh certificates were stored in etc/kayobe/ansible/wazuh/certificates
or etc/kayobe/ansible/wazuh/custom_certificates.  There are a few issues
with these locations:

- they are in the base configuration, so not scoped
to a Kayobe environment. This means that multiple environments could
have duplicate certificates

- it’s under the ansible directory, but isn’t
really Ansible code - it’s configuration

@jackhodgkiss pointed out that we can use the same directory for custom
certificates and auto-generated certificates
@jovial jovial force-pushed the feature/environment-aware-wazuh-certificates branch from 0a36022 to 788e709 Compare September 15, 2023 17:43
@jovial jovial changed the base branch from stackhpc/yoga to stackhpc/2023.1 September 15, 2023 17:43
.gitignore Show resolved Hide resolved
doc/source/configuration/wazuh.rst Outdated Show resolved Hide resolved
etc/kayobe/ansible/wazuh-manager.yml Outdated Show resolved Hide resolved
etc/kayobe/ansible/wazuh-manager.yml Show resolved Hide resolved
releasenotes/notes/moved-wazuh-certs-b5173d264f543b14.yaml Outdated Show resolved Hide resolved
etc/kayobe/ansible/wazuh-manager.yml Outdated Show resolved Hide resolved
doc/source/configuration/wazuh.rst Outdated Show resolved Hide resolved
doc/source/configuration/wazuh.rst Outdated Show resolved Hide resolved
doc/source/configuration/wazuh.rst Outdated Show resolved Hide resolved
etc/kayobe/ansible/wazuh-manager.yml Outdated Show resolved Hide resolved
releasenotes/notes/moved-wazuh-certs-b5173d264f543b14.yaml Outdated Show resolved Hide resolved
releasenotes/notes/moved-wazuh-certs-b5173d264f543b14.yaml Outdated Show resolved Hide resolved
releasenotes/notes/moved-wazuh-certs-b5173d264f543b14.yaml Outdated Show resolved Hide resolved
releasenotes/notes/moved-wazuh-certs-b5173d264f543b14.yaml Outdated Show resolved Hide resolved
releasenotes/notes/moved-wazuh-certs-b5173d264f543b14.yaml Outdated Show resolved Hide resolved
@jovial jovial marked this pull request as draft September 19, 2023 13:50
doc/source/configuration/wazuh.rst Outdated Show resolved Hide resolved
doc/source/configuration/wazuh.rst Outdated Show resolved Hide resolved
@jovial jovial marked this pull request as ready for review September 19, 2023 15:46
@jovial jovial requested a review from markgoddard September 19, 2023 15:47
Was hard to get both examples working with git mv, so I've removed
them.
etc/kayobe/wazuh/certificates/certs/.gitkeep Outdated Show resolved Hide resolved
etc/kayobe/ansible/wazuh-manager.yml Outdated Show resolved Hide resolved
etc/kayobe/ansible/wazuh-manager.yml Outdated Show resolved Hide resolved
etc/kayobe/ansible/wazuh-manager.yml Outdated Show resolved Hide resolved
releasenotes/notes/moved-wazuh-certs-b5173d264f543b14.yaml Outdated Show resolved Hide resolved
@markgoddard
Copy link
Contributor

I think at this point someone needs to do some testing.

@jovial
Copy link
Contributor Author

jovial commented Sep 28, 2023

This is what the help text looks like:

TASK [Fail if using old path for Wazuh certificates] ************************************************************************************************************************
Thursday 28 September 2023  11:03:27 +0000 (0:00:00.071)       0:00:00.071 **** 
fatal: [localhost]: FAILED! => changed=false 
  msg: The path used for Wazuh SSL certificates was changed in a previous release. The certificates were found in the wrong location. Please move all files and directories in /home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/ansible/wazuh/certificates to /home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/environments/test/wazuh/ and remove the empty directory.

PLAY RECAP ******************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Thursday 28 September 2023  11:03:27 +0000 (0:00:00.107)       0:00:00.179 **** 
=============================================================================== 
Fail if using old path for Wazuh certificates ------------------------------------------------------------------------------------------------------------------------ 0.11s
Kayobe playbook(s) etc/kayobe/ansible/wazuh-manager.yml exited 2
(venv-kayobe2) [cloud-user@kayobe-aio kayobe-config]$ tree /home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/ansible/wazuh/certificates
/home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/ansible/wazuh/certificates
├── config.yml
├── wazuh-certificates
│   ├── admin-key.pem
│   ├── admin.pem
│   ├── localhost-key.pem
│   ├── localhost.pem
│   ├── root-ca.key
│   └── root-ca.pem
└── wazuh-certs-tool.sh

1 directory, 8 files

For which you do:

  249  mkdir /home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/environments/test/wazuh/
  250  mv /home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/ansible/wazuh/certificates/* /home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/environments/test/wazuh/
  251  rmdir /home/cloud-user/kayobe/kayobe/config/src/kayobe-config/etc/kayobe/ansible/wazuh/certificates

@jovial
Copy link
Contributor Author

jovial commented Sep 28, 2023

I think at this point someone needs to do some testing.

done

Copy link
Contributor

@markgoddard markgoddard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff, thanks!

@markgoddard markgoddard merged commit d5f5d22 into stackhpc/2023.1 Oct 6, 2023
4 checks passed
@markgoddard markgoddard deleted the feature/environment-aware-wazuh-certificates branch October 6, 2023 09:31
@markgoddard
Copy link
Contributor

Just noticed this went into antelope. Shouldn't it have gone into yoga?

@jovial
Copy link
Contributor Author

jovial commented Oct 6, 2023

Just noticed this went into antelope. Shouldn't it have gone into yoga?

Possibly. Isn't it a breaking change though?

@markgoddard
Copy link
Contributor

Just noticed this went into antelope. Shouldn't it have gone into yoga?

Possibly. Isn't it a breaking change though?

I'd call it an unbreaking change, but potato potato...

@markgoddard
Copy link
Contributor

Just noticed this went into antelope. Shouldn't it have gone into yoga?

Possibly. Isn't it a breaking change though?

I'd call it an unbreaking change, but potato potato...

It's worth a discussion, but I'd suggest squashing and cherry picking to yoga, then announcing in Slack about the change. Your nice prechecks should catch any issues.

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.

3 participants