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

virtme-init: always override sudoers #69

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions virtme/guest/virtme-init
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,19 @@ fi
# Bring up networking
ip link set dev lo up

# Setup sudoers
real_sudoers=/etc/sudoers
tmpfile="`mktemp --tmpdir=/tmp`"
echo "Defaults secure_path=\"/usr/sbin:/usr/bin:/sbin:/bin\"" > $tmpfile
echo "root ALL = (ALL) NOPASSWD: ALL" >> $tmpfile
if [[ -n "${virtme_user}" ]]; then
real_sudoers=/etc/sudoers
tmpfile="`mktemp --tmpdir=/tmp`"
echo "Defaults secure_path=\"/usr/sbin:/usr/bin:/sbin:/bin\"" > $tmpfile
echo "root ALL = (ALL) NOPASSWD: ALL" >> $tmpfile
echo "${virtme_user} ALL = (ALL) NOPASSWD: ALL" >> $tmpfile
chmod 440 "$tmpfile"
if [ ! -f "$real_sudoers" ]; then
touch "$real_sudoers"
fi
mount --bind "$tmpfile" "$real_sudoers"
fi
chmod 440 "$tmpfile"
if [ ! -f "$real_sudoers" ]; then
touch "$real_sudoers"
fi
mount --bind "$tmpfile" "$real_sudoers"

if cat /proc/cmdline |grep -q -E '(^| )virtme.dhcp($| )'; then
# udev is liable to rename the interface out from under us.
Expand Down
2 changes: 1 addition & 1 deletion virtme_ng_init
Submodule virtme_ng_init updated 1 files
+6 −8 src/main.rs
Loading