-
-
Notifications
You must be signed in to change notification settings - Fork 164
Fix sudo password prompt #573
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
base: main
Are you sure you want to change the base?
Conversation
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Suppress verbose output during fact checking loops - Quiet SSH command execution to reduce log clutter - Fix sudo detection to only apply when not running as root - Add cleanup of temporary log files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Create separate command templates for TTY vs non-TTY scenarios - Use script-based approach for sudo commands when TTY is available - Add proper error handling and success detection for kexec operations - Capture and display remote command output for debugging - Handle connection disconnection during kexec execution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
src/nixos-anywhere.sh
Outdated
KEXEC_SCRIPT | ||
chmod +x /tmp/kexec-script.sh | ||
# Run the script and let output flow naturally | ||
${maybeSudo} /tmp/kexec-script.sh 2>&1 | tee /tmp/kexec-output.log || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insecure tempfile handling. Why do we need this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mic92 Ah because of a potential race condition with an attacker you are right, I didn't think of that.
The output log is static because then we can get the logs from the host easily without needing to back communicate the path
Co-authored-by: Jörg Thalheim <[email protected]>
Co-authored-by: Jörg Thalheim <[email protected]>
Problem
the problem / bug is in the line above where we run kexec with sudo inside a setsid terminal, that sudo needs to re-prompt for the password, and doesn't have access to stdin so it fails.
My Changes
Add a
breakpoint
function, it halts execution and gives you an interactive bash shell with all the internal variables in scopeReduce log spamming by adding
set +x
to for loopsMake
remoteCommand
write a shell script that then get's called once with sudo, instead of calling sudo inside the setsid shell