debian-forge-composer/tools/gen-ssh.sh
Miguel Martín 991293a897 Generate FIPS compliant SSH keys
Generate FIPS compliant SSH keys required
for testing system FIPS mode support
2023-12-13 10:19:47 +01:00

27 lines
604 B
Bash
Executable file

#!/usr/bin/bash
# Create SSH key
SSH_DATA_DIR="$(mktemp -d)"
SSH_KEY=${SSH_DATA_DIR}/id_rsa
ssh-keygen -f "${SSH_KEY}" -N "" -q -t rsa-sha2-256 -b 2048
# Change cloud-init/user-data ssh key
key=" - $(cat "${SSH_KEY}".pub)"
# Temporary, will copy user data from cloud-init once
# go test are updated
tee "${SSH_DATA_DIR}"/user-data > /dev/null << EOF
#cloud-config
write_files:
- path: "/etc/smoke-test.txt"
content: "c21va2UtdGVzdAo="
encoding: "b64"
owner: "root:root"
permissions: "0644"
user: redhat
ssh_authorized_keys:
${key}
EOF
# Return temp directory
echo "${SSH_DATA_DIR}"