add certs and key parameters to redis sentinel plugin

This commit is contained in:
Mathias Top 2025-04-18 11:57:59 +02:00 committed by Sylvain Cresto
parent fe4e078287
commit a2b579ae76

View File

@ -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).