helm/apps/x86_64-linux/check-keys

34 lines
1,019 B
Plaintext
Raw Permalink Normal View History

2024-03-18 12:02:21 -07:00
#!/usr/bin/env bash
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# We're assuming this is being run as root in the NixOS installer
export SSH_DIR=/root/.ssh
check_keys() {
if [[ -f "${SSH_DIR}/id_ed25519" && -f "${SSH_DIR}/id_ed25519.pub" && -f "${SSH_DIR}/id_ed25519_agenix" && -f "${SSH_DIR}/id_ed25519_agenix.pub" ]]; then
echo -e "${GREEN}All SSH keys are present.${NC}"
else
echo -e "${RED}Some SSH keys are missing.${NC}"
if [[ ! -f "${SSH_DIR}/id_ed25519" ]]; then
echo -e "${RED}Missing: id_ed25519${NC}"
fi
if [[ ! -f "${SSH_DIR}/id_ed25519.pub" ]]; then
echo -e "${RED}Missing: id_ed25519.pub${NC}"
fi
if [[ ! -f "${SSH_DIR}/id_ed25519_agenix" ]]; then
echo -e "${RED}Missing: id_ed25519_agenix${NC}"
fi
if [[ ! -f "${SSH_DIR}/id_ed25519_agenix.pub" ]]; then
echo -e "${RED}Missing: id_ed25519_agenix.pub${NC}"
fi
echo -e "${GREEN}Run the createKeys script to generate the missing keys.${NC}"
exit 1
fi
}
check_keys