Repository navigation
vmlab.sh: use a lab directory only if it is private to the user - #108
Merged
Merged
Conversation
The default --dir is a fixed name in world-writable /var/tmp, and mkdir -p accepted a directory another local user had created, with their base.img in it. vmlab.sh now refuses a lab directory that is a symlink, not owned by the caller, or writable by group or others, checked again after create's mkdir. Closes #105
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #105.
What changed
lab_privaterefuses--dirwhen it is a symlink or not a directory, not owned by the caller, or writable by group or others. It runs for every command except help, and again increateright aftermkdir -p -m 0755, becausemkdir -pis satisfied by a directory created in the meantime./var/tmp/vmlab, so existing labs keep working with no migration; qemu still needs to read it (0755).Why
/var/tmp/vmlabis a fixed name in a world-writable directory. Another local user could create it first, and vmlab.sh would then use theirbase.imgas every VM's backing image and write into their directory.Verification
vmlab/tests/vmlab_test.sh: a 0777 directory is refused (status and create), a symlink is refused, an own 0755 directory passes, and--helpalways works. On the old code:FAIL: accepted a 0777 lab directory; new code:PASS../run-tests(now with the vmlab suite):all 11 passed, 3 skipped.Not verified
-Otest.