Commit Graph

823 Commits

Author SHA1 Message Date
Stéphane Graber
97f93be72e
meson: Align SPDX license id
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-04-02 20:42:09 -04:00
Stéphane Graber
85abd4026f
template: Use SPDX
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-04-02 17:51:55 -04:00
Tanmay Naik
df0665b6de
oci: resolve cross-filesystem blob caching failure
This commit addresses an issue in the OCI template where lxc-create
fails if OCI-cache directory for blob caching is not on the same mount
as the destination OCI directory. lxc-create bails when skopeo tries to
create a hard-link across the two and fails.

For example, if /var/lib/lxc is a bind mountpoint of a random directory
and skopeo fails to hard-link across /var/cache/lxc and /var/lib/lxc

This commit introduces a check where if both directories are on not the
same mount points, it disables blob caching in skopeo and continues.

Signed-off-by: Tanmay Naik <tnaik96@gmail.com>
2024-02-03 08:22:52 +00:00
Jacob McNamee
07e3a516e4 lxc-download, lxc-local: preserve xattrs on unpack
Update tar invocation to preserve all xattrs when unpacking the rootfs,
notably retaining security.capability xattrs (e.g. for ping, newuidmap)

Note: bsdtar already preserves xattrs with -p

Signed-off-by: Jacob McNamee <jacob@jacobmcnamee.com>
2024-01-28 13:22:10 -08:00
Peter Michaux
6b40e66c11 Fix error message.
Signed-off-by: Peter Michaux <petermichaux@gmail.com>
2024-01-08 19:56:08 -08:00
Peter Michaux
c8189ee2a3 Add verbose output in download template.
Signed-off-by: Peter Michaux <petermichaux@gmail.com>
2024-01-08 19:56:08 -08:00
Peter Michaux
84cc3155af
Align columns in lxc-download.in template
Signed-off-by: Peter Michaux <petermichaux@gmail.com>
2024-01-05 22:10:34 -08:00
Zen
86f5c12264
lxc-local: Add --no-dev option to exclude /dev from the fstree
Signed-off-by: Zen <z@pyl.onl>
2023-12-11 17:04:59 -05:00
Zen
f885a3c560
lxc-local: Re-organize code to use more functions
Signed-off-by: Zen <z@pyl.onl>
2023-12-11 17:04:41 -05:00
Zen
7c025072ed
lxc-local: Improve usage info
Signed-off-by: Zen <z@pyl.onl>
2023-12-11 16:59:15 -05:00
Zen
faa38a1979
lxc-local: Change LXC_CONFIG to LXC_METADATA to match args and be more clear
Signed-off-by: Zen <z@pyl.onl>
2023-12-11 16:55:01 -05:00
Levent Komurcu
64167f9064 Add libarchive tar support for lxc download
This patch fixes unpacking images when the system provided tar is libarchive (bsd-tar). bsd-tar  doesn't support 'exclude' flags (--anchored) like gnu-tar does. Instead each exclude path is prepended with ^ to simulate behavior of --anchored when bsd tar is detected.

Signed-off-by: Levent Komurcu <levent.komurcu@nl.bosch.com>
2023-06-26 09:23:30 +02:00
Scott Moser
1a2da75b6e Add support for squashfs images in oci via atomfs
This adds support to the oci template for squashfs images.
It uses 'atomfs' from [1] to accomplish this.

Squashfs images (media type
application/vnd.stacker.image.layer.squashfs+zstd+verity) have several
benefits compared to tar+gz:

 * immediately mountable
 * read-only filesystem
 * verity data present in oci manifest.

I presented this at Fosdem 2023 at [2].

The 'atomfs' program can be replaced by passing '--mount-helper'
argument to the oci template.

    mount-helper mount oci:<oci_dir>:<oci_name> <mountpoint>
    mount-helper umount <mountpoint>

[1] https://github.com/project-machine/atomfs
[2] https://fosdem.org/2023/schedule/event/container_secure_storage/

Signed-off-by: Scott Moser <smoser@brickies.net>
2023-02-27 09:06:37 -05:00
Stéphane Graber
4c8139f9cf
Remove autotools
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-06-08 00:46:59 -04:00
Stéphane Graber
eba7f7a6bc
meson: Rework configuration variables
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-06-02 16:50:00 -04:00
Stéphane Graber
51f90ad973
meson: Re-organize dir variables
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-12 22:24:03 +02:00
Stéphane Graber
46b9598f1a
meson: Fix template installation location
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-01 10:24:31 +02:00
Stéphane Graber
20b03401be
meson: Cleanup build configs
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-04-28 22:17:01 -04:00
Christian Brauner
8128bbef4d
Merge pull request #4062 from stgraber/master
lxc-download: Rely on HTTPS only
2022-01-18 15:24:41 +01:00
Stéphane Graber
5852026304
lxc-download: Rely on HTTPS only
GPG has been a major source of issues over the years with various
attacks on the key network as well as client side issues making it hard
to retrieve our keys.

Back when we introduced the image server, SSL certificates were still
expensive and annoying to setup, so not something we'd have expected
potential mirrors to setup for us. They were also issued for multiple
years, making a compromise of such a certificate quite problematic.

But things have changed since, we now have completely free, very easily
deployable SSL certificates everywhere with the majority of those being
shortlived and with good reporting of issued certificates.

With that, we can now deprecate the GPG validation, disable the fallback
to non-HTTPS download and rely on our indices being accurate because
they've been downloaded from a server with a valid certificate.

This puts LXC more in line with what LXD has done since the beginning
and should offer a more reliable user experience.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-01-17 21:15:53 -05:00
Diederik de Haas
ac46b35693
Replace deprecated backticks with $() construct
See https://github.com/koalaman/shellcheck/wiki/SC2006 for details.
Not only uses this the recommended construct, it also makes the code
more uniform as in many other places the $() construct was already used.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
2021-10-28 20:15:29 +02:00
Diederik de Haas
7a7671655a
Replace 'which' with 'command -v'
The 'which' command is deprecated on Debian Sid as it is not POSIX
compliant and it's behavior is therefor not consistent, so replace it
with 'command -v' which is POSIX compliant.
See https://stackoverflow.com/a/677212 for details.

Also replaced a use of backticks (`) as that is deprecated as well.
See https://github.com/koalaman/shellcheck/wiki/SC2006 for details.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
2021-10-28 17:27:08 +02:00
Christian Brauner
3cc0ec841e
templates: don't double quote
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-27 12:42:22 +02:00
Christian Brauner
7172b98c77
build: add templates
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-27 12:39:10 +02:00
Christian Brauner
b081cb55e4
busybox: simplify
Start relying on autodev for busybox template and wipe all the device
creation.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-17 13:50:58 +02:00
Christian Brauner
8829829deb
busybox: mount sys:ro
There's no udev so sys doesn't need to be read-write.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-08-17 13:49:56 +02:00
Simon Deziel
dcc08eb562 lxc-download: add LXC version/compat level to user-agent
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
2021-08-10 10:35:48 -04:00
Stéphane Graber
f2a5d95d00
lxc-download: Switch GPG server
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2021-06-27 23:42:52 -04:00
Christian Ratzenhofer
655d10ed7f templates/*.in: fixed PATH handling with spaces
if $PATH already contains a path with a space the append of the
default directories in all template scripts fails with an error
like the following:

/usr/share/lxc/templates/lxc-download: 69: export: (x86)/NVIDIA: bad
variable name

Signed-off-by: Christian Ratzenhofer <christian.ratzenhofer@cdnm.at>
2021-04-06 14:43:11 +02:00
Andrew Deng
67e7ac7b85 added standard resolver option to the lxc-download.in shell script
Signed-off-by: Andrew Deng <adeng1433@gmail.com>
2020-12-08 14:14:33 -06:00
Stéphane Graber
e14546e377
lxc-download: Fix retry loop
Closes #3511

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2020-08-07 15:10:25 -04:00
Stéphane Graber
459fef2680
Revert "templates/lxc-download.in: use GPG option --receive-keys instead of --recv-keys"
This reverts commit 409040e702.

Testing of both options show identical behavior but receive-keys does
not exist on older releases, so let's revert this.

Closes #3510

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2020-08-07 15:09:01 -04:00
Johannes Kastl
409040e702
templates/lxc-download.in: use GPG option --receive-keys instead of --recv-keys
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
2020-07-01 07:09:09 +02:00
Johannes Kastl
eb44984ae5
templates/lxc-download.in: make shellcheck happy
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
2020-06-30 19:18:21 +02:00
Johannes Kastl
18e18d4c31
templates/lxc-download.in: fix wrong if condition (use the result of the gpg command, not the result when executing the result of the gpg command)
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
2020-06-30 18:52:49 +02:00
Toni Ylenius
bbd84ff1a7 Fix lxc-oci template with loop backingstore
Move the content of rootfs inside OCI package to rootfs instead of
replacing it, as the directory is used as the mountpoint.

Tested with directory and loop backingstore.

Signed-off-by: Toni Ylenius <toni.ylenius@iki.fi>
2020-04-12 22:31:30 +03:00
Stéphane Graber
7a930fe7fd
lxc-download: Pre-release bump of compat
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2020-03-24 14:44:08 -04:00
Christian Brauner
309b71d7e6
lxc-local: remove -l/--list from help
Closes #2877.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-23 13:23:19 +01:00
Stéphane Graber
bff9399765
busybox: Mark mqueue optional
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2020-03-16 21:49:55 -04:00
Rachid Koucha
1f76a6a777
Auto-create /dev/shm and /dev/mqueue
Mount fs on /dev/shm and /dev/mqueue to experiment IPC in namespaces

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2020-03-16 21:19:15 +01:00
Stéphane Graber
83e280f649
busybox: Fix bad lxc.mount.entry
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2020-03-16 15:48:32 -04:00
Rachid Koucha
078c676f4d
Trigger the mounting of shm file system
shm file system was not mounted because of the "/" in :
lxc.mount.entry = shm /dev/shm tmpfs defaults 0 0

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2020-03-16 19:10:00 +01:00
Rachid Koucha
eeea2ef1b1
Suppress useless udhcpc directory
The udhcpc directory is created with "mkdir -p" at the place dynamically specified by "busybox udhcpc --help".

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2020-01-03 10:48:41 +01:00
Rachid Koucha
e76e315c11
Adaptation to latest busybox
In busybox 1.30, the help of udhcpc for "-s" option changed:
--> busybox v1.27.2: -s,--script PROG	Run PROG at DHCP events (default /usr/share/udhcpc/default.script)
--> busybox v1.30.1: -s PROG		Run PROG at DHCP events (default /etc/udhcpc/default.script)
So, I changed the command line which extracts the script name to make it work for both versions

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-12-27 08:49:00 +01:00
Stéphane Graber
44c7d9c39c
Merge pull request #3097 from lpirl/proc-1-uid_map-permission-denied
suppress false-negative error in templates and nvidia hook
2019-08-27 13:38:57 -06:00
Stéphane Graber
23f4d86859
lxc-download: Pre-release bump of compat
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2019-07-22 18:23:48 -04:00
Lukas Pirl
16a312e118
suppress false-negative error in templates and nvidia hook
``/proc`` might be mounted with ``hidepid=2``.
This makes ``/proc/1/…`` appear absent for non-root users.
When using the templates or the nvidia hook as a non-root user
(e.g., when creating unprivileged containers) the error
"/proc/1/uid_map: No such file or directory" is printed.
Since the script works correctly despite the error, this error
message might be confusing for users.

Signed-off-by: Lukas Pirl <git@lukas-pirl.de>
2019-07-22 14:39:23 +02:00
Rachid Koucha
a725bbc4b7
Make /tmp accessible to any user
/tmp created with "rwxrwxrwt" mode

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-06-05 13:04:11 +02:00
Rachid Koucha
5f0fb855f8
Option --busybox-path instead of --bbpath
As suggested during the review.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-05-10 21:28:35 +02:00
Rachid Koucha
e796239406
New --bbpath option and unecessary --rootfs checks
. Add the "--bbpath" option to pass an alternate busybox pathname instead of the one found from ${PATH}.
. Take this opportunity to add some formatting in the usage display
. As a try is done to pick rootfs from the config file and set it to ${path}/rootfs, it is unnecessary to make it mandatory

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-05-10 17:01:13 +02:00