From a2b579ae76e9c5f5826ab81bad5e89c6b6006d64 Mon Sep 17 00:00:00 2001 From: Mathias Top Date: Fri, 18 Apr 2025 11:57:59 +0200 Subject: [PATCH] add certs and key parameters to redis sentinel plugin --- src/apps/redis/sentinel/custom/cli.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/apps/redis/sentinel/custom/cli.pm b/src/apps/redis/sentinel/custom/cli.pm index 1b5a59b40..56d4a2f71 100644 --- a/src/apps/redis/sentinel/custom/cli.pm +++ b/src/apps/redis/sentinel/custom/cli.pm @@ -49,6 +49,8 @@ sub new { 'password:s' => { name => 'password' }, 'tls' => { name => 'tls' }, 'cacert:s' => { name => 'cacert' }, + 'cert:s' => { name => 'cert' }, + 'key:s' => { name => 'key' }, 'insecure' => { name => 'insecure' }, 'timeout:s' => { name => 'timeout' } }); @@ -82,6 +84,8 @@ sub check_options { $self->{tls} = defined($self->{option_results}->{tls}) ? 1 : 0; $self->{insecure} = defined($self->{option_results}->{insecure}) ? 1 : 0; $self->{cacert} = defined($self->{option_results}->{cacert}) && $self->{option_results}->{cacert} ne '' ? $self->{option_results}->{cacert} : ''; + $self->{cert} = defined($self->{option_results}->{cert}) && $self->{option_results}->{cert} ne '' ? $self->{option_results}->{cert} : ''; + $self->{key} = defined($self->{option_results}->{key}) && $self->{option_results}->{key} ne '' ? $self->{option_results}->{key} : ''; if ($self->{server} eq '') { $self->{output}->add_option_msg(short_msg => 'Need to specify --server option.'); @@ -159,6 +163,8 @@ sub get_extra_options { my $options = ''; $options .= ' --tls' if ($self->{tls} == 1); $options .= " --cacert '" . $self->{cacert} . "'" if ($self->{cacert} ne ''); + $options .= " --cert '" . $self->{cert} . "'" if ($self->{cert} ne ''); + $options .= " --key '" . $self->{key} . "'" if ($self->{key} ne ''); $options .= ' --insecure' if ($self->{insecure} == 1); $options .= " --user '" . $self->{username} . "'" if ($self->{username} ne ''); $options .= " -a '" . $self->{password} . "'" if ($self->{password} ne ''); @@ -226,6 +232,14 @@ Establish a secure TLS connection (redis-cli >= 6.x mandatory). CA Certificate file to verify with (redis-cli >= 6.x mandatory). +=item B<--cert> + +Client certificate to authenticate with. + +=item B<--key> + +Private key file to authenticate with. + =item B<--insecure> Allow insecure TLS connection by skipping cert validation (since redis-cli 6.2.0).