move sshd extra ports to class params instead of hardcoded in the template
[mirror/dsa-puppet.git] / modules / ssh / templates / sshd_config.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5
6 Port 22
7 <% @extraports.each do |port| -%>
8 ListenAddress <%= $port %>
9 <% end -%>
10 # Use these options to restrict which interfaces/protocols sshd will bind to
11 Protocol 2
12
13 HostKey /etc/ssh/ssh_host_rsa_key
14 <%- if has_variable?("has_etc_ssh_ssh_host_ed25519_key") && @has_etc_ssh_ssh_host_ed25519_key -%>
15 HostKey /etc/ssh/ssh_host_ed25519_key
16 <% end %>
17 <% if classes.include?("roles::ssh_upload") -%>
18 # On ssh upload hosts we have many clients doing ssh connections to us.
19 # sshd has - by default - a limit of 10 on the number of currently
20 # unauthenticated (or not yet authenticated) connections.  Raise that limit.
21 MaxStartups 100:30:200
22 <% end %>
23
24 LogLevel VERBOSE
25
26 # Authentication:
27 PermitRootLogin without-password
28
29 ChallengeResponseAuthentication no
30
31 PrintMotd no
32
33 #MaxStartups 10:30:60
34
35 AcceptEnv LANG LC_*
36
37 Subsystem sftp /usr/lib/openssh/sftp-server
38
39 UsePAM yes
40
41 AuthorizedKeysFile /etc/ssh/userkeys/%u /var/lib/misc/userkeys/%u /etc/ssh/userkeys/%u.more /etc/ssh/puppetkeys/%u
42
43 PasswordAuthentication no
44
45 <%=
46   allnodeinfo = scope.lookupvar('deprecated::allnodeinfo')
47   out = ''
48   settings = '#  Banner "You are coming from a debian.org host."'
49   allnodeinfo.keys.sort.each do |node|
50       next unless allnodeinfo[node].has_key?('ipHostNumber')
51       out += "# Match Address "
52       out += allnodeinfo[node]['ipHostNumber'].collect do |ipnum|
53           if ipnum =~ /:/
54               "#{ipnum}/128"
55           else
56               "#{ipnum}/32"
57           end
58       end.join(',')
59       out += " # #{node}"
60       out += "\n"
61       out += settings
62       out += "\n\n"
63   end
64   out
65 %>
66
67 Match Group sftponly
68   AllowStreamLocalForwarding no
69   AllowTCPForwarding no
70   X11Forwarding no
71   ForceCommand internal-sftp