-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Accept Datatype Sensitive for Secrets #689
Comments
This sadly is broken atm, since for example the ido-config contains now:
This is only on puppet 6, on puppet 7 everything works as expected... |
Strange. I tested it on different platform and different puppet versions. What kind of puppet version in detail and on what distribution it fails? |
I have the same issue. Addition: I am pulling the plaintext password from my hiera. The problem seems to be between wrapping the plaintext password and unwrapping it again. |
After a bit of investigating, i would wager that the problem lies somewhere in the idomysql.pp icinga2::object { 'icinga2::object::IdoMysqlConnection::ido-mysql': Since we dont unwrap content of the attrs, more specifically the $_password on line 278, the content is written as Sensitive data instead of the password into the file. (Just my current best guess) |
Hi Markus, that's correct, the unwrap is done in the parser in https://github.com/Icinga/puppet-icinga2/blob/master/lib/puppet_x/icinga2/utils.rb#L243 the returned string will be written to file. |
True. I got to there in the afternoon. Remains to be found, why the password does not get unwrapped correctly. I will go and do some more debugging now. Edit: I got down to the unwrap parts in the utils.rb, but I dont know enough about Rubyprogramming to do serious debugging there (at least what i feel comfortable with) |
Edit: deleted, as I made a Mistake in my Comment |
I still cannot reproduce the problem. It would be helpful if you could tell me what I can do. |
Same problem here on puppet 7. |
Please, what puppet version in detail. Here I haven't any problems with the last versions of Puppet 5, 6, and 7. |
Puppet 7.9.0 (PE 2021.3). (Running on Rocky 8) |
same here
|
Ok lets start by getting a baseline: OS Versions: SLES 12 Hiera Entry:
Site Entry:
This results in a broken idomysql file:
@lbetz can you reproduce this? Or is this setup working on your end? Maybe it has something to do with the ruby version or some other things that seem unrelated. If you have an idea how to debug this on my end, I am all ears. I am just not sure how to help debug this right now. |
I tested your code on puppet 6.25.0 and stdlib/concat 7.1.0 on a centos8, because I haven't a SLES12 test platform, yet. And my result look like: This file is managed by Puppet. DO NOT EDIT.library "db_ido_mysql" object IdoMysqlConnection "ido-mysql" { I am very confused SLES or RedHat should be no difference here. |
Hmmm, now thats some funky stuff. Aaaand I found the problem (at least in my setup) .... |
Arrrg, that explains it. @rwaffen I tested your setup and it sill works... |
environment caching could be a problem after updating to the new module version...!? |
Aye, this can happen everytime a variable changes type. To top that off, that isnt even guaranteed to happen for everyone and everytime. Some with the exact same setup might experience that, others dont. That bug is pretty old and is a result to a bug referred to as environment bleed. Generating types was introduced to solve that (but brings its own problems). |
Nevermind.... On my test VM unwrapping now works as intended, on my production environment though... it doesnt... Edit: Now its non-deterministically writing the password or the Redacted Value message.... |
I have yet to try regenerating types. We are using PE with r10k here (which isn't the recommended setup I guess), so maybe there is some issue with our different environments. |
@lbetz is your testenvironment consistent in its ido-mysql.conf content? I successfully reproduced my non-deterministic switching of contents from 'testpassword' to 'Sensitive [value redacted]' and vice versa on a second pretty clean server now. |
@zilchms :Ach shit. My "Testumgebung" is just a standalone puppet agent. And, yes, my result is consistent. A test server environment first I have to deploy. |
Ok. My test environment consists of a puppet master and some agents. Every agent I tried to give the idomysql feature shows the same result -> "Sensitive [content redacted]" |
will test this on monday again. and yes, we also have environment isolation. |
i updated all our environments to get around some bugs in environment isolations. normaly we update only environments which have changes. normally we do this per environment, but i also did it in general
but still i get this:
|
Huh. That is interesting. I managed to fix my problems just now (you can believe the feeling of happiness I am experiencing right now). Let me try to write down my journey to a solution: ---- Please read in full first and dont do it step by step, unless you want to suffer like i did ----
After doing all that (not necessarily in that exact order), my Icingamaster finally got the memo that there is a new puppet-icinga2 version with sensitive types and only this is to be used. On a more serious note: I would suspect that an older puppet-icinga2 version bled over from other environments and the generating types way with puppet didnt correct that behaviour in full. If I had to guess, i would assume that this is only a problem since the unwrap part was in a ruby function and not in a puppet template or site (generate types solves this pretty reliably). There is nothing the module authors can do to prevent this as far as my understanding goes. And these bugs are bound to happen from time to time. |
okay, so when i update icinga2-module in all environments, this schould be okay? 🤔 |
I would believe so yes. If that does not fix it on your deployment, I am running out of ideas. I dont even have a testenvironment left now, since I fixed everything on my end. |
Actually, that alone is not enough. In our case (using r10k with pe-puppet) I had to update all environments, then regenerate the types in all environments and after all that the puppetserver needs a restart (otherwise it doesn't seem to catch up with the new types). At least for now everything looks working again. |
Interessting. I used the same type as puppet does in the postgresql and mysql modules, I thought. I've to check it again. Maybe one of you would like to write a few lines for the documentation? |
I'm not sure, but maby it's better to move the unwrap from ruby to puppet? |
My Opinion (not referencing these particular Cases): The |
We have the same issue in our api-users.conf:
Additonally we can see the problem in ido-mysql.conf as well. We read our password from an eyaml file so our hiera entry looks like this: We are using puppet 7.12.1 on Debian bullseye. |
@rweigle Yea, that was kind of to be expected. This bug should be affecting all files where the utils.rb is used to build the contents (all of those should be listed in the first comment of this issue). |
The Approach…
… and the Approach…
… should not make any Difference. |
Maybe one of you would like to write a few lines for the documentation? |
Can do, would that fall under the "How Configuration is parsed" section? Or where should information about that be placed? Maybe a new section "Known Issues"? |
@zilchms The last one. A description of when and why the problem occurs and how to fix it. I think, the README.md is a good place, Known Issues would be ok for me. |
I would suggest a "Know Issues" section, as it seem to be an environment bleed and apparently does not happen to everyone. I was able to fix it for me by cleaning up the environments (deleting the .resource_types directories) than regenerate them for all affected environments with |
I'm open to any suggestions since I can't reproduce it myself. |
Previously we could use plaintext passwords in Hiera instead of the better security that this change provides. Would something like this work inside the file /data/common.yaml ? |
@grant-veepshosting The use of Sensitive Datatype should be optional, so that a plaintext transfer should also be possible. Have you read #693? If you are still affected by this, an info about it would be very important for us. |
Thanks for that - I have read through that link, the documentation and the underlying code changes. |
Thx so much. That is an important info. If you think about it, not even far-fetched. |
I spent several hours yesterday and today recreating the issue, unsuccessfully. I installed a puppetserver (puppet 7.13.0), started with v3.1.0 of puppet-icinga2 to get an Icinga with features ido-mysql (password via Hiera), api (Constant TicketSalt via Hiera) and three ApiUser objects with passwords from Hiera and set in the manifest within declaration. |
Hi, I was able to fix this by running |
can confirm this. tested on a fresh puppet7 setup (new puppetserver and icinga server) with 3 branches:
working in my 3.2.0 branch/environment: have to retry another time…. all strange behavior. but agree with @bastelfreak that this is all an environment isolation thingy |
Without environment isolation it is as @rwaffen report it. A simple restart solves the problem. But switching between the versions break the correct behaivor again. |
Add Variant Sensitive[String] to String types:
icinga2::feature::api::ticket_salt
icinga2::feature::api::ticket_id
icinga2::feature::elasticsearch::password
icinga2::feature::icingadb::password
icinga2::feature::idomysql::password
icinga2::feature::idopgsql::password
icinga2::feature::influxdb::password
icinga2::feature::influxdb::basic_auth['password']
icinga2::feature::influxdb2::auth_token
icinga2::object::apiuser::password
The text was updated successfully, but these errors were encountered: