Add address masks
[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 = case @fqdn
8                         when "paradis.debian.org" then "
9 ListenAddress 0.0.0.0:22
10 ListenAddress [::]:22
11 ListenAddress 5.153.231.31:443
12 ListenAddress [2001:41c8:1000:21::21:31]:443
13 "
14                  end
15 extraports
16 %>
17 # Use these options to restrict which interfaces/protocols sshd will bind to
18 Protocol 2
19
20 HostKey /etc/ssh/ssh_host_rsa_key
21 <%- if has_variable?("has_etc_ssh_ssh_host_ed25519_key") && @has_etc_ssh_ssh_host_ed25519_key -%>
22 HostKey /etc/ssh/ssh_host_ed25519_key
23 <% end %>
24 <% if scope.function_has_role(['ssh.upload.d.o']) -%>
25 # On ssh upload hosts we have many clients doing ssh connections to us.
26 # sshd has - by default - a limit of 10 on the number of currently
27 # unauthenticated (or not yet authenticated) connections.  Raise that limit.
28 MaxStartups 100:30:200
29 <% end %>
30
31 LogLevel VERBOSE
32
33 # Authentication:
34 PermitRootLogin without-password
35
36 ChallengeResponseAuthentication no
37
38 PrintMotd no
39
40 #MaxStartups 10:30:60
41
42 AcceptEnv LANG LC_*
43
44 Subsystem sftp /usr/lib/openssh/sftp-server
45
46 UsePAM yes
47
48 AuthorizedKeysFile /etc/ssh/userkeys/%u /var/lib/misc/userkeys/%u /etc/ssh/userkeys/%u.more
49
50 PasswordAuthentication no
51
52 Match Address <%=
53   allnodeinfo = scope.lookupvar('site::allnodeinfo')
54   dbs = []
55   allnodeinfo.keys.sort.each do |node|
56       next unless allnodeinfo[node].has_key?('ipHostNumber')
57       if allnodeinfo[node]['ipHostNumber'] =~ ":"
58           dbs << "#{allnodeinfo[node]['ipHostNumber']}/128"
59       else
60           dbs << "#{allnodeinfo[node]['ipHostNumber']}/32"
61       end
62   end
63   dbs.flatten.join(',')
64 %>
65   Banner "You're coming from a debian.org host"
66
67 Match Group sftponly
68   AllowStreamLocalForwarding no
69   AllowTCPForwarding no
70   X11Forwarding no
71   ForceCommand internal-sftp