aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-06-08 11:43:38 -0300
committerEuAndreh <eu@euandre.org>2019-06-08 11:43:38 -0300
commitf054e9dea98bf56c8ea068dc279e99e76a334848 (patch)
tree116518290093461bcd9655398583e3fb1bd91176 /scripts/ci
parentUse nextcloud.${TLD} instead of cloud.${TLD} as CNAME for Nextcloud installation (diff)
downloadtoph-f054e9dea98bf56c8ea068dc279e99e76a334848.tar.gz
toph-f054e9dea98bf56c8ea068dc279e99e76a334848.tar.xz
Generate UserKnownHostsFile dynamically instead of when rotating keys
The previous solution would hardcode the server IP. This way we can change the server IP address that is hosting everything and keep the SSH keypair. Previously changing the IP address would require either calling the =./rotate-ssh-keys.sh= script or manually changing the IP address on the known-hosts.txt file. The IP address being duplicated itself was a code smell. Both SSH keypair and IP address can now be changed independently.
Diffstat (limited to 'scripts/ci')
-rwxr-xr-xscripts/ci/setup.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/ci/setup.sh b/scripts/ci/setup.sh
index d9ac70c..b23b48f 100755
--- a/scripts/ci/setup.sh
+++ b/scripts/ci/setup.sh
@@ -33,6 +33,8 @@ export SSH_SERVER_PUBLIC_KEY
# https://stackoverflow.com/questions/24963705/is-there-an-escape-character-for-envsubst
export DOLLAR='$'
+PUBLIC_KEY_ONLY="$(awk '{print $2}' < ./secrets/ssh/vps-box-server.pub)"
+echo "${TLD},${PINNED_IP} ssh-rsa $(echo $SSH_SERVER_PUBLIC_KEY | awk '{print $2}')" > ./generated-known-hosts.txt
envsubst < ./ssh.env.conf >> ~/.ssh/config
envsubst < ./hosts.env > ./hosts
envsubst < ./docker-compose.env.yaml > ./docker-compose.yaml