feat(riot): rm - remove host keys

This commit is contained in:
Dict Xiong 2025-04-22 17:00:14 +08:00
parent b005624be2
commit b02f249f68

View File

@ -214,11 +214,33 @@ run_scp() {
eval_or_echo $cmd
}
# remove host keys
remove_hostkey()
{
local key
if [[ -z "$PORT" || "$PORT" == "22" ]]; then
key=$SERVER
else
key="[$SERVER]:$PORT"
fi
ssh-keygen -R "$key"
}
# main
print_help()
{
fmt_info "usage: $0 <service> [command] [options]"
echo "available commands: ssh (default), sshl (ssh -L), zssh, sftp"
cat <<EOF
available commands:
- ssh (default)
- tmux (run ssh in multiple tmux windows)
- sshl (ssh -L)
- sshd (ssh -D)
- zssh
- sftp
- rm (remove host keys)
- ping/ping6 (let the remote to ping the given target)
EOF
}
router() {
@ -279,6 +301,9 @@ router() {
test -n "$4" || fmt_fatal "no destination path specified"
run_scp "$3" "$4"
;;
rm )
remove_hostkey
;;
* )
print_help
fmt_fatal "unknown command: $2"