Skip to content

Commit a1075a8

Browse files
committed
Write ssh-host-keys directly to the kickstart to deploy trusted server. Kickstart directory security can be somehow enhanced in the future e.g. by adding base64 hash to the directorypath.
1 parent d9511c0 commit a1075a8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

templates/kickstart.cfg

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,21 @@ bind-utils
158158
{% endif %}
159159
/usr/bin/chmod 600 /root/.ssh/authorized_keys
160160

161+
# put ssh-host keys directly to kickstart
162+
cat <<EOF > /etc/ssh/ssh_host_ed25519_key.new
163+
{% include 'files/nodes/'~ item ~ '/ssh/ssh_host_ed25519_key' %}
164+
165+
EOF
166+
167+
echo "{% include 'files/nodes/'~ item ~ '/ssh/ssh_host_ed25519_key.pub' %}" > /etc/ssh/ssh_host_ed25519_key.pub.new
168+
169+
if [ -s /etc/ssh/ssh_host_ed25519_key.new ]; then
170+
mv /etc/ssh/ssh_host_ed25519_key.new /etc/ssh/ssh_host_ed25519_key
171+
chmod 600 /etc/ssh/ssh_host_ed25519_key
172+
mv /etc/ssh/ssh_host_ed25519_key.pub.new /etc/ssh/ssh_host_ed25519_key.pub
173+
chmod 600 /etc/ssh/ssh_host_ed25519_key.pub
174+
fi
175+
161176
#/usr/bin/systemctl stop NetworkManager.service
162177
#/usr/bin/systemctl disable NetworkManager.service
163178

0 commit comments

Comments
 (0)