Try to avoid reserved site keyword
[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 /etc/ssh/puppetkeys/%u
49
50 PasswordAuthentication no
51
52 <%=
53   allnodeinfo = scope.lookupvar('deprecated::allnodeinfo')
54   out = ''
55   settings = '#  Banner "You are coming from a debian.org host."'
56   allnodeinfo.keys.sort.each do |node|
57       next unless allnodeinfo[node].has_key?('ipHostNumber')
58       out += "# Match Address "
59       out += allnodeinfo[node]['ipHostNumber'].collect do |ipnum|
60           if ipnum =~ /:/
61               "#{ipnum}/128"
62           else
63               "#{ipnum}/32"
64           end
65       end.join(',')
66       out += " # #{node}"
67       out += "\n"
68       out += settings
69       out += "\n\n"
70   end
71   out
72 %>
73
74 Match Group sftponly
75   AllowStreamLocalForwarding no
76   AllowTCPForwarding no
77   X11Forwarding no
78   ForceCommand internal-sftp