From: 0x0916 Date: Wed, 28 Jun 2017 10:44:18 +0000 (+0800) Subject: confile: rename lxc.devttydir to lxc.tty.dir X-Git-Tag: lxc-2.1.0~75^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42e53c29205fe6474239129134cdc617709a2635;p=thirdparty%2Flxc.git 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: 0x0916 --- diff --git a/config/templates/alpine.common.conf.in b/config/templates/alpine.common.conf.in index b3444261f..934fee28e 100644 --- a/config/templates/alpine.common.conf.in +++ b/config/templates/alpine.common.conf.in @@ -2,7 +2,7 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf # Doesn't support consoles in /dev/lxc/. -lxc.devttydir = +lxc.tty.dir = # Drop another (potentially) harmful capabilities. lxc.cap.drop = audit_write diff --git a/config/templates/archlinux.common.conf.in b/config/templates/archlinux.common.conf.in index 043b27cc5..7da478f81 100644 --- a/config/templates/archlinux.common.conf.in +++ b/config/templates/archlinux.common.conf.in @@ -9,7 +9,7 @@ lxc.signal.halt=SIGRTMIN+4 lxc.signal.stop=SIGRTMIN+14 # Uncomment to disable creating tty devices subdirectory in /dev -# lxc.devttydir = +# lxc.tty.dir = # Capabilities # Uncomment these if you don't run anything that needs the capability, and diff --git a/config/templates/common.conf.in b/config/templates/common.conf.in index fdfd79068..a01348489 100644 --- a/config/templates/common.conf.in +++ b/config/templates/common.conf.in @@ -1,7 +1,7 @@ # Default configuration shared by all containers # Setup the LXC devices in /dev/lxc/ -lxc.devttydir = lxc +lxc.tty.dir = lxc # Allow for 1024 pseudo terminals lxc.pts = 1024 diff --git a/config/templates/debian.common.conf.in b/config/templates/debian.common.conf.in index 07c2bc8b1..b11f27f62 100644 --- a/config/templates/debian.common.conf.in +++ b/config/templates/debian.common.conf.in @@ -2,7 +2,7 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf # Doesn't support consoles in /dev/lxc/ -lxc.devttydir = +lxc.tty.dir = # 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 diff --git a/config/templates/gentoo.common.conf.in b/config/templates/gentoo.common.conf.in index 49cd411b6..477a2abfb 100644 --- a/config/templates/gentoo.common.conf.in +++ b/config/templates/gentoo.common.conf.in @@ -7,7 +7,7 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf # Looking for more security, see gentoo.moresecure.conf # Doesn't support consoles in /dev/lxc/ -lxc.devttydir = +lxc.tty.dir = # Extra cgroup device access ## rtc diff --git a/config/templates/openwrt.common.conf.in b/config/templates/openwrt.common.conf.in index 878e8390c..e9e4e51cc 100644 --- a/config/templates/openwrt.common.conf.in +++ b/config/templates/openwrt.common.conf.in @@ -1,5 +1,5 @@ # Default console settings -lxc.devttydir = lxc +lxc.tty.dir = lxc lxc.tty = 4 lxc.pts = 1024 diff --git a/config/templates/plamo.common.conf.in b/config/templates/plamo.common.conf.in index 718fc5354..7918b4a37 100644 --- a/config/templates/plamo.common.conf.in +++ b/config/templates/plamo.common.conf.in @@ -2,7 +2,7 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf # Doesn't support consoles in /dev/lxc/ -lxc.devttydir = +lxc.tty.dir = # Extra cgroup device access ## rtc diff --git a/config/templates/sabayon.common.conf.in b/config/templates/sabayon.common.conf.in index ecb6afead..21e3148b1 100644 --- a/config/templates/sabayon.common.conf.in +++ b/config/templates/sabayon.common.conf.in @@ -13,7 +13,7 @@ lxc.tty = 1 lxc.autodev = 1 # Doesn't support consoles in /dev/lxc/ -lxc.devttydir = +lxc.tty.dir = # CGroup whitelist lxc.cgroup.devices.deny = a diff --git a/config/templates/slackware.common.conf.in b/config/templates/slackware.common.conf.in index c932e6db7..899c52ce3 100644 --- a/config/templates/slackware.common.conf.in +++ b/config/templates/slackware.common.conf.in @@ -2,7 +2,7 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf # Doesn't support consoles in /dev/lxc/ -lxc.devttydir = +lxc.tty.dir = # Extra cgroup device access ## rtc diff --git a/config/templates/ubuntu.lucid.conf.in b/config/templates/ubuntu.lucid.conf.in index adb8b7e81..b6fe37c97 100644 --- a/config/templates/ubuntu.lucid.conf.in +++ b/config/templates/ubuntu.lucid.conf.in @@ -1,2 +1,2 @@ # Ubuntu 10.04 LTS doesn't have /dev/lxc/ -lxc.devttydir = +lxc.tty.dir = diff --git a/config/templates/userns.conf.in b/config/templates/userns.conf.in index 78383ebfc..b43d4f3db 100644 --- a/config/templates/userns.conf.in +++ b/config/templates/userns.conf.in @@ -3,7 +3,7 @@ lxc.cgroup.devices.deny = lxc.cgroup.devices.allow = # We can't move bind-mounts, so don't use /dev/lxc/ -lxc.devttydir = +lxc.tty.dir = # Extra bind-mounts for userns lxc.mount.entry = /dev/full dev/full none bind,create=file 0 0 diff --git a/config/templates/voidlinux.common.conf.in b/config/templates/voidlinux.common.conf.in index 41ab1a2fe..9e49fd7b8 100644 --- a/config/templates/voidlinux.common.conf.in +++ b/config/templates/voidlinux.common.conf.in @@ -12,7 +12,7 @@ lxc.signal.halt=SIGCONT # Uncomment to disable creating tty devices subdirectory in /dev -# lxc.devttydir = +# lxc.tty.dir = # Capabilities # Uncomment these if you don't run anything that needs the capability, and diff --git a/src/lxc/confile.c b/src/lxc/confile.c index d9fa41269..23446939e 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -77,7 +77,7 @@ lxc_log_define(lxc_confile, lxc); lxc_config_define(personality); lxc_config_define(pts); lxc_config_define(tty); -lxc_config_define(ttydir); +lxc_config_define(tty_dir); lxc_config_define(apparmor_profile); lxc_config_define(apparmor_allow_incomplete); lxc_config_define(selinux_context); @@ -136,8 +136,14 @@ lxc_config_define(prlimit); static struct lxc_config_t config[] = { { "lxc.arch", set_config_personality, get_config_personality, clr_config_personality, }, { "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.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.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, }, @@ -1295,7 +1301,7 @@ static int set_config_tty(const char *key, const char *value, 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) { 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, 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) { 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, 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) { free(c->ttydir); diff --git a/src/tests/parse_config_file.c b/src/tests/parse_config_file.c index bab9c2ff2..74334e100 100644 --- a/src/tests/parse_config_file.c +++ b/src/tests/parse_config_file.c @@ -314,13 +314,22 @@ int main(int argc, char *argv[]) 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, true) < 0) { lxc_error("%s\n", "lxc.devttydir"); 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 legacy security keys */ diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in index 200b84e66..581ebb37d 100644 --- a/templates/lxc-archlinux.in +++ b/templates/lxc-archlinux.in @@ -122,9 +122,9 @@ ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf EOF # 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 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="" - # bind getty instances to /dev//tty* if lxc.devttydir is set + # bind getty instances to /dev//tty* if lxc.tty.dir is set [ -n "${devttydir}" ] && devtty="${devttydir}-" if [ ${nttys:-0} -gt 1 ]; then ( cd "${rootfs_path}/etc/systemd/system/getty.target.wants" diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in index 1fa5e4826..a211636dc 100644 --- a/templates/lxc-centos.in +++ b/templates/lxc-centos.in @@ -336,7 +336,7 @@ EOF # /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. # 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 echo "# LXC (Linux Containers)" >>${rootfs_path}/etc/securetty diff --git a/templates/lxc-fedora-legacy.in b/templates/lxc-fedora-legacy.in index 9731b3505..2c5abd13e 100644 --- a/templates/lxc-fedora-legacy.in +++ b/templates/lxc-fedora-legacy.in @@ -276,7 +276,7 @@ EOF # /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. # 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 echo "# LXC (Linux Containers)" >>${rootfs_path}/etc/securetty diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index f3d9b2695..0cd790de9 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -345,7 +345,7 @@ EOF # /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. # 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 cat <> "${rootfs}/etc/securetty" diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in index 35c421523..f06b70ec3 100644 --- a/templates/lxc-oracle.in +++ b/templates/lxc-oracle.in @@ -359,7 +359,7 @@ EOF # /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. # 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 echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty diff --git a/templates/lxc-sparclinux.in b/templates/lxc-sparclinux.in index 41769b854..1757706f1 100644 --- a/templates/lxc-sparclinux.in +++ b/templates/lxc-sparclinux.in @@ -229,7 +229,7 @@ EOF # /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. # 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 echo "# LXC (Linux Containers)" >>$container_rootfs/etc/securetty