mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-04 20:58:13 +00:00
templates: improve refusing to run unprivileged
For all templates except lxc-ubuntu-cloud and lxc-download, detect not only --mapped-uid but also --mapped-gid and error out. Detecting will not be done after -- parameter because of non-option parameters. Also, change the mode of lxc-archlinux.in 100755 to 100644. Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
35f746711b
commit
c63c04fcaf
@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -25,8 +25,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
5
templates/lxc-archlinux.in
Executable file → Normal file
5
templates/lxc-archlinux.in
Executable file → Normal file
@ -26,8 +26,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -21,8 +21,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -73,8 +73,9 @@ lxc_network_link=lxcbr0
|
||||
# should be able to use EITHER. Give preference to /etc/os-release for now.
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -22,8 +22,9 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -21,8 +21,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -73,8 +73,9 @@ lxc_network_link=lxcbr0
|
||||
# should be able to use EITHER. Give preference to /etc/os-release for now.
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -14,8 +14,9 @@
|
||||
#
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -27,8 +27,9 @@
|
||||
#
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -26,8 +26,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -28,8 +28,9 @@
|
||||
#
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -29,8 +29,9 @@
|
||||
# lxc-ubuntu script
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -21,8 +21,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
@ -25,8 +25,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Detect use under userns (unsupported)
|
||||
for arg in $*; do
|
||||
if [ "$arg" == "--mapped-uid" ]; then
|
||||
for arg in "$@"; do
|
||||
[ "$arg" == "--" ] && break
|
||||
if [ "$arg" == "--mapped-uid" -o "$arg" == "--mapped-gid" ]; then
|
||||
echo "This template can't be used for unprivileged containers." 1>&2
|
||||
echo "You may want to try the \"download\" template instead." 1>&2
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user