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

Fix the config options defaults for telegram: it has to start with Telegram instead of Slack #495

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

schfkt
Copy link
Contributor

@schfkt schfkt commented Jun 1, 2023

/kind bug
/area config

Hi. I tried to use Telegram as output and configured it through env variables like so:

docker run --name falcosidekick -d \
                              -p 2801:2801 \
                              -e TELEGRAM_TOKEN="my-token" \
                              -e TELEGRAM_CHATID="my-chat-id" \
                              falcosecurity/falcosidekick:2.28.0-rc.0

But it didn't work. falcosidekick did receive events from falco, but it wasn't forwarded to the specified Telegram chat. I checked falcosidekick logs and noticed that the list of outputs reported at the startup was empty for some reason:

Jun 01 19:04:01 sanctuary falcosidekick[3035058]: 2023/06/01 19:04:01 [INFO]  : Falco Sidekick version: 2.28.0-rc.0
Jun 01 19:04:01 sanctuary falcosidekick[3035058]: 2023/06/01 19:04:01 [INFO]  : Enabled Outputs : []

I found the original pull request that introduced Telegram support and noticed that the defaults for the config were set with the wrong prefix Slack instead of Telegram:

https://github.com/falcosecurity/falcosidekick/pull/431/files#diff-0e426a43248661127a0c0ee115aef7a1093b635f8993b3f7ebb1dd9f05b8f249R419

I changed it locally then, rebuild falcosidekick, and Telegram output started to work:

$ TELEGRAM_TOKEN="my-token" TELEGRAM_CHATID="my-chat-id" ./falcosidekick
2023/06/01 17:59:28 [INFO]  : Falco Sidekick version: 2.28.0-rc.0-22-gef45b94
2023/06/01 17:59:28 [INFO]  : Enabled Outputs : [Telegram]
2023/06/01 17:59:28 [INFO]  : Falco Sidekick is up and listening on :2801
2023/06/01 17:59:32 [INFO]  : Telegram - Post OK (200)

2023-06-01_17-59

I guess that setting v.SetDefault also affects proper env variables parsing? Since that's why the fix actually worked.

@poiana
Copy link

poiana commented Jun 1, 2023

Welcome @schfkt! It looks like this is your first PR to falcosecurity/falcosidekick 🎉

@poiana poiana requested review from cpanato and fjogeleit June 1, 2023 19:13
@poiana poiana added the size/XS label Jun 1, 2023
… Slack

Signed-off-by: Pavel Ivanov <ivpavig@gmail.com>
@poiana poiana added the lgtm label Jun 7, 2023
@poiana
Copy link

poiana commented Jun 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Issif, schfkt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana
Copy link

poiana commented Jun 7, 2023

LGTM label has been added.

Git tree hash: a5ecf149591a4a44c241ad59c2d31bb0c2f946b4

@poiana poiana added the approved label Jun 7, 2023
@Issif
Copy link
Member

Issif commented Jun 7, 2023

Thanks, and sorry I missed that in my review.

@Issif Issif added this to the 2.28.0 milestone Jun 7, 2023
@poiana poiana merged commit 9c9d46d into falcosecurity:master Jun 7, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants