Commit 42e53c29 by 0x0916

confile: rename lxc.devttydir to lxc.tty.dir

the legacy keys will be kept around until LXC 3.0 and then will be removed Signed-off-by: 's avatar0x0916 <w@laoqinren.net>
parent 55c84efc
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
lxc.include = @LXCTEMPLATECONFIG@/common.conf lxc.include = @LXCTEMPLATECONFIG@/common.conf
# Doesn't support consoles in /dev/lxc/. # Doesn't support consoles in /dev/lxc/.
lxc.devttydir = lxc.tty.dir =
# Drop another (potentially) harmful capabilities. # Drop another (potentially) harmful capabilities.
lxc.cap.drop = audit_write lxc.cap.drop = audit_write
......
...@@ -9,7 +9,7 @@ lxc.signal.halt=SIGRTMIN+4 ...@@ -9,7 +9,7 @@ lxc.signal.halt=SIGRTMIN+4
lxc.signal.stop=SIGRTMIN+14 lxc.signal.stop=SIGRTMIN+14
# Uncomment to disable creating tty devices subdirectory in /dev # Uncomment to disable creating tty devices subdirectory in /dev
# lxc.devttydir = # lxc.tty.dir =
# Capabilities # Capabilities
# Uncomment these if you don't run anything that needs the capability, and # Uncomment these if you don't run anything that needs the capability, and
......
# Default configuration shared by all containers # Default configuration shared by all containers
# Setup the LXC devices in /dev/lxc/ # Setup the LXC devices in /dev/lxc/
lxc.devttydir = lxc lxc.tty.dir = lxc
# Allow for 1024 pseudo terminals # Allow for 1024 pseudo terminals
lxc.pts = 1024 lxc.pts = 1024
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
lxc.include = @LXCTEMPLATECONFIG@/common.conf lxc.include = @LXCTEMPLATECONFIG@/common.conf
# Doesn't support consoles in /dev/lxc/ # Doesn't support consoles in /dev/lxc/
lxc.devttydir = lxc.tty.dir =
# When using LXC with apparmor, the container will be confined by default. # When using LXC with apparmor, the container will be confined by default.
# If you wish for it to instead run unconfined, copy the following line # If you wish for it to instead run unconfined, copy the following line
......
...@@ -7,7 +7,7 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf ...@@ -7,7 +7,7 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf
# Looking for more security, see gentoo.moresecure.conf # Looking for more security, see gentoo.moresecure.conf
# Doesn't support consoles in /dev/lxc/ # Doesn't support consoles in /dev/lxc/
lxc.devttydir = lxc.tty.dir =
# Extra cgroup device access # Extra cgroup device access
## rtc ## rtc
......
# Default console settings # Default console settings
lxc.devttydir = lxc lxc.tty.dir = lxc
lxc.tty = 4 lxc.tty = 4
lxc.pts = 1024 lxc.pts = 1024
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
lxc.include = @LXCTEMPLATECONFIG@/common.conf lxc.include = @LXCTEMPLATECONFIG@/common.conf
# Doesn't support consoles in /dev/lxc/ # Doesn't support consoles in /dev/lxc/
lxc.devttydir = lxc.tty.dir =
# Extra cgroup device access # Extra cgroup device access
## rtc ## rtc
......
...@@ -13,7 +13,7 @@ lxc.tty = 1 ...@@ -13,7 +13,7 @@ lxc.tty = 1
lxc.autodev = 1 lxc.autodev = 1
# Doesn't support consoles in /dev/lxc/ # Doesn't support consoles in /dev/lxc/
lxc.devttydir = lxc.tty.dir =
# CGroup whitelist # CGroup whitelist
lxc.cgroup.devices.deny = a lxc.cgroup.devices.deny = a
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
lxc.include = @LXCTEMPLATECONFIG@/common.conf lxc.include = @LXCTEMPLATECONFIG@/common.conf
# Doesn't support consoles in /dev/lxc/ # Doesn't support consoles in /dev/lxc/
lxc.devttydir = lxc.tty.dir =
# Extra cgroup device access # Extra cgroup device access
## rtc ## rtc
......
# Ubuntu 10.04 LTS doesn't have /dev/lxc/ # Ubuntu 10.04 LTS doesn't have /dev/lxc/
lxc.devttydir = lxc.tty.dir =
...@@ -3,7 +3,7 @@ lxc.cgroup.devices.deny = ...@@ -3,7 +3,7 @@ lxc.cgroup.devices.deny =
lxc.cgroup.devices.allow = lxc.cgroup.devices.allow =
# We can't move bind-mounts, so don't use /dev/lxc/ # We can't move bind-mounts, so don't use /dev/lxc/
lxc.devttydir = lxc.tty.dir =
# Extra bind-mounts for userns # Extra bind-mounts for userns
lxc.mount.entry = /dev/full dev/full none bind,create=file 0 0 lxc.mount.entry = /dev/full dev/full none bind,create=file 0 0
......
...@@ -12,7 +12,7 @@ lxc.signal.halt=SIGCONT ...@@ -12,7 +12,7 @@ lxc.signal.halt=SIGCONT
# Uncomment to disable creating tty devices subdirectory in /dev # Uncomment to disable creating tty devices subdirectory in /dev
# lxc.devttydir = # lxc.tty.dir =
# Capabilities # Capabilities
# Uncomment these if you don't run anything that needs the capability, and # Uncomment these if you don't run anything that needs the capability, and
......
...@@ -77,7 +77,7 @@ lxc_log_define(lxc_confile, lxc); ...@@ -77,7 +77,7 @@ lxc_log_define(lxc_confile, lxc);
lxc_config_define(personality); lxc_config_define(personality);
lxc_config_define(pts); lxc_config_define(pts);
lxc_config_define(tty); lxc_config_define(tty);
lxc_config_define(ttydir); lxc_config_define(tty_dir);
lxc_config_define(apparmor_profile); lxc_config_define(apparmor_profile);
lxc_config_define(apparmor_allow_incomplete); lxc_config_define(apparmor_allow_incomplete);
lxc_config_define(selinux_context); lxc_config_define(selinux_context);
...@@ -136,8 +136,14 @@ lxc_config_define(prlimit); ...@@ -136,8 +136,14 @@ lxc_config_define(prlimit);
static struct lxc_config_t config[] = { static struct lxc_config_t config[] = {
{ "lxc.arch", set_config_personality, get_config_personality, clr_config_personality, }, { "lxc.arch", set_config_personality, get_config_personality, clr_config_personality, },
{ "lxc.pts", set_config_pts, get_config_pts, clr_config_pts, }, { "lxc.pts", set_config_pts, get_config_pts, clr_config_pts, },
{ "lxc.tty.dir", set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
/* REMOVE IN LXC 3.0
legacy devttydir key
*/
{ "lxc.devttydir", set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
{ "lxc.tty", set_config_tty, get_config_tty, clr_config_tty, }, { "lxc.tty", set_config_tty, get_config_tty, clr_config_tty, },
{ "lxc.devttydir", set_config_ttydir, get_config_ttydir, clr_config_ttydir, },
{ "lxc.apparmor.profile", set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, }, { "lxc.apparmor.profile", set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, },
{ "lxc.apparmor.allow_incomplete", set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, }, { "lxc.apparmor.allow_incomplete", set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, },
{ "lxc.selinux.context", set_config_selinux_context, get_config_selinux_context, clr_config_selinux_context, }, { "lxc.selinux.context", set_config_selinux_context, get_config_selinux_context, clr_config_selinux_context, },
...@@ -1295,7 +1301,7 @@ static int set_config_tty(const char *key, const char *value, ...@@ -1295,7 +1301,7 @@ static int set_config_tty(const char *key, const char *value,
return lxc_safe_uint(value, &lxc_conf->tty); return lxc_safe_uint(value, &lxc_conf->tty);
} }
static int set_config_ttydir(const char *key, const char *value, static int set_config_tty_dir(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_string_item_max(&lxc_conf->ttydir, value, return set_config_string_item_max(&lxc_conf->ttydir, value,
...@@ -2781,7 +2787,7 @@ static int get_config_tty(const char *key, char *retv, int inlen, ...@@ -2781,7 +2787,7 @@ static int get_config_tty(const char *key, char *retv, int inlen,
return lxc_get_conf_int(c, retv, inlen, c->tty); return lxc_get_conf_int(c, retv, inlen, c->tty);
} }
static int get_config_ttydir(const char *key, char *retv, int inlen, static int get_config_tty_dir(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data) struct lxc_conf *c, void *data)
{ {
return lxc_get_conf_str(retv, inlen, c->ttydir); return lxc_get_conf_str(retv, inlen, c->ttydir);
...@@ -3355,7 +3361,7 @@ static inline int clr_config_tty(const char *key, struct lxc_conf *c, ...@@ -3355,7 +3361,7 @@ static inline int clr_config_tty(const char *key, struct lxc_conf *c,
return 0; return 0;
} }
static inline int clr_config_ttydir(const char *key, struct lxc_conf *c, static inline int clr_config_tty_dir(const char *key, struct lxc_conf *c,
void *data) void *data)
{ {
free(c->ttydir); free(c->ttydir);
......
...@@ -314,13 +314,22 @@ int main(int argc, char *argv[]) ...@@ -314,13 +314,22 @@ int main(int argc, char *argv[])
goto non_test_error; goto non_test_error;
} }
/* lxc.devttydir */ /* REMOVE IN LXC 3.0
legacy devttydir keys
*/
if (set_get_compare_clear_save_load(c, "lxc.devttydir", "not-dev", tmpf, if (set_get_compare_clear_save_load(c, "lxc.devttydir", "not-dev", tmpf,
true) < 0) { true) < 0) {
lxc_error("%s\n", "lxc.devttydir"); lxc_error("%s\n", "lxc.devttydir");
goto non_test_error; goto non_test_error;
} }
/* lxc.tty.dir */
if (set_get_compare_clear_save_load(c, "lxc.tty.dir", "not-dev", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.tty.dir");
goto non_test_error;
}
/* REMOVE IN LXC 3.0 /* REMOVE IN LXC 3.0
legacy security keys legacy security keys
*/ */
......
...@@ -122,9 +122,9 @@ ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf ...@@ -122,9 +122,9 @@ ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
EOF EOF
# enable getty on active ttys # enable getty on active ttys
local nttys=$(cat "${config_path}/config" ${shared_config} ${common_config} | grep "^lxc.tty" | head -n1 | cut -d= -f2 | tr -d "[:blank:]") local nttys=$(cat "${config_path}/config" ${shared_config} ${common_config} | grep "^lxc.tty" | head -n1 | cut -d= -f2 | tr -d "[:blank:]")
local devttydir=$(cat "${config_path}/config" ${shared_config} ${common_config} | grep "^lxc.devttydir" | head -n1 | cut -d= -f2 | tr -d "[:blank:]") local devttydir=$(cat "${config_path}/config" ${shared_config} ${common_config} | grep "^lxc.tty.dir" | head -n1 | cut -d= -f2 | tr -d "[:blank:]")
local devtty="" local devtty=""
# bind getty instances to /dev/<devttydir>/tty* if lxc.devttydir is set # bind getty instances to /dev/<devttydir>/tty* if lxc.tty.dir is set
[ -n "${devttydir}" ] && devtty="${devttydir}-" [ -n "${devttydir}" ] && devtty="${devttydir}-"
if [ ${nttys:-0} -gt 1 ]; then if [ ${nttys:-0} -gt 1 ]; then
( cd "${rootfs_path}/etc/systemd/system/getty.target.wants" ( cd "${rootfs_path}/etc/systemd/system/getty.target.wants"
......
...@@ -336,7 +336,7 @@ EOF ...@@ -336,7 +336,7 @@ EOF
# /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and # /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
# /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks. # /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks.
# lxc will maintain these links and bind mount ptys over /dev/lxc/* # lxc will maintain these links and bind mount ptys over /dev/lxc/*
# since lxc.devttydir is specified in the config. # since lxc.tty.dir is specified in the config.
# allow root login on console, tty[1-4], and pts/0 for libvirt # allow root login on console, tty[1-4], and pts/0 for libvirt
echo "# LXC (Linux Containers)" >>${rootfs_path}/etc/securetty echo "# LXC (Linux Containers)" >>${rootfs_path}/etc/securetty
......
...@@ -276,7 +276,7 @@ EOF ...@@ -276,7 +276,7 @@ EOF
# /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and # /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
# /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks. # /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks.
# lxc will maintain these links and bind mount ptys over /dev/lxc/* # lxc will maintain these links and bind mount ptys over /dev/lxc/*
# since lxc.devttydir is specified in the config. # since lxc.tty.dir is specified in the config.
# allow root login on console, tty[1-4], and pts/0 for libvirt # allow root login on console, tty[1-4], and pts/0 for libvirt
echo "# LXC (Linux Containers)" >>${rootfs_path}/etc/securetty echo "# LXC (Linux Containers)" >>${rootfs_path}/etc/securetty
......
...@@ -345,7 +345,7 @@ EOF ...@@ -345,7 +345,7 @@ EOF
# /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and # /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
# /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks. # /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks.
# lxc will maintain these links and bind mount ptys over /dev/lxc/* # lxc will maintain these links and bind mount ptys over /dev/lxc/*
# since lxc.devttydir is specified in the config. # since lxc.tty.dir is specified in the config.
# allow root login on console, tty[1-4], and pts/0 for libvirt # allow root login on console, tty[1-4], and pts/0 for libvirt
cat <<EOF >> "${rootfs}/etc/securetty" cat <<EOF >> "${rootfs}/etc/securetty"
......
...@@ -359,7 +359,7 @@ EOF ...@@ -359,7 +359,7 @@ EOF
# /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and # /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
# /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks. # /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks.
# lxc will maintain these links and bind mount ptys over /dev/lxc/* # lxc will maintain these links and bind mount ptys over /dev/lxc/*
# since lxc.devttydir is specified in the config. # since lxc.tty.dir is specified in the config.
# allow root login on console, tty[1-4], and pts/0 for libvirt # allow root login on console, tty[1-4], and pts/0 for libvirt
echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty
......
...@@ -229,7 +229,7 @@ EOF ...@@ -229,7 +229,7 @@ EOF
# /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and # /dev/tty[1-4] will be symlinks to the ptys /dev/lxc/console and
# /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks. # /dev/lxc/tty[1-4] so that package updates can overwrite the symlinks.
# lxc will maintain these links and bind mount ptys over /dev/lxc/* # lxc will maintain these links and bind mount ptys over /dev/lxc/*
# since lxc.devttydir is specified in the config. # since lxc.tty.dir is specified in the config.
# allow root login on console, tty[1-4], and pts/0 for libvirt # allow root login on console, tty[1-4], and pts/0 for libvirt
echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment