#
# sshd_port: If you want to specify a different port than the default 22
# Default: 22
+#
+# sshd_authorized_keys_file: Set this to the location of the AuthorizedKeysFile (e.g. /etc/ssh/authorized_keys/%u)
+# Default: AuthorizedKeysFile %h/.ssh/authorized_keys
+#
class sshd {
include sshd::client
'' => 22,
default => $sshd_port
}
-
+ $real_sshd_authorized_keys_file = $sshd_authorized_keys_file ? {
+ '' => "%h/.ssh/authorized_keys",
+ default => $sshd_authorized_keys_file
+ }
+
file { 'sshd_config':
path => '/etc/ssh/sshd_config',
owner => root,
<%- else %>
PubkeyAuthentication no
<%- end %>
-#AuthorizedKeysFile .ssh/authorized_keys
+
+<%- unless real_sshd_authorized_keys_file.to_s.empty? then %>
+AuthorizedKeysFile <%= real_sshd_authorized_keys_file %>
+<%- else %>
+AuthorizedKeysFile %h/.ssh/authorized_keys
+<%- end %>
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
<%- if real_sshd_rhosts_rsa_authentication.to_s == 'yes' then %>
PubkeyAuthentication no
<%- end %>
-#AuthorizedKeysFile %h/.ssh/authorized_keys
+<%- unless real_sshd_authorized_keys_file.to_s.empty? then %>
+AuthorizedKeysFile <%= real_sshd_authorized_keys_file %>
+<%- else %>
+AuthorizedKeysFile %h/.ssh/authorized_keys
+<%- end %>
# For this to work you will also need host keys in /etc/ssh_known_hosts
<%- if real_sshd_rhosts_rsa_authentication.to_s == 'yes' then %>
<%- else %>
PubkeyAuthentication no
<%- end %>
-#AuthorizedKeysFile .ssh/authorized_keys
+
+<%- unless real_sshd_authorized_keys_file.to_s.empty? then %>
+AuthorizedKeysFile <%= real_sshd_authorized_keys_file %>
+<%- else %>
+AuthorizedKeysFile %h/.ssh/authorized_keys
+<%- end %>
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
<%- if real_sshd_rhosts_rsa_authentication.to_s == 'yes' then %>
PubkeyAuthentication no
<%- end %>
-#AuthorizedKeysFile .ssh/authorized_keys
+<%- unless real_sshd_authorized_keys_file.to_s.empty? then %>
+AuthorizedKeysFile <%= real_sshd_authorized_keys_file %>
+<%- else %>
+AuthorizedKeysFile %h/.ssh/authorized_keys
+<%- end %>
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
<%- if real_sshd_rhosts_rsa_authentication.to_s == 'yes' then %>