Commit f293239d authored by Michael Shigorin's avatar Michael Shigorin

build-vm: try system tar2fs first

It's at least removing the very obvious user->root attack through (maliciously) modifying bin/tar2fs and waiting for it to be run; if mkimage-profiles is installed system-wide as a package, the script from /usr/share/mkimage-profiles will be tried so those willing to allow vm/* build to themselves can provide for a passwordless sudo (as described in doc/vm.txt) to run a root-only writable script, not user-writable. Still not perfect but a step away from the abyss.
parent f39890cb
......@@ -14,7 +14,9 @@
При работе с локальной копией mkimage-profiles.git следует иметь
в виду, что предоставлять недоверенному пользователю право выполнять
от имени root доступный ему по записи скрипт равнозначно предоставлению
полных привилегий root.
полных привилегий root (поэтому фича build-vm сперва проверяет наличие
системно установленного пакета и по возможности старается запустить
под sudo скрипт из него, доступный по записи только root).
Для работы с более специфичными форматами, чем raw ("буквальный"
образ диска), потребуется утилита qemu-img из одноименного пакета;
......
......@@ -20,7 +20,10 @@ check-sudo:
fi
prepare-image: check-sudo
@if ! sudo $(TOPDIR)/bin/tar2fs \
@if [ -x $(MKIMAGE_PREFIX)/bin/tar2fs ]; then \
TOPDIR=$(MKIMAGE_PREFIX); \
fi; \
if ! sudo $(TOPDIR)/bin/tar2fs \
"$(VM_TARBALL)" "$(VM_RAWDISK)" $(VM_SIZE) $(VM_FSTYPE); then \
echo "** error: sudo tar2fs failed, see also doc/vm.txt" >&2; \
exit 1; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment