컨테이너 내부의 Firefox가 호스트 사용자의 UID를 사용하여 호스트 외부에서 새 Firefox 창을 시작하게 만드는 이유는 무엇입니까? LXC는 좀 이상하지 않나요?

컨테이너 내부의 Firefox가 호스트 사용자의 UID를 사용하여 호스트 외부에서 새 Firefox 창을 시작하게 만드는 이유는 무엇입니까? LXC는 좀 이상하지 않나요?

누군가 나에게 이 이상한 행동을 설명해 줄 수 있습니까?

내부에 Firefox가 포함된 권한 없는 LXC 컨테이너가 있습니다.

Firefox가 컨테이너 외부의 호스트에서 실행 중인 경우, /usr/bin/firefox컨테이너 내에서 새 Firefox 창을 시작합니다.외부호스트 사용자의 UID가 있는 호스트에서.

Firefox가 컨테이너 외부에서 실행되지 않는 경우, /usr/bin/firefox컨테이너 내부에서 Firefox를 실행하고 컨테이너 사용자의 (SUB)UID를 원하는 대로 사용합니다.

반대의 경우도 마찬가지입니다. Firefox가 호스트가 아닌 컨테이너 내부에서 실행되고 있고 Firefox가 호스트에서 시작되면 Firefox는 컨테이너 사용자의 UID로 시작됩니다.

? ! ? ! 어떻게에 대한? ! ? !

편집: 기본 프로필과 함께 권한이 없는 기본 Ubuntu 컨테이너를 사용할 때 동일한 문제가 발생하는 것을 확인했습니다.

편집: Arch Forum에서도 동일한 질문이 제기되었습니다.https://bbs.archlinux.org/viewtopic.php?pid=1622174#p1622174

config file:

lxc.devttydir = lxc 
lxc.pts = 1024
lxc.tty = 4 
lxc.cap.drop = mac_admin mac_override sys_time sys_module
lxc.pivotdir = lxc_putold
lxc.hook.clone = /usr/share/lxc/hooks/clonehostname
lxc.cgroup.devices.deny = a 
lxc.cgroup.devices.allow = c *:* m
lxc.cgroup.devices.allow = b *:* m
lxc.cgroup.devices.allow = c 1:3 rwm 
lxc.cgroup.devices.allow = c 1:5 rwm 
lxc.cgroup.devices.allow = c 1:7 rwm 
lxc.cgroup.devices.allow = c 5:0 rwm 
lxc.cgroup.devices.allow = c 5:1 rwm 
lxc.cgroup.devices.allow = c 5:2 rwm 
lxc.cgroup.devices.allow = c 1:8 rwm 
lxc.cgroup.devices.allow = c 1:9 rwm 
lxc.cgroup.devices.allow = c 136:* rwm 
lxc.cgroup.devices.allow = c 10:229 rwm 
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections   none bind,optional 0 0 
lxc.seccomp = /usr/share/lxc/config/common.seccomp
lxc.hook.mount = /usr/share/lxcfs/lxc.mount.hook
lxc.hook.post-stop = /usr/share/lxcfs/lxc.reboot.hook
lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0 
lxc.mount.entry = /sys/kernel/security sys/kernel/security none bind,optional 0 0 
lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0 
lxc.mount.entry = mqueue dev/mqueue mqueue rw,relatime,create=dir,optional 0 0 
lxc.cgroup.devices.allow = c 254:0 rm
lxc.cgroup.devices.allow = c 10:200 rwm 
lxc.cgroup.devices.allow = c 10:228 rwm 
lxc.cgroup.devices.allow = c 10:232 rwm 
lxc.cgroup.devices.deny =
lxc.cgroup.devices.allow =
lxc.devttydir =
lxc.mount.entry = /dev/console dev/console none bind,create=file 0 0 
lxc.mount.entry = /dev/full dev/full none bind,create=file 0 0 
lxc.mount.entry = /dev/null dev/null none bind,create=file 0 0 
lxc.mount.entry = /dev/random dev/random none bind,create=file 0 0 
lxc.mount.entry = /dev/tty dev/tty none bind,create=file 0 0 
lxc.mount.entry = /dev/urandom dev/urandom none bind,create=file 0 0 
lxc.mount.entry = /dev/zero dev/zero none bind,create=file 0 0 
lxc.mount.entry = /sys/firmware/efi/efivars sys/firmware/efi/efivars  none bind,optional 0 0 
lxc.mount.entry = /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc none bind,optional 0 0 
lxc.arch = x86_64
lxc.cgroup.devices.allow = c 226:* rwm 
lxc.mount.entry = tmpfs tmp tmpfs defaults
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none ro,bind,create=dir 0 0

컨테이너는 다음과 같이 시작됩니다.

lxc-start -n c1 -F -f /path/to/above/conf -s 'lxc.id_map = u 0 100000 65536' -s 'lxc.id_map = g 0 100000 65536' -s 'lxc.rootfs = /path/to/rootfs' -s 'lxc.init_cmd = /usr/bin/bash'

편집자: Distro Arch Linux

$ uname -r
4.6.0-rc4-customGIT+

# lxc-checkconfig
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled

--- Control groups ---
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
Bridges: enabled
Advanced netfilter: enabled
CONFIG_NF_NAT_IPV4: enabled
CONFIG_NF_NAT_IPV6: enabled
CONFIG_IP_NF_TARGET_MASQUERADE: enabled
CONFIG_IP6_NF_TARGET_MASQUERADE: enabled
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled
FUSE (for use with lxcfs): enabled

--- Checkpoint/Restore ---
checkpoint restore: enabled
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: enabled
CONFIG_INET_DIAG: enabled
CONFIG_PACKET_DIAG: enabled
CONFIG_NETLINK_DIAG: enabled
File capabilities: enabled

답변1

동일한 X 디스플레이에서 실행 중인 Firefox 인스턴스에 연결하고 새 창을 열도록 요청합니다.

다음 환경(다른 호스트에서도)에서 Firefox를 실행하려고 하면 ssh -Y동일한 동작이 관찰될 수 있습니다 . (근데 su - SOME_USER무슨 이유에서인지 그 이하가 없네요. 그게 제겐 미스터리입니다.)

이 동작은 다음 옵션을 사용하여 끌 수 있습니다:

firefox --new-instance

관련 정보