-
Notifications
You must be signed in to change notification settings - Fork 576
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
Fix TLS context not being updated on signed certificate messages on agents #7654
Conversation
This makes the SSL context in ApiListener::SpawnCoroutine non-const to address an issue when an agent recieves an signed certificate from the master and tries to update the SSL context. This also uses the class member variable which is captured by `this` in the lamda expression. fixes #7650
Turns out that the switch to the class member variable inside the lambda expression is sufficient to fix the issue.
@Al2Klimov This also affects icinga2/lib/remote/apilistener.cpp Line 465 in 8431ea5
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... but this is one more reason for just approving this. If this no-op fixes a problem – even better.
@@ -416,7 +416,7 @@ bool ApiListener::AddListener(const String& node, const String& service) | |||
Log(LogInformation, "ApiListener") | |||
<< "Started new listener on '[" << localEndpoint.address() << "]:" << localEndpoint.port() << "'"; | |||
|
|||
IoEngine::SpawnCoroutine(io, [this, acceptor, sslContext](asio::yield_context yc) { ListenerCoroutineProc(yc, acceptor, sslContext); }); | |||
IoEngine::SpawnCoroutine(io, [this, acceptor](asio::yield_context yc) { ListenerCoroutineProc(yc, acceptor, m_SSLContext); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look where the previously explicitly captured variable comes from and what it's a copy of. IMO this change is a no-op...
And yes, |
@Al2Klimov Thanks a lot 👍 @mcktr Can you please take care of this in a new PR? I'll approve and merge here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for debugging and fixing this 👍
This avoids copying the TLS context in the ApiListener class and removes the obsolete variable. This is a follow-up from #7654
This avoids copying the TLS context in the ApiListener class and removes the obsolete variable. This is a follow-up from #7654
This avoids copying the TLS context in the ApiListener class and removes the obsolete variable. This is a follow-up from #7654
This uses the class member variable for the SSL context inside the lambda expression which is captured by
this
.The problem occurs with the following setup:
Master:
Agent
host
attribute for the masterzone.conf
And (re)start the master.
host
attribute from agentszones.conf
fileNow restart the agent to apply the configuration changes
Sign the CSR on the master
Notice that the agents always updates the certificate. The agent is in a loop. A restart of the agent ends the loop and the master can successfully connect and performs no further certificate updates.
While the agent was stuck in the loop I connected to the agent with
openssl s_client
. The used certificate was not updated, the issuer of the certificate was the agent and not the Icinga CA. After the agent restarts the correct certificate was used (issuer: Icinga CA).fixes #7650