centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
310 stars 274 forks source link

[database::redis::plugin] Add authentication with username #5255

Open Lanxor opened 1 month ago

Lanxor commented 1 month ago

Community contributors

Description

Hello, for security reasons, the anonymous user of our Redis applications has been disabled. And we don't want to use --custommode="cli" from the plugins.

It turns out that the ability to specify a user in the plugin has not been implemented: https://github.com/centreon/centreon-plugins/blob/develop/src/database/redis/custom/perlmod.pm#L96

I was able to test a local modification that works based on the Redis library (https://metacpan.org/pod/Redis#auth)

Type of change

How this pull request can be tested ?

  1. Setup cluster redis application.
  2. Disable anonymous user
  3. Add user with specific ACL for monitoring
    +client +ping +info +config|get +cluster|info +slowlog +latency +memory +select +get +scan +xinfo +type +pfcount +strlen +llen +scard +zcard +hlen +xlen +eval allkeys
  4. Execute the following command
/usr/lib/centreon/plugins/centreon_database_redis.pl \
--plugin database::redis::plugin \
--mode cpu \
--custommode perlmod \
--server my.server.my.domain \
--port 6379 \
--username 'XXX' \
--password 'XXXX'

Checklist