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

Allow requirepass to be set as a Sensitive string #512

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ Default value: `60`

##### <a name="-redis--requirepass"></a>`requirepass`

Data type: `Optional[Variant[String, Deferred]]`
Data type: `Optional[Variant[String, Sensitive[String[1]], Deferred]]`

Require clients to issue AUTH <PASSWORD> before processing any other commands.

Expand Down Expand Up @@ -2487,7 +2487,7 @@ Default value: `$redis::repl_timeout`

##### <a name="-redis--instance--requirepass"></a>`requirepass`

Data type: `Optional[Variant[String, Deferred]]`
Data type: `Optional[Variant[String, Sensitive[String[1]], Deferred]]`

Require clients to issue AUTH <PASSWORD> before processing any other
commands.
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
Boolean $repl_disable_tcp_nodelay = false,
Integer[1] $repl_ping_slave_period = 10,
Integer[1] $repl_timeout = 60,
Optional[Variant[String, Deferred]] $requirepass = undef,
Optional[Variant[String, Sensitive[String[1]], Deferred]] $requirepass = undef,
Boolean $save_db_to_disk = true,
Hash $save_db_to_disk_interval = { '900' => '1', '300' => '10', '60' => '10000' },
Boolean $service_enable = true,
Expand Down
2 changes: 1 addition & 1 deletion manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
Boolean $repl_disable_tcp_nodelay = $redis::repl_disable_tcp_nodelay,
Integer[1] $repl_ping_slave_period = $redis::repl_ping_slave_period,
Integer[1] $repl_timeout = $redis::repl_timeout,
Optional[Variant[String, Deferred]] $requirepass = $redis::requirepass,
Optional[Variant[String, Sensitive[String[1]], Deferred]] $requirepass = $redis::requirepass,
Boolean $save_db_to_disk = $redis::save_db_to_disk,
Hash $save_db_to_disk_interval = $redis::save_db_to_disk_interval,
String[1] $service_user = $redis::service_user,
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,20 @@ class { 'redis':
}
end

describe 'with parameter requirepass marked as sensitive' do
let(:params) do
{
requirepass: sensitive('_VALUE_')
}
end

it {
is_expected.to contain_file(config_file_orig).with(
'content' => sensitive(%r{requirepass.*_VALUE_})
)
}
end

describe 'with parameter save_db_to_disk' do
context 'true' do
let(:params) do
Expand Down
2 changes: 1 addition & 1 deletion templates/redis.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Integer[0] $slave_priority,
Integer[0] $min_slaves_to_write,
Integer[0] $min_slaves_max_lag,
Optional[String[1]] $requirepass,
Optional[Variant[String[1],Sensitive[String[1]]]] $requirepass,
Hash[String,String] $rename_commands,
Integer[1] $maxclients,
Optional[Variant[Integer, String]] $maxmemory,
Expand Down