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

[database::redis::plugin] --custommode="perlmod" does not allow authentication with a username #5212

Open
Lanxor opened this issue Sep 30, 2024 · 2 comments

Comments

@Lanxor
Copy link

Lanxor commented Sep 30, 2024

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)

# src/database/redis/custom/perlmod.pm
     sub check_options {
         ...
-        if ($self->{username} ne '') {
-            $self->{output}->add_option_msg(short_msg => 'Unsupported --username option.');
-            $self->{output}->option_exit();
-        }
         ...
    }
# src/database/redis/custom/perlmod.pm
     sub get_info {
         ...
         if ($self->{password} ne '') {
-            $redis->auth($self->{password});
+            $redis->auth($self->{username}, $self->{password});
         }
         ...
     }

Is it possible to implement this modification? Others modifications are needed to comply with developer guidelines ?

@lucie-dubrunfaut
Copy link
Contributor

Hello :)

Would you be able to propose a Pull request instead (easier to understand the changes you are proposing) so that we can then adapt and, if necessary add missing things directly on the proposal? :)

@Lanxor
Copy link
Author

Lanxor commented Oct 22, 2024

Ok thank you @lucie-dubrunfaut. I just created the pull request #5255 with the changes. I'm not sure if I missed anything, but I followed the instructions.

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

No branches or pull requests

2 participants