-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
icinga2 feature api fails when pki=icinga2 and ca is the local node #218
Comments
I'm not sure I fully understand the issue. Can you paste the puppet code here that leads to this issue? |
If i try to setup a fresh icinga2 master with a self signed CA and enabling the API (icinga2::feature::api with pki=icinga2) it fails, because:
To summarize, you can't bootstrap a fresh Icinga2 master with the api feature enabled using pki=icinga2 unless you already have a running icinga2 "master" acting as a CA, you can however do it, but in a few puppet runs, not on one run. I have forked the repository and committed a fix, it shows here as well. |
My fix is not complete, It has to go through a different command set.
I am still thinking where this should be created, when we generate a new CA by calling the After playing with Icinga2 for a while in the last couple of days it looks like the best place is inside the "icinga2::pki::ca" class, what do you think? |
I am not sure if this can be solved at all, it's an chicken and egg problem. When using So the module would need to enable an initial API that can be used to sign certificates, before signing the actual certificates for the master. I don't see how this would be possible in one single step. Here's some code to reproduce this:
|
@erezzarum I have a branch with a possible fix: https://github.com/Icinga/puppet-icinga2/tree/bug/client-certs-on-ca-master-218 Can you test this and give me feedback, please? Make sure to set
|
Updated the branch one more time |
refs voxpupuli#218 - Remove invalid byte sequence in UTF-8 - Set correct permissions for pki dir - Sign the certificate with icinga2 local CA
I liked the idea of having the You can sign the certificate locally on the icinga2 CA instance, the
I have created a fix that should solve that, tested on a clean vagrant box.
A small suggestion, it could be possible that users did not notice this bug but i think it will be wise to alert that using |
You are absolutely right, I missed the signing part completely. Just one thing: I don't think its a good idea to set permissions for |
Well, i agree with you, i can't test it on windows :( so sorry! On a side note, we will then have to create the private key, certificate and csr request in a temporary directory where the icinga2 user can write to (icinga2 cli is being run as the defined user), then move it to the pki dir (at this point puppet is doing it, usually running as root) and then change the permissions. Or, just change the ownership on the pki dir to the icinga user, i don't see a reason why not doing this though which is much more simple and achieve the same. |
I am not able to reproduce the permission issue. If the directory |
Which distro are you testing it on? |
Alright, apparently the packages on CentOS/RHEL behave differently from those on Ubuntu/Debian, that's why I couldn't reproduce it. I think the best would be to set the Icinga user for the pki dir as owner. Can you update this in your branch? |
Done. |
I merged your commits to my branch. I will add documentation and specs and then close the issue. Thanks for the support @erezzarum |
refs voxpupuli#218 - Remove invalid byte sequence in UTF-8 - Set correct permissions for pki dir - Sign the certificate with icinga2 local CA
When creating a new CA using "icinga2::pki::ca" the ca.crt file is not copied to the default pki directory (/etc/icinga2/pki/ca.crt).
It makes it impossible to start a fresh icinga2 master without an existing CA (i.e: creating a fresh master with a CA) using "icinga2::feature::api"
My suggestion is to allow the "ca_host" param under "icinga2::feature::api" to be undef or any other parameter (maybe if the ca_host is the same as fqdn or if the ca_host is 'master') and then simply copying the ca.crt from the ca_dir into the defined ssl_ca_cert_path parameter.
I suggest not copying it directly over to /etc/icinga2/pki/ca.crt by the "icinga2::pki::ca" class as a user may use a different ssl_ca_cert_path for the api.
The text was updated successfully, but these errors were encountered: