Strip SSH key comments on deploy; add preconfig_sd.sh
Copying authorized_keys verbatim onto a drop implant leaks internal hostnames,
usernames, and tool names in key comments. preconfig_sd.sh now strips all
comments (awk '{print $1,$2}') when writing keys to SD card. deploy.sh adds
the same strip step on the live device as a safety net.
This commit is contained in:
+7
-1
@@ -75,7 +75,13 @@ if [[ $SETUP_EXIT -ne 0 ]]; then
|
||||
exit $SETUP_EXIT
|
||||
fi
|
||||
|
||||
# ── 4. Final status ──────────────────────────────────────────────────────────
|
||||
# ── 4. Strip key comments from authorized_keys ───────────────────────────────
|
||||
step "Stripping SSH key comments (OPSEC)..."
|
||||
ssh -o StrictHostKeyChecking=no "$TARGET" \
|
||||
"awk '{print \$1, \$2}' /root/.ssh/authorized_keys > /tmp/.ak_clean && mv /tmp/.ak_clean /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys" 2>/dev/null || true
|
||||
info "Key comments stripped"
|
||||
|
||||
# ── 5. Final status ──────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
step "Deployment status"
|
||||
ssh -o StrictHostKeyChecking=no "$TARGET" \
|
||||
|
||||
Reference in New Issue
Block a user