Commit Graph

2580 Commits

Author SHA1 Message Date
Stéphane Graber
f371aca939 clang: Remaining changes
Those are a bit less obvious than those I pushed directly to master.
All those changes were required to build LXC under clang here.

With this, gcc can be replaced by clang to build LXC so long as you're
not using the python3 binding (as python extensions can't be built under
clang at the moment).

For reference, the clang output for those is: http://paste.ubuntu.com/6292460/

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-10-24 00:19:59 -04:00
Stéphane Graber
97c94afb57
Fix build failure on sparc
Signed-off-by: Thomas Nemeth <thomas.nemeth@laposte.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-23 22:04:52 -04:00
Serge Hallyn
7e6966e572 apparmor: cache the are-we-enabled decision
Since we check /sys/kernel/security/ files when deciding whether
apparmor is enabled, and that might not be mounted in the container,
we cannot re-make the decision at apparmor_process_label_set() time.
Luckily we don't have to - just cache the decision made at
lsm_apparmor_drv_init().

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-23 21:53:08 -04:00
Dwight Engen
33662399da oracle template: restrict writeability in /proc and /sys
Note that since we don't drop CAP_SYS_ADMIN, root in the container can
remount proc or sys however they want to, however this at least improves
the default situation.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-10-23 21:52:16 -04:00
Stéphane Graber
8f47bc3f31
clang: Fix some simple issues
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-23 21:42:42 -04:00
Stéphane Graber
aea1cd3cb7
lxc-debian: Add hwaddr handling logic
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-10-23 20:15:44 -04:00
KATOH Yasufumi
09b15218a4 doc: Update Japanese lxc-create(1) for default thin pool name
Update for commit 055af165ef

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-23 19:29:08 -04:00
KATOH Yasufumi
a1e4c206d5 template: Fix the container configuration issue in lxc-plamo
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-23 19:28:35 -04:00
KATOH Yasufumi
9d65a48729 Fix segfault on lxc-create when no template specified
When no template file is specified on lxc-create, recieve segfault.
So change not to append header in config when no template is specified.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-23 19:27:05 -04:00
Serge Hallyn
47b6e6cff0 bdev.c: don't free right before exit
Also log execlp error code if it returns.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-22 17:12:01 -05:00
Sidnei da Silva
72e99249b0 Pass through all options with -Bbest.
Remove the union in bdev_specs and store all options if -Bbest is passed. Fixes issue #31.

Signed-off-by: Sidnei da Silva <sidnei.da.silva@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-22 17:10:14 -05:00
Dwight Engen
3ffe454baf install lua module 0644 instead of 0755
Fixes rpmlint error "script-without-shebang". Checked other lua modules
and none are installed with execute permission.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-22 16:47:29 -04:00
Dwight Engen
0adde0f841 update rpm .spec file
The following changes were made to fix rpmlint warnings/errors
- use %global instead of %define
  http://fedoraproject.org/wiki/PackagingDrafts/global_preferred_over_define
- change Summary to match .deb
- update License
- do not mention the libcap dependency explicitly, rpm will fill it in
- fix Summary, Description for libs and devel packages
- pass -q to %setup
- add %post for libs to run ldconfig
- explicitly name lxc man paths so pkg doesn't "own" /usr/share/man
- mark /etc/lxc/default.conf as a config file

In addition, while I was here:
- split lua bits into seperate lxc-lua package
- change Description to match .deb
- remove "Version" in changelog entries to follow
  http://fedoraproject.org/wiki/Packaging:Guidelines#Changelogs

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-22 16:47:25 -04:00
Serge Hallyn
7a409fd516 lxc-busybox: don't copy temp mounts into mtab
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-22 11:52:14 -05:00
Natanael Copa
6bd3f98c46 lxc-alpine: allow /dev/full
The template creates /dev/full for the container but needs also give
permission to access it.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-22 11:26:45 -05:00
Serge Hallyn
69733b5dd2 get rid of '${lxcpath}_anon' idea
The idea was simply misguided.

If you provide a custom configuration file, you still should be
putting the command sock into the real lxcpath, not an 'anon' one.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-21 19:05:36 -05:00
tenforward
76d376ece9 doc: Update Japanese lxc-create(1) for --thinpool option
Update for commit 62c70ee2c1

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-21 17:54:26 -05:00
Sidnei da Silva
8aba14bbc8 Fallback lvs comparison to false.
If lvs invocation fails or doesn't return any output, then lv flags comparison to false.

Signed-off-by: Sidnei da Silva <sidnei.da.silva@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-21 17:35:33 -05:00
Sidnei da Silva
34e135b238 Store fssize and fstype in the right struct.
When using the -Bloop option, fstype and fssize arguments were copied
into the lvm struct of bdev specs instead of the loop struct.

Signed-off-by: Sidnei da Silva <sidnei.da.silva@canonical.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-21 16:37:40 -05:00
Sidnei da Silva
055af165ef Assume a default thin pool named 'lxc'.
Will fallback to no thinpool if not present or if thin pool provided on the command line does not exist.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-21 16:12:19 -05:00
Stéphane Graber
07520b2af5
Update maintainers and URLs
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-20 00:48:48 -04:00
Stéphane Graber
36b33520f6
Fix typos identified by lintian
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-20 00:34:07 -04:00
S.Çağlar Onur
bc605ac6dd Fix following compile error on ubuntu 12.10
[...]
make[3]: Entering directory `/home/caglar/Projects/lxc/src/tests'
depbase=`echo attach.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
        gcc -DHAVE_CONFIG_H -I. -I../../src    -I../../src -DLXCROOTFSMOUNT=\"/usr/lib/x86_64-linux-gnu/lxc/rootfs\" -DLXCPATH=\"/var/lib/lxc\" -DLXC_GLOBAL_CONF=\"/etc/lxc/lxc.conf\" -DLXCINITDIR=\"/usr/libexec\" -DLXC_DEFAULT_CONFIG=\"/etc/lxc/default.conf\"   -g -O2 -Wall -Werror -MT attach.o -MD -MP -MF $depbase.Tpo -c -o attach.o attach.c &&\
        mv -f $depbase.Tpo $depbase.Po
attach.c: In function ‘main’:
attach.c:380:2: error: implicit declaration of function ‘test_lsm_detect’ [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make[3]: *** [attach.o] Error 1
[...]

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-19 09:53:09 -05:00
S.Çağlar Onur
58b61f6d34 use snapshot_destroy in tests/snapshot.c and clean up containers after the test run
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-19 09:50:09 -05:00
S.Çağlar Onur
771d96b380 introduce snapshot_destroy
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-19 09:49:19 -05:00
S.Çağlar Onur
93ea85c71b call lxc_container_put when needed in lxc_destroy.c
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-19 09:49:14 -05:00
Stéphane Graber
8b54fb4de8
change version to 1.0.0.alpha2 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 18:11:53 -04:00
Stéphane Graber
0f8f9c8aa4
lxccontainer.c: Replace rindex by strrchr (bionic)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 18:00:24 -04:00
Stéphane Graber
6c1b2b1db9
lsm.h: Fix inline definition
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 17:59:43 -04:00
Sidnei da Silva
55a204f9f4 Allocate cmd string with alloca instead of malloc, close popen handle if fgets fails. 2013-10-18 14:43:03 -05:00
Sidnei da Silva
62c70ee2c1 Document the new --thinpool option 2013-10-18 14:43:03 -05:00
Sidnei da Silva
f99c386b60 Add a --thinpool argument to lxc-create, to use thin pool backed lvm when creating the container. When cloning a container backed by a thin pool, the clone will default to the same thin pool. 2013-10-18 14:43:03 -05:00
Dwight Engen
e0b6898ab4 use proper config item depending on which lsm is enabled
On a system with AppArmor enabled, if lxc.se_context is configured but
lxc.aa_profile is not (because the user just wants to use the default
AppArmor profile) lxc was passing the lxc.se_context to be set as the
new AppArmor profile. Determine which configuration item to use based
on which lsm is enabled.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-18 13:57:43 -05:00
Dwight Engen
72863294f6 support setting lsm label at exec or immediately
- Add attach test cases

- Moved setting of LSM label later to avoid failure of IPC between parent
  and child during attach

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-18 13:57:37 -05:00
Dwight Engen
41ca89087a add lsm op for getting name of enabled lsm
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-18 13:57:33 -05:00
Natanael Copa
3d460a3856 lxc-alpine: enable loopback interface by default
It was probably disabled by a mistake

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 14:42:46 -04:00
Stéphane Graber
01dae5c455 lxc-start-ephemeral: Fix broken mount logic
This reworks the mount logic for lxc-start-ephemeral to be as follow:
 - Any real (non-bind) entry gets copied to the target fstab
 - Any bind-mount from a virtual fs gets copied to the target fstab
 - Any remaining bind-mount if confirmed to be valid gets setup as an
   overlay.

Extra bind-mounts passed through the -b option are mounted by the
pre-mount script and don't need processing by the fstab generator.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-18 13:33:26 -05:00
Serge Hallyn
3ca91fb6f4 lxc-test-ubuntu: also allow the standard non-nested apparmor policy
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 11:27:48 -05:00
Serge Hallyn
8daccdb4d0 parse.c: don't print error message on callback rv > 0
A callback return value < 0 means there was an error, so print
out an error message.  But a rv > 0 is used by the mount_unknown_fs
functions to say "we found the one we want, stop here."

Document this, and only print an error message if rv < 0.  Otherwise,

	lxc-create -B lvm --fstype ext3 -t ubuntu -n u1

will print an (innocuous) error message about being unable to parse
the config value 'ext3'.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 11:27:42 -05:00
Alexander Khryukin
6e7e54d902 Change configure, replacing mandriva by openmandriva
The latest Mandriva distro release was in 2011 and nowadays distro named
OpenMandriva Lx.

Signed-off-by: Alexander Khryukin <alexander@mezon.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-18 12:25:45 -04:00
Laurent Vallar
09da66e667 lxc-debian: Remove perl, use sed instead
Signed-off-by: Laurent Vallar <val@zbla.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-17 16:44:33 -04:00
Laurent Vallar
90ccc878de lxc-debian: Force locales generation
Signed-off-by: Laurent Vallar <val@zbla.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-17 16:44:20 -04:00
Dmitry Yu Okunev
157aa271b5 lxc-attach: fixed typo: privleges -> privileges
Signed-off-by: Dmitry Yu Okunev <dyokunev@ut.mephi.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-17 16:40:54 -04:00
Dwight Engen
9e4bf8b12a add lsm op for checking if an lsm is present/enabled
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-17 10:18:52 -05:00
Dwight Engen
fefddf9f9f fix busybox template for use with AppArmor
Ensure /proc and /sys are mounted in the container, otherwise
apparmor_enabled() will fail to find
/sys/module/apparmor/parameters/enabled

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-17 10:18:51 -05:00
Dwight Engen
c944b920f4 oracle template: fix selinux context on symlinks in /dev
This fixes sshd getting an avc on traversing the /dev/ptmx symlink
(was default_t)

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-17 10:18:06 -05:00
Stéphane Graber
67e5a20ad1 Improper pty permissions - missing mode=0620, gid=5
This fix is coming from Debian bug:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720122

The reason for the hardcoded gid= and mode= is because of the fix for
CVE-2013-2207 which removes pt_chown from glibc and so requires proper
write access to devpts.

It looks like the "tty" group is guaranteed to be gid=5 on at least all
RedHat based and Debian based systems. So this hardcode gid shouldn't be
a big problem. If we however support any distro where that's not the
case, we'll need to implement an extra lxc.conf option and matching
template changes.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-16 11:47:14 -05:00
Dwight Engen
c414be2526 add more detail in automount error message
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-16 11:45:40 -05:00
Stéphane Graber
f10e04e361 Make 'make dist' match git content
This fixes a few obvious issues when comparing the make dist output with
the git tree.

 - Make all templates non-executable in git
 - Remove unused files:
   - src/lxc/list.c (empty, only includes the list.h header)
   - src/lxc/lxc-destroy.in (replace by lxc_destroy.c)
 - Add missing files to dist tarball:
   - src/python-lxc/examples/pyconsole.py
   - src/python-lxc/examples/pyconsole-vte.py
 - Mark all the python API tests executable
 - Mark lxc-test-ubuntu executable

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-16 11:41:24 -05:00
Laurent Vallar
1927a6be97 lxc-debian: Add --arch option
Signed-off-by: Laurent Vallar <val@zbla.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-15 10:47:33 -04:00