2 # Cookbook Name:: openssh
5 # Copyright 2010, OpenStreetMap Foundation.
6 # Copyright 2008-2009, Opscode, Inc.
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
21 include_recipe "networking"
23 package "openssh-client"
24 package "openssh-server"
27 if node[:lsb][:release].to_f >= 14.04
28 provider Chef::Provider::Service::Upstart
30 action [:enable, :start]
31 supports :status => true, :restart => true, :reload => true
34 hosts = search(:node, "networking:interfaces").sort_by { |n| n[:hostname] }.collect do |node|
35 names = [node[:hostname]]
37 node.interfaces(:role => :external).each do |interface|
38 names |= ["#{node[:hostname]}.openstreetmap.org"]
39 names |= ["#{node[:hostname]}.#{interface[:zone]}.openstreetmap.org"]
42 unless node.interfaces(:role => :internal).empty?
43 names |= ["#{node[:hostname]}.#{node[:networking][:roles][:external][:zone]}.openstreetmap.org"]
47 "rsa" => node[:keys][:ssh][:host_rsa_public],
48 "dsa" => node[:keys][:ssh][:host_dsa_public]
51 if node[:keys][:ssh][:host_ecdsa_public]
52 ecdsa_type = node[:keys][:ssh][:host_ecdsa_type]
54 keys[ecdsa_type] = node[:keys][:ssh][:host_ecdsa_public]
59 :addresses => node.ipaddresses.sort,
64 template "/etc/ssh/ssh_config" do
65 source "ssh_config.erb"
71 template "/etc/ssh/ssh_known_hosts" do
72 source "ssh_known_hosts.erb"
82 firewall_rule "accept-ssh" do