Commit Graph

5070 Commits

Author SHA1 Message Date
Tycho Andersen
be69ad435d util: always malloc for setproctitle
Closes #1407

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
2017-02-02 08:42:22 +00:00
Christian Brauner
4ce84082f0 Merge pull request #1402 from mabes/patch-1
lxc-opensuse: fix default value for release code
2017-01-30 14:52:36 +01:00
Maxime Besson
04e30e9de7 lxc-opensuse: fix default value for release code
Signed-off-by: Maxime Besson <maxime.besson@smile.fr>
2017-01-30 13:35:09 +01:00
Geaaru
74e7574120 [lxc-sabayon] Add common scripts for daily image generation.
Signed-off-by: Geaaru <geaaru@gmail.com>
2017-01-29 19:03:55 +01:00
Christian Brauner
d54d9610a0 Merge pull request #1400 from bneumeier/master
Allow build without sys/capability.h
2017-01-29 17:23:47 +01:00
Brett Neumeier
df11e022a5 Allow build without sys/capability.h
There is no guard clause around a reference to CAP_EFFECTIVE and
CAP_SETGID, causing compilation to fail if sys/capability.h is not
available.

Signed-off-by: Brett Neumeier <brett@neumeier.us>
2017-01-29 09:41:20 -06:00
Geaaru
11f88f10cd Add LXC template script of Sabayon OS
Signed-off-by: Geaaru <geaaru@gmail.com>
2017-01-28 23:22:47 +01:00
Christian Brauner
9eed569a22 Merge pull request #1397 from stgraber/master
Fix typo
2017-01-27 23:49:49 +01:00
Stéphane Graber
073000e2dc Fix typo
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2017-01-27 17:40:11 -05:00
Stéphane Graber
42dc0de4e3 Merge pull request #1392 from cjwatson/start-ephemeral-python32
Make lxc-start-ephemeral Python 3.2-compatible
2017-01-26 11:45:20 -05:00
Colin Watson
e0e34b7e93 Make lxc-start-ephemeral Python 3.2-compatible
On Ubuntu 12.04 LTS with Python 3.2, `lxc-start-ephemeral` breaks as
follows:

    Traceback (most recent call last):
      File "/usr/bin/lxc-start-ephemeral", line 371, in attach_as_user
      File "/usr/lib/python3.2/subprocess.py", line 515, in check_output
      File "/usr/lib/python3.2/subprocess.py", line 732, in __init__
    LookupError: unknown encoding: ANSI_X3.4-1968

This is because `universal_newlines=True` causes `subprocess` to use
`io.TextIOWrapper`, and in versions of Python earlier than 3.3 that
fetched the preferred encoding using `locale.getpreferredencoding()`
rather than `locale.getpreferredencoding(False)`, thereby changing the
locale and causing codecs to be reloaded.  However, `attach_as_user`
runs inside the container and thus can't rely on having access to the
same Python standard library on disk.

The workaround is to decode by hand instead, avoiding the temporary
change of locale.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
2017-01-26 14:32:08 +00:00
Christian Brauner
4893a4315c Merge pull request #1388 from trofi/master
Use AC_HEADER_MAJOR to detect major()/minor()/makedev()
2017-01-21 13:41:36 +01:00
Sergei Trofimovich
af6824fce9 Use AC_HEADER_MAJOR to detect major()/minor()/makedev()
Before the change build failed on Gentoo as:

  bdev/lxclvm.c: In function 'lvm_detect':
  bdev/lxclvm.c:140:4: error: implicit declaration of function 'major' [-Werror=implicit-function-declaration]
    major(statbuf.st_rdev), minor(statbuf.st_rdev));
    ^~~~~
  bdev/lxclvm.c:140:28: error: implicit declaration of function 'minor' [-Werror=implicit-function-declaration]
    major(statbuf.st_rdev), minor(statbuf.st_rdev));
                            ^~~~~

glibc plans to remove <sys/sysmacros.h> from glibc's <sys/types.h>:
    https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html

Gentoo already applied glibc patch to experimental glibc-2.24
to start preparingfor the change.

Autoconf has AC_HEADER_MAJOR to find out which header defines
reqiured macros:
    https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html

This change should also increase portability across other libcs.

Bug: https://bugs.gentoo.org/604360
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2017-01-21 11:57:13 +00:00
Christian Brauner
b7329cebaf Merge pull request #1382 from evgeni/lsb-cgroupfs-mount
add cgroupfs-mount to Should-Start/Stop sysvinit LSB headers
2017-01-12 15:38:27 +01:00
Evgeni Golov
2704c1ccdd add cgroupfs-mount to Should-Start/Stop sysvinit LSB headers
otherwise init might try to start the containers before cgroupfs was
mounted.

Debian-Bug: https://bugs.debian.org/850212

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2017-01-12 12:51:55 +01:00
Serge Hallyn
3728ed350c Merge pull request #1381 from brauner/2017-01-11/fix_volatile_containers
tools/lxc-start: remove c->is_defined(c) check
2017-01-11 10:05:32 -06:00
Christian Brauner
72c78e0e1c
tools/lxc-start: remove c->is_defined(c) check
We do not check here whether the container is defined, because we support
volatile containers. Which means the container does not need to be created for
it to be started. You can just pass a configuration file as argument and start
the container right away.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-11 16:20:20 +01:00
Serge Hallyn
e3cca06889 Merge pull request #1373 from brauner/2016-01-02/fix_execute_and_improve_setgroups
start: fix execute and improve setgroups() calls
2017-01-07 10:33:57 -06:00
Christian Brauner
87bf0db03d
start: check for CAP_SETGID before setgroups()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-07 12:50:26 +01:00
Christian Brauner
ca364dc0dd
caps: add lxc_cap_is_set()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-07 12:40:37 +01:00
Christian Brauner
d08f8d2f74
start: fix execute and improve setgroups() calls
lxc_execute() and lxc-execute where broken when a user tried to switch to a
non-root uid/gid. This prevented necessary setup operations like mounting the
rootfs which require root in the user namespace. This commit separates
switching to root in the user namespace from switching to the requested uid/gid
by lxc_execute().
This should be safe: Once we switched to root in the user namespace via
setuid() and then switch to a non-root uid/gid in the user namespace for
lxc_execute() via setuid() we cannot regain root privileges again. So we can
only make us safer (Unless I forget about some very intricate user namespace
nonsense; which is not as unlikely as I try to make it sound.).

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-07 11:18:22 +01:00
Christian Brauner
dbaf55a353
utils: add uid, gid, group convenience wrappers
This commit adds lxc_switch_uid_gid() which allows to switch the uid and gid of
a process via setuid() and setgid() and lxc_setgroups() which allows to set
groups via setgroups(). The main advantage is that they nicely log the switches
they perform.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-07 11:18:19 +01:00
Reto Gantenbein
91a5f34612 Restrict package locales to en_US
Adjust locale setup to official Fedora cloud setup. This will
shrink the image size for e.g. Fedora 25 from around 350MB to
260MB.

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2017-01-07 02:51:27 +01:00
Reto Gantenbein
f919f5ca11 Fix chroot rpmdb path
Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2017-01-07 02:47:26 +01:00
Reto Gantenbein
c172e264de Fix installing multiple packages given with '--packages'
Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2017-01-07 02:47:22 +01:00
Reto Gantenbein
7b40d7287e Fix version comparison
Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2017-01-07 02:47:16 +01:00
Stéphane Graber
4484e6f80c Merge pull request #1379 from brauner/2017-01-04/fix_android
tools: only check for O_RDONLY
2017-01-04 17:30:09 +01:00
Stéphane Graber
4d690b8c5c Merge pull request #1376 from brauner/2017-01-04/sic_semper_assertis
tree-wide: Sic semper assertis!
2017-01-04 16:40:31 +01:00
Christian Brauner
371802081a
tools: only check for O_RDONLY
On some Android systems the lxc folders where containers are stored might be
read-only and so checking for O_RDWR, will effectively make the tools useless
on these systems, so let's dumb the check down to O_RDONLY.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-04 16:28:50 +01:00
Christian Brauner
97bc24229c
tree-wide: Sic semper assertis!
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-04 15:19:46 +01:00
Christian Brauner
c9ee396595 Merge pull request #1378 from Cypresslin/fix-api-test-s390x
python3-lxc: fix api_test.py on s390x
2017-01-04 13:33:52 +01:00
Po-Hsu Lin
e170106812 python3-lxc: fix api_test.py on s390x
The api_test.py script uses Trusty release by default, which does not
have s390x image. Switch to Xenial to solve this.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
2017-01-04 19:23:04 +08:00
Stéphane Graber
f290a8061f Merge pull request #1374 from brauner/2017-01-03/fix_suggest_default_idmap
conf: fix suggest_default_idmap()
2017-01-03 18:22:47 +01:00
Christian Brauner
b7930180d1
conf: fix suggest_default_idmap()
We need to remove the newline otherwise lxc_safe_uint() will fail as it detects
an invalid (non-numeric) char in the string.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-01-03 11:08:25 +01:00
Reto Gantenbein
df3e3fa11a Explicitly mount squashfs in case autodetection fails
Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2017-01-02 17:16:00 +01:00
Reto Gantenbein
60fd46237e Also add lxc-fedora-legacy to AC_CONFIG_FILES
Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2017-01-01 18:54:29 +01:00
Reto Gantenbein
3d7aa7887a Complete rework of lxc-fedora template
Heavily refactored version of the Fedora container creation template.
Removed compatibility to unsupported Fedora releases including sysvinit
and yum stuff. Added new commandline arguments found in other templates:

  --mirror   : To set custom HTTP(s) Fedora download mirror
  --packages : List of custom packages to install into a new container
  --debug    : Run with shell script with 'set -x'

There are also some new environment variables which can be used to
customize the template behaviour. See --help output.

Supports Fedora >=24. By default Fedora 25 will be installed except on
Fedora hosts, where the host release is taken. To simplify the code
path (or at least not make it more complex) all non-Fedora hosts will
now use the LiveOS-image based bootstrap environment even when they
would natively support rpm, yum or even dnf (e.g. Gentoo, CentOS).

Mainly runs systemd services by default (journald, networkd, resolved
logind).

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2016-12-31 02:26:15 +01:00
Reto Gantenbein
edef9b0e08 Rename fedora template to fedora-legacy
Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
2016-12-31 02:25:35 +01:00
Stéphane Graber
a87e4d015e Merge pull request #1365 from brauner/2016-12-25/skip_test_on_broken_overlayfs_symlinks
tests: skip unpriv tests on broken overlay module
2016-12-29 09:09:39 -05:00
Christian Brauner
90e4eead72
tests: skip unpriv tests on broken overlay module
This mainly affects Trusty. The 3.13 kernel has a broken overlay module which
does not handle symlinks correctly. This is a problem for containers that use
an overlay based rootfs since safe_mount() uses /proc/<pid>/fd/<fd-number> in
its calls to mount().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2016-12-28 16:43:55 +01:00
Christian Brauner
64fa248372 Merge pull request #1360 from ffontaine/master
Add --enable-gnutls option
2016-12-19 09:07:55 +01:00
Fabrice Fontaine
c8601571aa Add --enable-gnutls option
Previously HAVE_LIBGNUTLS was never set in config.h even if gnutls was
detected as AC_CHECK_LIB default action-if-found was overriden by
enable_gnutls=yes
This patch adds an --enable-gnutls option and will call AC_CHECK_LIB
with the default action to write HAVE_LIBGNUTLS in config.h

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
2016-12-18 21:42:07 +01:00
Serge Hallyn
8b7ffa302d Merge pull request #1343 from lifupan/master
confile: support the network link string pattern matching
2016-12-16 12:46:32 -06:00
Christian Brauner
7d091d9e96 Merge pull request #1358 from evgeni/no-default-passwords
do not set insecure passwords
2016-12-16 00:16:34 +01:00
Christian Brauner
555fc01aa7 Merge pull request #1357 from evgeni/opensuse-systemd-fixes
OpenSUSE systemd fixes
2016-12-16 00:15:47 +01:00
Evgeni Golov
37fbf44812 do not set insecure passwords
Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-12-15 20:04:15 +01:00
Evgeni Golov
62386d9319 lxc-opensuse: rm poweroff.target -> sigpwr.target copy
Given commit 330ae3d350:

    lxccontainer: detect if we should send SIGRTMIN+3

    This is required by systemd to cleanly shutdown. Other init systems should not
    have SIGRTMIN+3 in the blocked signals set.

we should stop poking around with sigpwr.target for systemd.

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-12-15 20:02:10 +01:00
Evgeni Golov
000f7f1c56 don't try to get stuff from /usr/lib/systemd on the host
it might not even be there…

Signed-off-by: Evgeni Golov <evgeni@debian.org>
2016-12-15 19:59:13 +01:00
fli
576400e5e0 confile: support the network link string pattern matching
Enable lxc network config support the following type and link:

lxc.network.type = phys
lxc.network.link = eth+

Here, the suffix '+' will trigger a string pattern matching
and when lxc find any network interfaces name prefixed with
"eth" such as "eth0", "eth1", "ethxxxx" and so on, it will
try to move them into the container's namespace; If it didn't
find any matching, it would do nothing for this configure
line.

Signed-off-by: fli <fupan.li@windriver.com>
2016-12-12 18:11:13 -08:00
Christian Brauner
154a741200 Merge pull request #1354 from tsdmgz/leap-422-template
templates: update openSUSE release to 42.2
2016-12-13 00:11:27 +01:00