Commit Graph

2483 Commits

Author SHA1 Message Date
Stéphane Graber
ceceea1e96 Disable logpath for unprivileged containers
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 14:35:29 -05:00
Stéphane Graber
0ce2946360 oracle: Fix running template unprivileged
Without this /dev/console won't exist and upstart will fail to start any
job marking as "console output" including the rather important rcS.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 13:34:08 -05:00
Dwight Engen
563476727b oracle template: default to 6.5 when no release given or detected
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 12:29:55 -05:00
Dwight Engen
91bcb2dd78 oracle template: don't sed /etc/init/tty.conf on older releases
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 12:29:19 -05:00
Dwight Engen
9e69977fa6 oracle template: convert to common.conf style
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 12:28:55 -05:00
Serge Hallyn
04a243f11d lxc.conf: note the 'lxc.network.type = none' option
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 12:20:50 -05:00
KATOH Yasufumi
8adef7614d plamo: Update template to use wget when download packages
Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 12:20:46 -05:00
Chris Glass
959dd8f250 Fix small mistake with squid-deb-proxy hook
I unfortunately realized that I did not push the latest version of the
file. This fixes an issue in the case where we want to create the proxy
file in the container (not nested).

Signed-off-by: Chris Glass <tribaal@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:41:16 -05:00
Qiang Huang
574c4428e9 cgroup.c: add static keywords as they declared
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:39:28 -05:00
Qiang Huang
e8fe3808d0 cgroup.h: unify the nameing and comments
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:39:24 -05:00
Qiang Huang
28bb9321e2 cgroup.c: redefine the valid cgroup name
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:39:21 -05:00
Stéphane Graber
b408e70daf
Trailing whitespace
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:33:04 -05:00
Dwight Engen
a3da3d8296 install only lxc-user-nic setuid
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:06:16 -05:00
KATOH Yasufumi
fcdb97df5d doc: Update Japanese lxc.conf(5)
Update for commit df2d420507

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:06:10 -05:00
Chris Glass
f4e8a91861 Added a commented squid-deb-proxy hook to ubuntu
Added a commented squid-deb-proxy hook to the common ubuntu config file
as suggested when merging the squid-deb-proxy-client hook.

Signed-off-by: Chris Glass <tribaal@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-15 10:06:04 -05:00
Stéphane Graber
41670b35b0 lxc-download: Fix undefined DOWNLOAD_FORCE_CACHE
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 10:05:46 -05:00
Stéphane Graber
c1becef2d2 lxc-download: Fix wrong option parsing
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 10:05:40 -05:00
Stéphane Graber
0d656b0549 lxc-download: POSIX doesn't specify -f for chown
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 10:05:19 -05:00
Stéphane Graber
07219a02df ubuntu: Fix path to openssh-server's postinst
The path isn't relative to @LOCALSTATEDIR@

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 10:04:40 -05:00
Stéphane Graber
ce68d5b481 debian: Support ssh host keys regeneration
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 10:04:30 -05:00
Stéphane Graber
040f1c4008 Always try to create lxcpath
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-15 10:04:04 -05:00
Qiang Huang
b022744452 lxccontainer.c: check lxc_conf before referance haltsignal
If we start container with rcfile(see comments in lxc_start.c), it
is possible that we have no config file in /usr/local/var/lib/lxc.
So when we try lxc_stop, lxc_container_new will not load any config
so we'll get c->lxc_conf = NULL.

In that case, we'll get Segmentation fault in lxcapi_shutdown, a
simple check would fix this.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 21:52:44 -05:00
Stéphane Graber
3139aead4d Fix return value of userns_exec_1
Instead of always returning -1 and call SYSERROR when the child returns
non-zero. Have userns_exec_1 always return the return value from the
function it's calling and let the caller do the error handling (as is
already done by its only caller).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-14 18:35:43 -05:00
Stéphane Graber
275a2d0bca
tests: Fix startone's call to want_daemonize
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 17:35:14 -05:00
Stéphane Graber
b335cf8d4b lxc-archlinux: Cleanup fstab
It's been brought to my attention that the read-only mount of /proc/sys
is causing problems to archlinux users, so instead just have LXC mount
proc and sysfs normally (read-write).

Reported-by: John Lane <john@lane.uk.net>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 17:29:28 -05:00
John Lane
d0800999b2 lxc-archlinux: optional --root_passwd argument
Signed-off-by: John Lane <john@lane.uk.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 17:29:24 -05:00
John Lane
012f591a7d lxc-archlinux: support enabling systemd units
Signed-off-by: John Lane <john@lane.uk.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 17:28:46 -05:00
John Lane
734d0bed55 lxc-archlinux: support different architectures
Signed-off-by: John Lane <john@lane.uk.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 17:22:38 -05:00
John Lane
d8c77af0ae lxc-archlinux: don't drop mknod capability
Signed-off-by: John Lane <john@lane.uk.net>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 17:22:38 -05:00
Michael H. Warfield
b4f7af7a52 Modify lxc-fedora and lxc-centos for multiple issues...
This is a reissue of two previous patches along with some additional
changes for hardening the root password process based on discussions
on-list.

--
This patch modifies the lxc-fedora and lxc-centos templates for 3 things.

1) Extensively modifies root password generation, storage, and management
    based on discussions on the devel list.

  Root passwords are hardened and have advanced configurability.
    A static password may be provided.
    A password based on a template may be generated, including ${RANDOM}.
    A password may be generated through mktmp using a template with X's.
    Root passwords default to expired, initially.
    Passwords may optionally be echoed to stdout at container creation. (no)
    Passwords may optionally be stored in ${rootfs_path}/tmp_root_pass. (yes)
    Users may be optionally forced to change the password at creation time. (no)
    Default is to generate a pattern based password and store, no force change.
    All of this may be overridden by environment variables through
      conditional assignment.

2) Random static hardware addresses are generated for all configured
    interfaces.

3) Add code to create sysv init style scripts to intercept shutdown and
    reboot to prevent init restart and hang for CentOS and legacy Fedora
    systems on shutdown, reboot, init 0, and init 6.  This solves a variety
    of hang conditions but only affects newly created containers.  Does
    not have any impact on systemd based containers.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 17:01:28 -05:00
Stéphane Graber
d16079b6cb
ubuntu: Set default hwaddr to match template
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 16:54:07 -05:00
lxc@zitta.fr
f8d0243a78 gentoo: Initial template
Signed-off-by: gza <lxc@zitta.fr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 16:45:51 -05:00
Serge Hallyn
c8ad5f4623 api change: default container->daemonize to true
Pretty much the only case where we do NOT want to daemonize
a container start is lxc-start.  So make c->daemonize true
by default, and have lxc-start set it to false.

If there are existing API users who rely on daemonize by
default, then they will be broken by this.  It seems we should
do this before beta1 if we're going to do it.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 16:25:58 -05:00
Chris Glass
4213a747e8 Make ubuntu templates squid-deb-proxy-client aware
This makes the ubuntu and ubuntu-cloud templates automatically aware of apt
proxy settings when the LXC host has "squid-deb-proxy-client" installed. This
makes installations *much* faster when a suitable squid-deb-proxy is
found on the network (or installed on the host).

Signed-off-by: Chris Glass <tribaal@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 16:20:52 -05:00
Elan Ruusamäe
17abf2784d handle simple bashisms:
- [[ ]] -> [ ]
- == -> =
- source -> .
- redirect of fd 200 is error in mksh, use fd 9
- &> /dev/null -> > /dev/null 2>&1
- useless function keyword
- echo -e -> printf

still left bash shebang which did not validate with checkbashism, mostly
due 'type' being reported as bashism

Signed-Off-By: Elan Ruusamäe <glen@delfi.ee>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 16:16:00 -05:00
Åsmund Grammeltvedt
3aa0acaf0c lxc-start-ephemeral: Fix syntax error in aufs
Signed-off-by: Åsmund Grammeltvedt <asmundg@snap.tv>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 16:12:14 -05:00
Stéphane Graber
9accc2efea download: Improve cache handling
This adds a new --force-cache parameter which will force use of the
cache even for expired images.

An expired image is now only flushed from the cache once a new one is
successfuly downloaded (to avoid destroying the local cache when the
host doesn't have internet connectivity).

The ID of the build in cache is also tracked so that we don't
re-download something we already have (should only happen if we don't
have a new build published by the time the previous one expires).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-14 15:58:03 -05:00
Stéphane Graber
10a5fab6f3 download: Support listing available images
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-14 15:58:01 -05:00
Stéphane Graber
fecf101cc4 download: Don't use an hardcoded exclude list
Instead of hardcoding --exclude=./dev/*, use a new metadata file
"excludes" which lists all the paths or patterns to exclude during
extraction (one per line).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-14 15:57:59 -05:00
Stéphane Graber
33aa351ac1 download: Fix download_sig logic
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-01-14 15:57:51 -05:00
KATOH Yasufumi
83b4b1dca8 doc: Update lxc.conf(5)
* Update Japanese lxc.conf(5) for commit 508c263ee6
* Remove duplicate line in English lxc.conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-14 09:50:43 -05:00
Dwight Engen
fad9676698 download: don't download signatures when --no-validate given
- show full path to failed download location

- change test to -f in case meta.tar.xz:templates has a blank line it
  won't attempt to sed a directory

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-13 21:17:39 -05:00
Stéphane Graber
cb13115193
Add minimal userns config for plamo
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-13 17:06:01 -05:00
Serge Hallyn
484ed03088 cgroup: move all some functions into cgroup.h
Some functions which wanted to know about cgroup paths were located
in other files.  Move them into cgroup.c, so that all knowledge of
the cgroup backend can be colocated.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-13 16:35:53 -05:00
Luka Perkov
40131a0367 include: remove duplicates
Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-13 16:35:50 -05:00
Luka Perkov
0f71e1bf61 include: cleanup unnecessary getline defines
The removed chunk is already defined in utils.h which
is included in modified files.

Signed-off-by: Luka Perkov <luka.perkov@sartura.hr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-13 16:35:48 -05:00
Dwight Engen
b9fdb6928d fix bug setting autodef in config
Introduced in commit df2d4205.

Reported-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-01-13 12:51:58 -05:00
S.Çağlar Onur
710bde5e52 introduce a simple test for testing add_device_node and remove_device_node
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-13 10:11:47 -06:00
Serge Hallyn
508c263ee6 This change introduce mac address templating.
By setting lxc.network.hwaddr to something like fe:xx:xx:xx:xx:xx each
"x" will be replaced by a random value.  If less significant bit of
first byte is "templated", it will be set to 0.

This change introduce also a common randinit() function that could be
used to initialize random generator.

Signed-off-by: gza <lxc@zitta.fr>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-13 10:04:10 -06:00
KATOH Yasufumi
bf3e09c00e plamo: Update template to use lxc.include and add plamo.common.conf
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-01-13 09:14:04 -06:00