Closed gerbier closed 2 years ago
Hey thank you for bringing this to our attention. Do you have any notifications currently setup? Could you provide me your profiles.yaml? /etc/crowdsec/profiles.yaml
Edit: Adding debugging information: Current default profiles.yaml provides a notification but it is commented out so yaml is unmarshalled it will not exists on the struct https://github.com/crowdsecurity/crowdsec/blob/c7422420944e58498665e895a496bdaeb3fdbcb4/config/profiles.yaml#L9
The function getNotificationsConfiguration loops over profile.Notifications but this may be nil https://github.com/crowdsecurity/crowdsec/blob/c7422420944e58498665e895a496bdaeb3fdbcb4/cmd/crowdsec-cli/notifications.go#L164
when I had the error, I had no notifications configured at all
ps : the doc site https://docs.crowdsec.net/docs/notification_plugins/intro/ does not mention the email_default plugin
What happened?
I'm running crowdsec version v1.4.1-e1954adc325baa9e3420c324caabd50b7074dd77 on ubuntu 22.04 and the command "`cscli notifications list" fails with the following error
root@pxcti1:~# cscli notifications list panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1083502]
goroutine 1 [running]: main.getNotificationsConfiguration.func1({0x0, 0x0}, {0x0, 0x0}, {0xc0006a73e0, 0x41c645}) /home/runner/work/crowdsec/crowdsec/cmd/crowdsec-cli/notifications.go:144 +0x42 path/filepath.Walk({0x0, 0x0}, 0xc0006a7498) /opt/hostedtoolcache/go/1.17.12/x64/src/path/filepath/path.go:515 +0x50 main.getNotificationsConfiguration() /home/runner/work/crowdsec/crowdsec/cmd/crowdsec-cli/notifications.go:156 +0xda main.NewNotificationsCmd.func2(0xc00066a780, {0x1f430b8, 0x0, 0x0}) /home/runner/work/crowdsec/crowdsec/cmd/crowdsec-cli/notifications.go:51 +0x2e github.com/spf13/cobra.(Command).execute(0xc00066a780, {0x1f430b8, 0x0, 0x0}) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x5f8 github.com/spf13/cobra.(Command).ExecuteC(0xc0002be280) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3bc github.com/spf13/cobra.(*Command).Execute(...) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902 main.main() /home/runner/work/crowdsec/crowdsec/cmd/crowdsec-cli/main.go:204 +0xad0
What did you expect to happen?
not an error
How can we reproduce it (as minimally and precisely as possible)?
cscli notifications list
Anything else we need to know?
No response
Crowdsec version
OS version
Enabled collections and parsers
Acquisition config
Config show
Prometheus metrics
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.