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

Variable name conflict in constants.conf / Problem with TLS verification, CN and Environment variable #6507

Closed
ekeih opened this issue Aug 1, 2018 · 8 comments · Fixed by #6512
Assignees
Labels
area/distributed Distributed monitoring (master, satellites, clients) bug Something isn't working
Milestone

Comments

@ekeih
Copy link
Contributor

ekeih commented Aug 1, 2018

Hello,

yesterday I updated our stage environment from 2.8.4 to 2.9.1 and it went horribly wrong. After the update icingaweb2 stopped to display new results/hosts/checks.
In the logs of all masters and satellites I got the following warnings every few minutes:

[2018-07-31 09:43:34 +0200] warning/ApiListener: Unexpected certificate common name while connecting to endpoint 'stage.master01:stage': got 'stage.master01'
Context:
        (0) Handling new API client connection

The funny thing is that it says warning but it really means this is a fatal error and your cluster is unable to connect.

After a lot of debugging I found this commit: 9c1e00e and the related PR: #6305

So you may ask: Why does it break our cluster? We already used a Environment=stage variable in our constants.conf. Of course for another purpose. Well, when you know about the PR that introduced the new variable it is pretty obvious that our variable would break the cluster - but I did not know 😉

I have some thoughts about this:

  • The warning about the unexpected CN should be an error!
  • What is the actual purpose of this variable? I read the PR and the description in the docs but it does not really explain why you added it and what users could use it for. Maybe you could extend the docs about this. (@gunnarbeutner)
  • Could we add a way to distinguish between variables with a predefiend meaning and new variables defined by the user?
  • In our case we added a prefix to our variable companyNameEnvironment.
  • We could add a note to the docs with the advise to use a prefix for custom variables to avoid conflicts with new predefined variables in the future.
  • (Calling values in constants.conf variables is confusing.)

I am looking forward to hear other opinions about this. How can we avoid variable name conflicts in the future? What do you think?

Best regards
Max

Your Environment

  • Version used (icinga2 --version): r2.9.1-1
  • Operating System and version: Ubuntu 16.04.5 LTS
@nbuchwitz
Copy link
Contributor

Any chance that you test the snapshot packages in your testing environment? There was a revert of most changes regarding the Environment vars: ddc5b95

@dnsmichi
Copy link
Contributor

dnsmichi commented Aug 1, 2018

This variable will definitely come back, no need to test that.

It is unfortunate that the global constant namespace is shared with users and system variables. I don't have time atm to explain the changes in 2.9 a bit better, I will come back later with additional thoughts.

@ekeih
Copy link
Contributor Author

ekeih commented Aug 1, 2018

Thank you both for your feedback. The (removed) documentation in ddc5b95 was really helpful to understand why you added this feature 🙂

It is unfortunate that the global constant namespace is shared with users and system variables. I don't have time atm to explain the changes in 2.9 a bit better, I will come back later with additional thoughts.

We fixed it for our setup by changing the name of our variable. So it is not urgent for us ;)

@lazyfrosch lazyfrosch self-assigned this Aug 2, 2018
@lazyfrosch
Copy link
Contributor

@dnsmichi is correct, this feature will come back, in a slightly minimalistic way.

Environment will stay a constant that influences SNI for TLS connections.

You should always use a prefix for constants, to avoid a possible clash with our internals.

I guess I'll add a note within the docs.

@ekeih
Copy link
Contributor Author

ekeih commented Aug 2, 2018

Could we add a way to distinguish between variables with a predefiend meaning and new variables defined by the user?

#6509 looks related 🤔

I guess I'll add a note within the docs.

Thank you! :)

@gunnarbeutner
Copy link
Contributor

Well, yes, unfortunately that's only part of the solution. Icinga already has partial support for namespaces and that PR is yet another push to get "proper" namespacing support at some point.

@dnsmichi dnsmichi added bug Something isn't working area/distributed Distributed monitoring (master, satellites, clients) labels Aug 2, 2018
@dnsmichi dnsmichi added this to the 2.10.0 milestone Aug 2, 2018
@dnsmichi dnsmichi changed the title Variable name conflict in constants.conf Variable name conflict in constants.conf / Problem with TLS verification, CN and Environment variable Aug 2, 2018
@dnsmichi
Copy link
Contributor

dnsmichi commented Aug 2, 2018

Two tasks here:

  • Add Environment to the upgrading docs, being reserved for future usage
  • Fix the location where the error message sources from. This compares <FQDN>:<Environment> with ´<FQDN>. This only happens if Environment is set to something else than production in 2.9.x.

@dnsmichi
Copy link
Contributor

dnsmichi commented Aug 9, 2018

Will be fixed as part of #6512 in my review cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/distributed Distributed monitoring (master, satellites, clients) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants