Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added live host keyscan #1293

Closed
wants to merge 1 commit into from

Conversation

Zarquan
Copy link
Collaborator

@Zarquan Zarquan commented Feb 16, 2024

Fixes #1286
Small thing but seeing the warning message every time we did a deploy was driving me nuts.

@Zarquan
Copy link
Collaborator Author

Zarquan commented Mar 4, 2024

Closing this because it has merge conflicts.
There is a better example of this code in the openstack delete-all script.

echo ""
echo "---- ----"
echo "Checking live host"
livehost=live.gaia-dmp.uk
echo "Checking [\${HOME}/.ssh]"
if [ ! -e "${HOME}/.ssh" ]
then
echo "Creating [\${HOME}/.ssh]"
mkdir -p "${HOME}/.ssh"
fi
echo "Checking [\${HOME}/.ssh/known_hosts]"
if [ ! -e "${HOME}/.ssh/known_hosts" ]
then
echo "Touching [\${HOME}/.ssh/known_hosts]"
touch "${HOME}/.ssh/known_hosts"
fi
echo "Checking [${livehost}][ssh-ed25519] fingerprint"
if [ $(grep -c "^${livehost:?} ssh-ed25519" ~/.ssh/known_hosts) -eq 0 ]
then
echo "Scanning [${livehost}][ssh-ed25519] fingerprint"
ssh-keyscan -t 'ssh-ed25519' "${livehost:?}" 2>/dev/null >> "${HOME}/.ssh/known_hosts"
fi
echo "Checking [${livehost}] hostname"
livename=$(ssh "fedora@${livehost:?}" 'hostname')
if [[ "${livename}" == *"${cloudname}"* ]]; then
echo "Live check [FAIL]"
read -p "You are deleting the current live system!! Do you want to proceed? (y/N) " -n 1 -r
echo
if [[ $REPLY != "y" ]];
then
exit
fi
else
echo "Live check [PASS]"
fi

@Zarquan Zarquan closed this Mar 4, 2024
@Zarquan Zarquan deleted the 20240216-zrq-livehost-warning branch September 17, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove warning from live host check
2 participants