Skip to content

Commit c3d6aa8

Browse files
authored
ssh_instance: write ciphers,macs and kex as comma-separated string (#401)
As the man page of sshd_config(5) describes: "Multiple ciphers/macs/kexalgorithms must be comma-separated." Using an array or YAML list for ciphers/mac/kex results in multiple entries in sshd_config. If multiple entries are set in sshd_config, sshd takes only the first one. Fixes #400
1 parent 2d19df9 commit c3d6aa8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

templates/ssh_instance.erb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,30 @@ ListenAddress <%= listen %>
4040
<%- v.keys.sort.each do |key| -%>
4141
<%- value = v[key] -%>
4242
<%- if value.is_a?(Array) -%>
43+
<%- if ['ciphers', 'macs', 'kexalgorithms'].include?(key.downcase) -%>
44+
<%= key %> <%= value.join(',') %>
45+
<%- else -%>
4346
<%- value.each do |a| -%>
4447
<%- if a != '' && a != nil -%>
4548
<%= key %> <%= bool2str(a) %>
4649
<%- end -%>
4750
<%- end -%>
51+
<%- end -%>
4852
<%- elsif value != '' && value != nil -%>
4953
<%= key %> <%= bool2str(value) %>
5054
<%- end -%>
5155
<%- end -%>
5256
<%- else -%>
5357
<%- if v.is_a?(Array) -%>
58+
<%- if ['ciphers', 'macs', 'kexalgorithms'].include?(k.downcase) -%>
59+
<%= k %> <%= v.join(',') %>
60+
<%- else -%>
5461
<%- v.each do |a| -%>
5562
<%- if a != '' && a != nil -%>
5663
<%= k %> <%= bool2str(a) %>
5764
<%- end -%>
5865
<%- end -%>
66+
<%- end -%>
5967
<%- elsif v != nil and v != '' -%>
6068
<%= k %> <%= bool2str(v) %>
6169
<%- end -%>

0 commit comments

Comments
 (0)