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

network(), syslog(): Fixed a potential crash for TLS destinations during reload #418

Merged
merged 14 commits into from
Dec 19, 2024

Conversation

sodomelle
Copy link
Contributor

Fixes syslog-ng/syslog-ng#5018

It is possible to keep TLS connections alive during reload.
In that case the LogWriter instance is persisted in cfg persist.
This LogWriter's signal slot connector wasn't updated based on the new configuration, which could cause a crash.
The signal slot connector is updated, so the newly configured verifier is used, instead of the old one.

Note that the fix in syslog-ng/syslog-ng#5087 has a security issue, as in that PR, the connector's lifetime is extended, but the verifier plugins are deregistered during reload, which silently disables all TLS verifiers without the user knowing.

sodomelle added a commit to sodomelle/axosyslog that referenced this pull request Dec 16, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@sodomelle sodomelle force-pushed the tls-destination-crash branch from fe77161 to 876423b Compare December 16, 2024 08:45
sodomelle added a commit to sodomelle/axosyslog that referenced this pull request Dec 16, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@sodomelle sodomelle force-pushed the tls-destination-crash branch from 876423b to d6e22e8 Compare December 16, 2024 08:47
sodomelle added a commit to sodomelle/axosyslog that referenced this pull request Dec 16, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@sodomelle sodomelle force-pushed the tls-destination-crash branch from d6e22e8 to 223da2c Compare December 16, 2024 09:00
sodomelle added a commit to sodomelle/axosyslog that referenced this pull request Dec 16, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@sodomelle sodomelle force-pushed the tls-destination-crash branch from 223da2c to 0dea14b Compare December 16, 2024 09:08
Copy link
Contributor

@mitzkia mitzkia left a 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 the Light feature update and a new testcase.
I have added some review notes.

sodomelle added a commit to sodomelle/axosyslog that referenced this pull request Dec 16, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@sodomelle sodomelle force-pushed the tls-destination-crash branch from 0dea14b to 24567d0 Compare December 16, 2024 11:24
sodomelle added a commit to sodomelle/axosyslog that referenced this pull request Dec 16, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@sodomelle sodomelle force-pushed the tls-destination-crash branch from 24567d0 to 4f3d2fb Compare December 16, 2024 15:43
@sodomelle sodomelle requested a review from mitzkia December 16, 2024 15:43
sodomelle added a commit to sodomelle/axosyslog that referenced this pull request Dec 16, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@sodomelle sodomelle force-pushed the tls-destination-crash branch from 4f3d2fb to fec4647 Compare December 16, 2024 16:12
MrAnno pushed a commit to MrAnno/axosyslog that referenced this pull request Dec 18, 2024
Signed-off-by: Tamás Kosztyu <[email protected]>
@MrAnno MrAnno force-pushed the tls-destination-crash branch from fec4647 to 0f831f4 Compare December 18, 2024 17:30
MrAnno and others added 5 commits December 18, 2024 18:31
Signed-off-by: Tamás Kosztyu <[email protected]>
Signed-off-by: László Várady <[email protected]>
Signed-off-by: László Várady <[email protected]>
sodomelle and others added 7 commits December 18, 2024 18:39
Signed-off-by: Tamás Kosztyu <[email protected]>
Signed-off-by: László Várady <[email protected]>
Signed-off-by: László Várady <[email protected]>
Signed-off-by: Tamás Kosztyu <[email protected]>
It is possible to keep TLS connections alive during reload.
In that case the LogWriter instance is persisted in cfg persist.
This LogWriter's signal slot connector wasn't updated based on the
new configuration, which could cause a crash.
The signal slot connector is updated, so the newly configured
verifier is used, instead of the old one.

Signed-off-by: Tamás Kosztyu <[email protected]>
Signed-off-by: Tamás Kosztyu <[email protected]>
@MrAnno MrAnno force-pushed the tls-destination-crash branch from 0f831f4 to 23b3c5b Compare December 18, 2024 17:39
@MrAnno MrAnno force-pushed the tls-destination-crash branch from 23b3c5b to 4648b61 Compare December 18, 2024 17:49
@MrAnno MrAnno removed their request for review December 19, 2024 09:58
@MrAnno
Copy link
Member

MrAnno commented Dec 19, 2024

The plugin_name field of LogPipe appeared at few useful places, so we didn't remove or refactor it in the end.
Let's do it in a separate pull request.

@sodomelle sodomelle requested a review from bazsi December 19, 2024 10:03
TLSSession *
log_tansport_tls_get_session(LogTransport *s)
{
g_assert(s->name == TLS_TRANSPORT_NAME);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I don't think C compilers will always ensure that the pointer value of a literal string expression is always the same. I would have used the address of one of the private methods instead.

Copy link
Member

@MrAnno MrAnno Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanted something that will less likely change if we happen to inherit from the TLS clss.

Using the address of a globally declared const gchar *a = "static" and const gchar a[] = "static" should be safe and consistent in C99.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the forced merge requirements, I have to "resolve" this comment to merge the PR.
Though I still don't agree with such routine, I'm clicking on "resolve".

Copy link
Member

@bazsi bazsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have one nitpick but this can go in without fixing that.

Copy link
Contributor

@mitzkia mitzkia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the Light part of the update, it is approved from my side.

@MrAnno MrAnno merged commit 7c7ef1f into axoflow:main Dec 19, 2024
22 checks passed
@MrAnno MrAnno removed the request for review from alltilla December 19, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Syslog-ng Service crashes in g_hash_table_lookup function after syslog-ng-ctl reload
4 participants