Skip to content

Commit d7491dd

Browse files
committed
Parameterise Banner and DebianBanner as attributes
This commit parameterises `Banner` and `DebianBanner` in the sshd config with the attributes `['ssh']['banner']` and `['ssh']['os_banner']` respectively, though the latter is only supported on Debian family distributions. Debian based distributions will have `DebianBanner no` set by default from now on.
1 parent d204ea3 commit d7491dd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

attributes/default.rb

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
default['ssh']['allow_groups'] = [] # sshd
7272
default['ssh']['print_motd'] = false # sshd
7373
default['ssh']['print_last_log'] = false # sshd
74+
default['ssh']['banner'] = false # sshd
75+
default['ssh']['os_banner'] = false # sshd (Debian OS family)
76+
7477
# set this to nil to let us use the default OpenSSH in case it's not set by the user
7578
default['ssh']['use_dns'] = nil # sshd
7679
# set this to nil to let us detect the attribute based on the node platform

templates/default/opensshd.conf.erb

+6-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ X11UseLocalhost yes
177177

178178
PrintMotd <%= ((@node['ssh']['print_motd']) ? 'yes' : 'no' ) %>
179179
PrintLastLog <%= ((@node['ssh']['print_last_log']) ? 'yes' : 'no' ) %>
180-
#Banner /etc/ssh/banner.txt
180+
Banner <%= @node['ssh']['banner'] ? '/etc/ssh/banner.txt' : 'none' %>
181+
182+
<% if @node['platform_family'] == 'debian' %>
183+
DebianBanner <%= @node['ssh']['os_banner'] ? 'yes' : 'no' %>
184+
<% end %>
185+
181186
<% if @node['ssh']['use_dns'].nil? %>
182187
# Since OpenSSH 6.8, this value defaults to 'no'
183188
#UseDNS no

0 commit comments

Comments
 (0)