Commit 4eac9913 by Stéphane Graber

lxc-download: Detect unpriv created by real root

This adds yet another case in the in_userns function detecting the case where an unprivileged container is created by the real uid 0, in which case we want to share the system wide cache but still use the unprivileged templates and unpack method. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 4672c91a
...@@ -142,8 +142,11 @@ gpg_validate() { ...@@ -142,8 +142,11 @@ gpg_validate() {
in_userns() { in_userns() {
[ -e /proc/self/uid_map ] || { echo no; return; } [ -e /proc/self/uid_map ] || { echo no; return; }
line=$(awk '{ print $1 " " $2 " " $3 }' /proc/self/uid_map) awk '{ print $1 " " $2 " " $3 }' /proc/self/uid_map | while read line; do
[ "$line" = "0 0 4294967295" ] && { echo no; return; } [ "$line" = "0 0 4294967295" ] && { echo no; return; }
echo $line | grep -q " 0 1$" && { echo userns-root; return; }
done
[ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && \ [ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && \
{ echo userns-root; return; } { echo userns-root; return; }
echo yes echo yes
......
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