Harden kill script and DNS config

This commit is contained in:
Thales Maciel 2026-01-29 16:49:54 -03:00
parent 68cf5f2cbb
commit e10a51558e
No known key found for this signature in database
GPG key ID: 33112E6833C34679
3 changed files with 13 additions and 7 deletions

10
kill.sh
View file

@ -77,10 +77,20 @@ fi
INFO_FILE="$(find_vm_info "$QUERY")"
PID="$(get_prop "$INFO_FILE" "pid")"
API_SOCK="$(get_prop "$INFO_FILE" "api_sock")"
if [[ -z "$PID" ]]; then
log "pid not found in $INFO_FILE"
exit 1
fi
if [[ -z "$API_SOCK" ]]; then
log "api_sock not found in $INFO_FILE"
exit 1
fi
if ! ps -p "$PID" -o comm=,args= 2>/dev/null | rg -q "firecracker.*--api-sock $API_SOCK"; then
log "pid $PID does not match a running VM"
exit 1
fi
log "sending SIG$SIGNAL to pid $PID"
sudo kill "-$SIGNAL" "$PID"