-
Notifications
You must be signed in to change notification settings - Fork 209
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
Wrong token used by Chef server to send data to Chef Automate #1281
Comments
This is weird indeed.
looks like the Erlang binary value Ok, it's probably a 🐛 here: This call to chef_secrets returns not a Thank you for reporting this. We'll get it ironed out quickly, I bet. I'm sorry to say that there's no obvious, quick workaround for this (you've tried them already! 😉) that I can think of, besides changing the erlang code in the running system. (LMK if you'd like to engage in this instead of waiting for the next release.) |
I've dug into this a little further and come up with this: While this should definitely be fixed, the data collection that can't happen here is currently not used on the Automate side. However, node conversion data comes in through a different data path, and that doesn't have this 🐛 So, this issue should not affect your Automate experience. ✨ |
Can you guide me, how should I pass cookbook and node run, compliance data to Automate without using the data-collection? |
Sorry, my last comment might have been misleading. Data collection should work fine for you, it's just that this specific piece, i.e., uploading a cookbook, doesn't have any effect on the Nodes tab, and thus doesn't matter right now. However, data posted to When a signed POST request comes in there, chef-server will inject the configured token and forward the request to Automate (see here). So, node run data should work out of the box, I think; compliance data is sent using the audit cookbook -- and there's various ways to have your data reach Automate, but you're probably interested in Reporting to Chef Automate via Chef Server. We've also got a community slack, which maybe hosts a better audience for specific questions around that audit cookbook, for example, I suppose. 😃 |
Node update wasn't working for me either. It only works, if I'm adding the weird configured token to the Chef-Automate. |
I've changed the value at the Chef config: Then I was running 'chef-server-ctl reconfigure'. I can see in the notes:
` In the Chef Automate NginX logs I can still see: The issue was: The documentation should mention this: |
@ocsig 😃 Sorry, I wasn't clear: I can totally reproduce what you've seen -- and the fix is here: #1282. However, for using Automate with Chef-Server's data collector, it does not matter if that particular request fails. The happy path for seeing your node show up after a finished chef-client run is what I've outlined above. That path should work for you, without any changes (besides the proper configuration of both ends, Automate and Chef-Server). But I've now also come to understand the other bug you've probably found -- nginx doesn't pick up the changed value on reconfigure. I'm sorry you've run into this, I'll get that bug on our board. |
Unfortunately the issue is coming up during the compliance check as well. The issue is the same, the token gets some unwanted pre-/postfix string. |
@ocsig Thanks for adding to this -- Do you see the information in the Compliance tab, though? |
It's a bit early here... |
No, it's two different POSTs -- If I'm not mistaken, the data collection POST that counts for audit data collection is actually sent by the audit cookbook from here, "reporting through chef server to automate"; the failing POST could be unrelated to that. (And I think it would be, since that feature has been extensively tested (right? @alexpop)) |
@ocsig I tested the following setup today:
{
"audit": {
"reporter": "chef-server-automate",
"fetcher": "chef-server",
"insecure": true,
"inspec_version": "1.25.1",
"profiles": [
{
"name": "linux-baseline",
"compliance": "admin/linux-baseline"
}
]
}
}
Both converge and compliance data got in successfully and the UI displayed it. What the operating system of the node you are converging?
|
Chef server doesn't pick up the data_collector["token"] value and it is misusing the default token.
Expected Behavior
After changing the data_collector["token"] value, it should be sent as an HTTP header named 'x-data-collector-token'.
Current Behavior
Following this instruction:
https://learn.chef.io/modules/manage-a-node-chef-automate/ubuntu/automate/set-up-your-chef-server#/
After running the
chef-server-ctl reconfigure
command the Chef server is still using the wrong default token.Further more, by logging the "x-data-collector-token" header in the Chef Automate NginX access log, I can see, the cookbook upload service is using a malformed version of the default token:
35.187.169.205 - - [25/May/2017:21:15:11 +0000] "POST /data-collector/v0/ HTTP/1.1" 204 "0.002" 0 "-" "-" "127.0.0.1:9611" "204" "<<\x2293a49a4f2482c64126f7b6015e6b0f30284287ee4054ff8807fb63d9cbd1c506\x22>>" "0.002" "-" "-" "-" "-" $
If I'm changing the token of the Chef Automate to '<<"93a49a4f2482c64126f7b6015e6b0f30284287ee4054ff8807fb63d9cbd1c506">>' then the Chef server is able to send cookbook information to the Automate server, but node information fails (401). (the " character is displayed as \x22)
If I'm changing the token of the Chef Automate to '<<"93a49a4f2482c64126f7b6015e6b0f30284287ee4054ff8807fb63d9cbd1c506">>' then the Cookbook upload event communication fails (401) however the node reporting (Chef runs on nodes) are reported correctly to Chef Automate.
Note: data_collector["root_url"] is correctly picked up.
Steps to Reproduce (for bugs)
2 My DNS with SSL setup
3 Changing data_collector["token"] = "mytesttoken
3 An Organisation added to the Chef server
4 In nano /var/opt/delivery/nginx/etc/nginx.conf to the log_forma I've added "$http_x_data_collector_token" for visibility of the token sent
5 Uploading a cookbook with knife to Chef server to trigger the data-collector call. --> this shows the default token sent with the pre- and post-fix extra characters.
6 Chef-client run triggers a different data-collector call which is using the wrong default token. ( Even if it should be overwritten.)
Your Environment
The text was updated successfully, but these errors were encountered: