Commit Graph

2110 Commits

Author SHA1 Message Date
Serge Hallyn
9baa57bdd4 coverity: closedir on error path
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-07 14:03:20 -05:00
Dwight Engen
dab75acca0 always include the ja manpage sources in make dist
These need to be in the dist tarball even if the host packaging system
doesn't have docbook2x, otherwise configure will fail to find them. Also,
the build system may have docbook2x, even if the packaging system does not.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 15:04:50 -05:00
Dwight Engen
3157e67395 fix errors when using docbook2man
docbook2man picks up some errors that docbook2x does not, fixing them
isn't harmful to docbook2x. The only real change is adding <para> and
<citerefentry> tags.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 15:04:48 -05:00
Dwight Engen
5e00ff016a oracle template: add openssh-clients to enable scp in/out of container
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 14:54:58 -05:00
Michael H. Warfield
6766033125 templates/lxc-fedora Network startup w/o Network Manager
This patches the Fedora template to insure that the legacy network
startup scripts are enabled when NetworkManager has not been installed
in the container (default).

It also fixes a login problem with pam_loginuid.so in a container.
https://bugzilla.redhat.com/show_bug.cgi?id=966807

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>

--
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 14:54:56 -05:00
Serge Hallyn
0655a606da trivial: remove trailing whitespce from lxc-fedora
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 14:54:54 -05:00
Serge Hallyn
fe5c5ea693 lxc-fedora: remove 4:0 and 4:1 from devices whitelist
They are the real /dev/tty{0,1}, which are physical consoles.  Lxc
bind-mounts over them.  Don't let the container use these!

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 10:53:21 -05:00
S.Çağlar Onur
f3e52710c2 call lxc_container_put when appropriate
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 08:45:26 -05:00
Stéphane Graber
2ef89d565c lxc-ubuntu: Remove trim option
Container trimming is a bad idea in general, Ubuntu since 12.04 allows
standard systems to run in containers and we've got separate code to
deal with 10.04, so let's just drop trim.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-04 08:45:25 -05:00
Michael H. Warfield
449989ac38 templates/lxc-fedora Rework for distro independence.
This patch reworks the Fedora template to operate in the most "distro
agnostic" manner possible.  It should even run on distros where rpm and
yum are not present and not available or may be incompatible.  It
depends on the most basic set of system facilities like rsync but does
require squashfs support also be available to mount a LiveOS runtime.

Based on comments at Linux Plumbers, what I had been referring to as a
"run time environment" or RTE has been renamed in the code to refer to
it as a "bootstrap".  It has been tested on Fedora (of course),
OpenSuse, Ubuntu, and Oracle (latest host versions of each) building
Fedora containers of F19 back through F9.  Varying levels of database
problems were encountered from F11 and back and are "will not fix" due
to versions being long EOL.  F15 and F16 build but do not run "out of
the box" due to systemd version issues and those are also "will not fix"
for the same reasons.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-03 21:03:20 -05:00
Serge Hallyn
025f59ab98 add basic lxc-test-ubuntu (v3)
Some features of lxc - networking and LSM configuration for instance -
are generally configured by the distro packages.  This program
tests the Ubuntu configuration.

changelog v2:
  Switch to lxc-info -i to detect ip address as stgraber suggested
  Don't look for 'expect' as I'm not using it yet.
changelog v3:
  Make sure to only read one ip address from container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-03 12:23:07 -05:00
Serge Hallyn
a5a8250854 confile.c: cast size_t to prevent compile failure on 386
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-03 12:10:07 -05:00
Stéphane Graber
f5abd74d1a Improve behaviour for unprivileged users
This mostly changes two things:
 - Only log to the container's logfile on start/stop/restart/execute
 - Call may_control() every time we use the API and return
   "Insufficient privileges" on failure.

NOTE: I didn't test every single one of those but I'm fairly confident
      in my copy/paste abilities and I confirmed they all build fine at least.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-03 09:34:55 -05:00
Serge Hallyn
17232fefae add new tests to .gitignore
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-03 09:34:54 -05:00
Serge Hallyn
2aa123185e add reboot test
It's really more of a kernel check, but worth having.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-03 09:34:52 -05:00
Stéphane Graber
8111adfde0
lxc-checkconfig: suggest modprobe configs
give hint to user to modprobe configs (altho could just modprobe it?)

Signed-off-by: Elan Ruusamäe <glen@delfi.ee>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 17:22:52 -04:00
Stéphane Graber
51e7a87468
Check return value of ifa_get_local_ip
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-02 17:18:48 -04:00
Stéphane Graber
c61eaadcf8
lxc-fedora: Show usage when no name is passed
Reported-by: Anatoly Techtonik
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 13:11:24 -04:00
Stéphane Graber
a8aa709c9d
lxc_init: Use sig_atomic_t for was_interrupted
Suggested-by: Markus Elfring
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 12:32:52 -04:00
Andrey Mazo
01660cccb9 Avoid ldconfig due to cross-compilation problems.
Otherwise, it cases problems on cbuild endianness != ctarget endianness
setups because /sbin/ldconfig expects elf header in the wrong endianness.

Signed-off-by: Andrey Mazo <ahippo@yandex.ru>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 12:28:33 -04:00
Dwight Engen
bd79cb223d fix lxc-info segv on stopped container
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 12:21:31 -04:00
Stéphane Graber
8983aa6e1e
fedora: Use consistent tab/space indent
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 11:47:33 -04:00
Renich Bon Ciric
431fdc4272 Update lxc-fedora.in
Fedora 19's release has no -1 revision; it's a -2 revision actually:
ftp://mirrors.kernel.org/fedora/releases/19/Fedora/x86_64/os/Packages/f/

Signed-off-by: Renich Bon Ciric <renich@woralelandia.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 11:45:52 -04:00
KATOH Yasufumi
99282c429a doc: Fix some typos
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 11:43:55 -04:00
KATOH Yasufumi
cab158ed3c doc: Remove unnecessary Diagnostic entry in lxc-stop(1)
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-10-02 11:43:43 -04:00
KATOH Yasufumi
996c63c73e doc: Update lxc-monitor(1) man page
- Update to commit 'fbf050e4c211030eb343008583f76605dfaaef38'
- Improve translation

Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-10-02 09:09:45 -05:00
Dwight Engen
fbf050e4c2 lxc-monitor default name to .* to monitor all containers
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-01 10:31:41 -05:00
Dwight Engen
291c42dac0 gitignore doc/ja/legacy/*.1
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-10-01 09:21:31 -05:00
KATOH Yasufumi
492d0d55c3 doc: Update Japanese lxc.conf(5) man page
Add description of automatic mounting options
2013-09-30 19:22:07 -05:00
KATOH Yasufumi
3fd391243e doc: Update Japanese lxc-info(1) man page
Add description of '-i' option
2013-09-30 19:22:07 -05:00
KATOH Yasufumi
a5ba96715d doc: Update Japanese man pages translation
* sync current English man pages on master branch
* delete lxc-shutdown.sgml.in
* add lxc-snapshot.sgml.in
* update FSF address (same as 250b1eec71)
* remove trailing whitespaces in legacy/lxc-ls.sgml.in (same as 8900b9eb25)
2013-09-30 19:22:07 -05:00
Dwight Engen
6d03d92ab7 refactor string conf items into common function
- When doing the selinux change, I noticed that there was a lot of
  duplication of code in handing string configuration items, so I
  refactored this into a common function.

- Added a config_string_max that can be passed a maximum acceptable
  length, used to limit ttydir to NAME_MAX.

- The behavior of config_seccomp was different than other strings: if the
  item was already defined, then the second attempt to set it would fail
  instead of just replacing the value. Changed to just replace the value.

- Remove unused key and lxc_conf arguments to config_path_item().

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-09-30 17:21:11 -05:00
Serge Hallyn
e59536145c RFC: lxclock: drop the chown+chmod of lockdir
The original rationale for this was to make sure that if
lxcpath was /home/serge/lxcbase, then then lockdir
(/run/user/serge/lock/lxc/home/serge/lxcbase) would be
owned by the same user as /home/serge/lxcbase.

The only user who can chown to other uids (without CAP_CHOWN
added to fP) is root, who shouldn't be mucking with non-root
owned containers anyway.  In the meantime this causes a bunch
of noise for arguably no benefit.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-30 16:23:34 -05:00
Serge Hallyn
243cae25b5 tests/getkeys: return 0 on success
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-30 15:53:11 -05:00
Serge Hallyn
b494d2ddf7 add c->may_control
This is an api function which will return false if the container
is running, and the caller may not talk to its monitor over its
command socket.  Otherwise - if the container is not running, or
the caller may access it - it returns true.

We can use this in several tools early on to prevent the segvs
etc which we currently get.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-30 13:21:52 -05:00
Stéphane Graber
fe218ca383
Fix crasher in get_ips
Check that the interface structure is not NULL before trying to access
its members.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-29 19:41:52 -04:00
Stéphane Graber
a24b871206
Fix typo
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-09-27 16:00:40 -04:00
Dwight Engen
8bfcb981de valgrind: fix small leak in cgroup
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-27 12:09:18 -05:00
Christian Seiler
a2ff31c710 Automatic mounting: document options in lxc.conf(5) manpage
Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-27 10:14:14 -05:00
Christian Seiler
7997d7da4d Automatic mounting: add more ways to mount the cgroup filesystem
This adds quite a few more ways to mount the cgroup filesystem
automatically:

 - Specify ro/rw/mixed:
       - ro: everything mounted read-only
       - rw: everything mounted read-write
       - mixed: only container's own cgroup is rw, rest ro
                (default)
 - Add cgroup-full that mounts the entire cgroup tree to the
   corresponding directories. ro/rw/mixed also apply here.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-27 10:14:14 -05:00
Christian Seiler
5f62730e91 Automatic mounting: write lxc.mount.auto in write_config
Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-27 10:14:14 -05:00
Christian Seiler
b06b851168 Automatic mounts: improvements for /proc and /sys
Improve lxc.mount.auto code: allow the user to specify whether to mount
certain things read-only or read-write. Also make the code much more
easily extensible for the future.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-27 10:14:14 -05:00
Stéphane Graber
211e51e81e
lxc-info: Allow printing IP addresses
This adds a new -i flag to lxc-info to print the container's IP
addresses using get_ips().

Example:
$ lxc-info -n lxc-dev -s -p -i
state:  RUNNING
pid:    21331
ip:     10.0.3.165
ip:     2607:f2c0:f00f:2751:e9ca:842f:efa9:97d1
ip:     2607:f2c0:f00f:2751:216:3eff:fe3a:f1c1

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-09-27 09:31:17 -04:00
Stéphane Graber
a9ac16e2cc
lxc-info: Port to LXC API
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-09-27 09:30:52 -04:00
Serge Hallyn
566981770e drop now-useless have_tpath bool
(Which will also break failure-to-build in the !HAVE_LIBGNUTLS
case)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-26 08:14:50 -05:00
Dwight Engen
85db5535c3 fix segfault on lxc-create with bad template name
- change get_template_path() to only return NULL or non-NULL since one of
  the callers was doing a free(-1) which caused the segfault. Handle the
  NULL template case in the lxcapi_create() caller.

- make sure to free(tpath) in the sha1sum_file() failure case

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-09-26 08:11:59 -05:00
Dwight Engen
fe4de9a66d refactor AppArmor into LSM backend, add SELinux support
Currently, a maximum of one LSM within LXC will be initialized and
used. If in the future stacked LSMs become a reality, we can support it
without changing the configuration syntax and add support for more than
a single LSM at a time to the lsm code.

Generic LXC code should note that lsm_process_label_set() will take
effect "now" for AppArmor, and upon exec() for SELinux.

- fix Oracle template mounting of proc and sysfs, needed when using SELinux

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-25 17:12:36 -05:00
Serge Hallyn
3a0abb3aa2 free kernel_subsystems in success case
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-25 15:23:49 -05:00
Serge Hallyn
0ccf7c2a63 REALLY always free(line)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-25 15:05:52 -05:00
Serge Hallyn
2cdafc545c fix up a few snafu's in forward-port of last commit
Make sure to free line.

Don't free 'info' when freeing base_info will later free info.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2013-09-25 15:01:54 -05:00