File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
app/views/unattended/provisioning_templates/snippet Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ description: |
1010
1111 remote_execution_ssh_keys: public keys to be put in ~/.ssh/authorized_keys
1212
13+ remote_execution_ssh_ca_keys: public ssh CA keys to be put in
14+ /etc/ssh/sshd_config.d/60-user-ca.conf
15+
1316 remote_execution_ssh_user: user for which remote_execution_ssh_keys will be
1417 authorized
1518
@@ -33,7 +36,7 @@ if [ -z "$PKG_MANAGER" ]; then
3336<%= indent(2) { snippet 'pkg_manager' } -%>
3437fi
3538
36- <% if !host_param('remote_execution_ssh_keys').blank? %>
39+ <% if !host_param('remote_execution_ssh_keys').blank? || !host_param('remote_execution_ssh_ca_keys').blank? %>
3740<% ssh_user = host_param('remote_execution_ssh_user') || 'root' %>
3841
3942user_exists=false
6467 # Restore SELinux context with restorecon, if it's available:
6568 command -v restorecon && restorecon -RvF <%= ssh_path %> || true
6669
70+ <% if host_param ( 'remote_execution_ssh_ca_keys' ) . present? -%>
71+ cat < < EOF > > /etc/ssh/user-ca.pub
72+ <%= host_param ( 'remote_execution_ssh_ca_keys' ) . is_a? ( String ) ? host_param ( 'remote_execution_ssh_ca_keys' ) : host_param ( 'remote_execution_ssh_ca_keys' ) . join ( "\n " ) %>
73+ EOF
74+
75+ chmod 0644 /etc/ssh/user-ca.pub
76+
77+ mkdir -p /etc/ssh/sshd_config.d
78+ echo 'TrustedUserCAKeys /etc/ssh/user-ca.pub' > /etc/ssh/sshd_config.d/60-user-ca.conf
79+ systemctl restart sshd
80+ <% end -%>
81+
6782<% if ssh_user != 'root' && host_param ( 'remote_execution_effective_user_method' ) == 'sudo' -%>
6883if [ ! -x "$(command -v sudo)" ]; then
6984 $PKG_MANAGER_INSTALL sudo
You can’t perform that action at this time.
0 commit comments