lxc-test-apparmor-mount revision efdca59e498ce7a7ff0db091d7d2fec01a91b8ea
# apparmor_mount: test proper handling of apparmor in kernels
# without mount features
# These require the ubuntu lxc package to be installed.
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# This test assumes an Ubuntu host
set -e
echo -n "Failed " >&2
echo "$*" >&2
exit 1
}
env http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
}
DONE=0
echo "FAIL"
exit 1
fi
echo "PASS"
}
trap cleanup exit
# Only run on a normally configured ubuntu lxc system
echo "lxcbr0 is not configured."
exit 1
fi
echo "ERROR: Must run as root."
exit 1
fi
# This would be much simpler if we could run it as
# root. However, in order to not have the bind mount
# of an empty directory over the securitfs 'mount' directory
# be removed, we need to do this as non-root.
# create a test user
ARCH=$(dpkg --print-architecture)
fi
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.id_map = u 0 910000 9999
lxc.id_map = g 0 910000 9999
EOF
cd $HDIR
done
else
done
fi
echo "test default confined container"
if [ "x$profile" != "xlxc-container-default (enforce)" ]; then
echo "FAIL: confined container was in profile $profile"
exit 1
fi
echo "test regular unconfined container"
if [ "x$profile" != "xunconfined" ]; then
echo "FAIL: unconfined container was in profile $profile"
exit 1
fi
echo "masking $MOUNTSR"
echo "test default confined container"
sleep 3
echo "FAIL: confined container started without mount restrictions"
echo "pid was $pid"
exit 1
fi
echo "test regular unconfined container"
if [ "$pid" = "-1" ]; then
echo "FAIL: unconfined container failed to start without mount restrictions"
exit 1
fi
if [ "x$profile" != "xunconfined" ]; then
echo "FAIL: confined container was in profile $profile"
exit 1
fi
echo "testing override"
if [ "$pid" = "-1" ]; then
echo "FAIL: excepted container failed to start without mount restrictions"
exit 1
fi
if [ "x$profile" != "xlxc-container-default (enforce)" ]; then
echo "FAIL: confined container was in profile $profile"
exit 1
fi
DONE=1