Skip to content

Commit edf9e52

Browse files
authored
Merge pull request #947 from wolfaba/master
Support multiple values in TLSAccept
2 parents 6059a37 + 7c868c4 commit edf9e52

File tree

7 files changed

+61
-6
lines changed

7 files changed

+61
-6
lines changed

REFERENCE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ Default value: `$zabbix::params::agent_timeout`
18601860

18611861
##### <a name="-zabbix--agent--tlsaccept"></a>`tlsaccept`
18621862

1863-
Data type: `Optional[Enum['unencrypted','psk','cert']]`
1863+
Data type: `Optional[Variant[Array[Enum['unencrypted','psk','cert']],Enum['unencrypted','psk','cert']]]`
18641864

18651865
What incoming connections to accept from Zabbix server. Used for a passive proxy, ignored on an active proxy.
18661866

@@ -3279,7 +3279,7 @@ Default value: `$zabbix::params::proxy_timeout`
32793279

32803280
##### <a name="-zabbix--proxy--tlsaccept"></a>`tlsaccept`
32813281

3282-
Data type: `Any`
3282+
Data type: `Optional[Variant[Array[Enum['unencrypted','psk','cert']],Enum['unencrypted','psk','cert']]]`
32833283

32843284
What incoming connections to accept from Zabbix server. Used for a passive proxy, ignored on an active proxy.
32853285

manifests/agent.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
$userparameter = $zabbix::params::agent_userparameter,
204204
Optional[String[1]] $loadmodulepath = $zabbix::params::agent_loadmodulepath,
205205
$loadmodule = $zabbix::params::agent_loadmodule,
206-
Optional[Enum['unencrypted','psk','cert']] $tlsaccept = $zabbix::params::agent_tlsaccept,
206+
Optional[Variant[Array[Enum['unencrypted','psk','cert']],Enum['unencrypted','psk','cert']]] $tlsaccept = $zabbix::params::agent_tlsaccept,
207207
$tlscafile = $zabbix::params::agent_tlscafile,
208208
$tlscertfile = $zabbix::params::agent_tlscertfile,
209209
Optional[String[1]] $tlscertissuer = undef,

manifests/proxy.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
$historyindexcachesize = $zabbix::params::proxy_historyindexcachesize,
270270
$historytextcachesize = $zabbix::params::proxy_historytextcachesize,
271271
$timeout = $zabbix::params::proxy_timeout,
272-
$tlsaccept = $zabbix::params::proxy_tlsaccept,
272+
Optional[Variant[Array[Enum['unencrypted','psk','cert']],Enum['unencrypted','psk','cert']]] $tlsaccept = $zabbix::params::proxy_tlsaccept,
273273
$tlscafile = $zabbix::params::proxy_tlscafile,
274274
$tlscertfile = $zabbix::params::proxy_tlscertfile,
275275
$tlsconnect = $zabbix::params::proxy_tlsconnect,

spec/classes/agent_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,30 @@
352352
end
353353
end
354354

355+
context 'tlsaccept with one value array' do
356+
if facts[:kernel] == 'Linux'
357+
let :params do
358+
{
359+
tlsaccept: %w[cert]
360+
}
361+
end
362+
363+
it { is_expected.to contain_file(config_path).with_content %r{^TLSAccept=cert$} }
364+
end
365+
end
366+
367+
context 'tlsaccept with two value array' do
368+
if facts[:kernel] == 'Linux'
369+
let :params do
370+
{
371+
tlsaccept: %w[unencrypted cert]
372+
}
373+
end
374+
375+
it { is_expected.to contain_file(config_path).with_content %r{^TLSAccept=unencrypted,cert$} }
376+
end
377+
end
378+
355379
context 'without ListenIP' do
356380
let :params do
357381
{

spec/classes/proxy_spec.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,37 @@
415415
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^LogFileSize=10$} }
416416
end
417417
end
418+
419+
context 'tlsaccept with one string value' do
420+
let :params do
421+
{
422+
tlsaccept: 'cert'
423+
}
424+
end
425+
426+
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSAccept=cert$} }
427+
end
428+
429+
context 'tlsaccept with one value array' do
430+
let :params do
431+
{
432+
tlsaccept: %w[cert]
433+
}
434+
end
435+
436+
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSAccept=cert$} }
437+
end
438+
439+
context 'tlsaccept with two value array' do
440+
let :params do
441+
{
442+
tlsaccept: %w[unencrypted cert]
443+
}
444+
end
445+
446+
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf').with_content %r{^TLSAccept=unencrypted,cert$} }
447+
end
448+
418449
end
419450
end
420451
end

templates/zabbix_agentd.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ LoadModulePath=<%= @loadmodulepath %>
310310
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
311311
# Default:
312312
# TLSAccept=unencrypted
313-
<% if @tlsaccept %>TLSAccept=<%= @tlsaccept %><% end %>
313+
<% if @tlsaccept %>TLSAccept=<%= [@tlsaccept].flatten.join(',') %><% end %>
314314

315315
### Option: TLSCAFile
316316
# Full pathname of a file containing the top-level CA(s) certificates for

templates/zabbix_proxy.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ LoadModulePath=<%= @loadmodulepath %>
511511
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
512512
# Default:
513513
# TLSAccept=unencrypted
514-
<% if @tlsaccept %>TLSAccept=<%= @tlsaccept %><% end %>
514+
<% if @tlsaccept %>TLSAccept=<%= [@tlsaccept].flatten.join(',') %><% end %>
515515

516516
### Option: TLSCAFile
517517
# Full pathname of a file containing the top-level CA(s) certificates for

0 commit comments

Comments
 (0)