cluster-deployment/jobs/laminar-sshkey/laminar-sshkey.job

16 lines
530 B
Bash
Executable file

#!/usr/bin/env bash
sshkey="$(mktemp --tmpdir "laminarci-sshkey-pub-XXXXXXX")";
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICzYSWsGbWHh+cDheHJSKlCrxYDLwS6SKwVMV9SAaGsO laminar-ci@elessar" >"${sshkey}";
upload_target="/tmp/laminarci-sshkey-pub";
COPY "${sshkey}" "${upload_target}";
RUN "sudo mkdir -p /root/.ssh";
RUN_ONCE "cat '${upload_target}' | sudo tee /root/.ssh/authorized_keys";
RUN "rm '${upload_target}'";
# Set permissions
RUN "sudo chown -R root:root /root/.ssh";
RUN "sudo chmod 0600 /root/.ssh/authorized_keys";