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

Allow proxy registration via agent role #697

Merged
merged 44 commits into from
Jan 7, 2025

Conversation

ra2xfael
Copy link

To register agents proxy-registration can be used on a separate machine, which is already fully provisioned (tls registered). This allows the role user to keep the firewall between ansible target and CheckMK server closed. The proxy-registration port only needs to be open between delegation target and server.

Pull request type

  • Feature

What is the current behavior?

Proxy registration is not possible using the agent ansible role. Regular registration needs to be used or proxy registration executed manually.

What is the new behavior?

  • cmk-agent-ctl proxy-registration is executed automatically on a delegate target and the encryption key is directly imported on the ansible target.
  • The new variable checkmk_agent_delegate_registration is introduced by default. To set it checkmk_agent_proxy_registration can be used.

@github-actions github-actions bot added documentation Improvements or additions to documentation role:agent This affects the agent role labels Nov 25, 2024
Copy link

github-actions bot commented Nov 25, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ra2xfael ra2xfael marked this pull request as ready for review November 25, 2024 14:40
@robin-checkmk
Copy link
Member

@ra2xfael Please follow the instructions from the CLA bot, for us to be able to merge this PR (pending review).

@robin-checkmk robin-checkmk self-assigned this Nov 25, 2024
@ra2xfael ra2xfael marked this pull request as draft November 25, 2024 16:04
@ra2xfael ra2xfael marked this pull request as ready for review November 25, 2024 16:06
dependabot bot and others added 3 commits December 2, 2024 05:08
Bumps [tomli](https://github.com/hukkin/tomli) from 2.1.0 to 2.2.1.
- [Changelog](https://github.com/hukkin/tomli/blob/master/CHANGELOG.md)
- [Commits](hukkin/tomli@2.1.0...2.2.1)

---
updated-dependencies:
- dependency-name: tomli
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@robin-checkmk
Copy link
Member

Thanks for your contribution! We are pressed for time right now, but rest assured, this will be reviewed, as soon as we find the time. ✌️

@robin-checkmk
Copy link
Member

@ra2xfael in the meantime, you can look into the test failures and try to fix them. That will speed up the review process.

ra2xfael and others added 4 commits December 19, 2024 11:34
Bumps [click](https://github.com/pallets/click) from 8.1.7 to 8.1.8.
- [Release notes](https://github.com/pallets/click/releases)
- [Changelog](https://github.com/pallets/click/blob/main/CHANGES.rst)
- [Commits](pallets/click@8.1.7...8.1.8)

---
updated-dependencies:
- dependency-name: click
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Copy link
Member

@robin-checkmk robin-checkmk left a comment

Choose a reason for hiding this comment

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

You pushed changes, while I was reviewing, so I hope my review is not outdated. :)

Overall I really appreciate the quality of the pull request. There are just some minor changes necessary I think.

Also, it would be nice to keep an eye on idempotency, but it is not a hard requirement. I just know we have users, who have a keen eye on this. ;)

roles/agent/tasks/Linux.yml Outdated Show resolved Hide resolved
roles/agent/defaults/main.yml Outdated Show resolved Hide resolved
Comment on lines 166 to 167
Configure the host which is used to register the target on the checkmk server for TLS. This can be used to keep firewalls closed between the target and the server, which would be necessary for tls registration (8000, 8001, ...).

Copy link
Member

Choose a reason for hiding this comment

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

This needs clarification. See my comment in the defaults file as well. I think I understand, what you are trying to do, but I struggle to use it without much thinking, which is not a good sign for usability. We probably need to discuss which default value makes sense and how to make it as accessible as possible.

Also, we should mention, that the system, we delegate the task to, requires the Checkmk agent installed.

@ra2xfael
Copy link
Author

You pushed changes, while I was reviewing, so I hope my review is not outdated. :)

Overall I really appreciate the quality of the pull request. There are just some minor changes necessary I think.

Also, it would be nice to keep an eye on idempotency, but it is not a hard requirement. I just know we have users, who have a keen eye on this. ;)

Thanks for the pull review @robin-checkmk !
I see the problems and would be keen to enhance my addition. There are just two points I need some clarification on.

  1. Idempotency: The four tasks I added only run when checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_registered_connections.stdout is false. As I understand this, it is the case if the agent is not already connected with tls, so registration is still necessary. If tls registration is already done, then the tasks won't be executed. Idempotency should be guaranteed?
  2. Do all variables have to have a default? Can we just set a variable if delegation to do proxy-registration is necessary, otherwise if not set we assume it does not need to be done?

@github-actions github-actions bot added the role:server This affects the server role label Dec 30, 2024
@robin-checkmk
Copy link
Member

@ra2xfael I wanted to rebase your changes on devel and add some final touches to wording, but apparently GitHub did not like that too much. So now a lot of changes pop up, that should already be in devel. Maybe you can double-check the files you modified in the first place and if everything looks fine, I would go ahead and merge this.

@ra2xfael
Copy link
Author

ra2xfael commented Jan 3, 2025

Hi @robin-checkmk, everything looks fine. The changes I made have been retained, there should be no problem with merging

@robin-checkmk robin-checkmk merged commit fd590ef into Checkmk:devel Jan 7, 2025
2 checks passed
@robin-checkmk robin-checkmk mentioned this pull request Jan 7, 2025
7 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation role:agent This affects the agent role role:server This affects the server role
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants