Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

Commit f54a418

Browse files
author
Andrew Jones
authored
Merge pull request #1268 from leochen4891/add_x11_forwarding
add AddressFamily and a switch for x11 forwarding (default = false)
2 parents c2d486a + 51950ef commit f54a418

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

cookbooks/bcpc/attributes/default.rb

+4
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,7 @@
245245
# jmxtrans-agent deploy location
246246
default['bcpc']['jmxtrans_agent']['lib_file'] = '/usr/lib/jmxtrans_agent/jmxtrans-agent-1.2.5.jar'
247247
default['bcpc']['jmxtrans_agent']['lib_file_checksum'] = 'd351ac0b863ffb2742477001296f65cbca6f8e9bb5bec3dc2194c447d838ae17'
248+
249+
# sshd_config
250+
default['bcpc']['ssh']['address_family'] = 'inet'
251+
default['bcpc']['ssh']['x11_forwarding'] = false

cookbooks/bcpc/recipes/ssh.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
5757
source 'sshd_config.erb'
5858
mode 00644
5959
notifies :restart, 'service[ssh]', :immediately
60-
variables lazy {{ listen_address: node[:bcpc][:management][:ip] }}
60+
variables lazy { {
61+
address_family: node['bcpc']['ssh']['address_family'],
62+
listen_address: node[:bcpc][:management][:ip],
63+
x11_forwarding: (node['bcpc']['ssh']['x11_forwarding'] ? 'yes' : 'no')
64+
} }
6165

6266
# Don't rewrite the file unless we know the listen address is valid!
6367
only_if {

cookbooks/bcpc/templates/default/sshd_config.erb

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
Port 22
99
# Use these options to restrict which interfaces/protocols sshd will bind to
1010
#ListenAddress ::
11-
ListenAddress <%= node[:bcpc][:management][:ip] %>
11+
AddressFamily <%= @address_family %>
12+
ListenAddress <%= @listen_address %>
1213

1314
Protocol 2
1415
# HostKeys for protocol version 2
@@ -64,7 +65,7 @@ ChallengeResponseAuthentication no
6465
#GSSAPIAuthentication no
6566
#GSSAPICleanupCredentials yes
6667

67-
X11Forwarding yes
68+
X11Forwarding <%= @x11_forwarding %>
6869
X11DisplayOffset 10
6970
PrintMotd no
7071
PrintLastLog yes

0 commit comments

Comments
 (0)