mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 01:29:07 +00:00
Merge pull request #2233 from dave-tucker/ns-detect
getty: Detect if you are in a namespace
This commit is contained in:
commit
8f10f69fd3
@ -53,7 +53,7 @@ services:
|
|||||||
image: linuxkit/acpid:1966310cb75e28ffc668863a6577ee991327f918
|
image: linuxkit/acpid:1966310cb75e28ffc668863a6577ee991327f918
|
||||||
# Enable getty for easier debugging
|
# Enable getty for easier debugging
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
# Run ntpd to keep time synchronised in the VM
|
# Run ntpd to keep time synchronised in the VM
|
||||||
|
@ -20,7 +20,7 @@ onboot:
|
|||||||
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
command: ["/usr/bin/mountie", "/var/lib/docker"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -16,7 +16,7 @@ onboot:
|
|||||||
image: linuxkit/metadata:f5d4299909b159db35f72547e4ae70bd76c42c6c
|
image: linuxkit/metadata:f5d4299909b159db35f72547e4ae70bd76c42c6c
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -14,7 +14,7 @@ onboot:
|
|||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
# to make insecure with passwordless root login, uncomment following lines
|
# to make insecure with passwordless root login, uncomment following lines
|
||||||
#env:
|
#env:
|
||||||
# - INSECURE=true
|
# - INSECURE=true
|
||||||
|
@ -11,7 +11,7 @@ onboot:
|
|||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
trust:
|
trust:
|
||||||
|
@ -7,7 +7,7 @@ init:
|
|||||||
- linuxkit/containerd:8fc87b7f465bde9ece781899a007f47b6d3c096b
|
- linuxkit/containerd:8fc87b7f465bde9ece781899a007f47b6d3c096b
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -13,7 +13,7 @@ onboot:
|
|||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: redis
|
- name: redis
|
||||||
|
@ -11,7 +11,7 @@ onboot:
|
|||||||
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -24,7 +24,7 @@ onboot:
|
|||||||
command: ["/swap.sh", "--path", "/var/external/swap", "--size", "1G", "--encrypt"]
|
command: ["/swap.sh", "--path", "/var/external/swap", "--size", "1G", "--encrypt"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -14,7 +14,7 @@ onboot:
|
|||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:1b651a91f1c17f50357be9873b580ccf81668630
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: tss
|
- name: tss
|
||||||
|
@ -11,7 +11,7 @@ onboot:
|
|||||||
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -16,7 +16,7 @@ onboot:
|
|||||||
image: linuxkit/metadata:f5d4299909b159db35f72547e4ae70bd76c42c6c
|
image: linuxkit/metadata:f5d4299909b159db35f72547e4ae70bd76c42c6c
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -20,7 +20,7 @@ onshutdown:
|
|||||||
command: ["/bin/echo", "so long and thanks for all the fish"]
|
command: ["/bin/echo", "so long and thanks for all the fish"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -1 +0,0 @@
|
|||||||
export PS1="(ns: getty) $PS1"
|
|
@ -41,6 +41,14 @@ start_getty() {
|
|||||||
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
|
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# check if we are namespaced, and, if so, indicate in the PS1
|
||||||
|
if [ -z "$INITGETTY" ]; then
|
||||||
|
cat >/etc/profile.d/namespace.sh <<"EOF"
|
||||||
|
export PS1="(ns: getty) $PS1"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# check if we have /etc/getty.shadow
|
# check if we have /etc/getty.shadow
|
||||||
ROOTSHADOW=/hostroot/etc/getty.shadow
|
ROOTSHADOW=/hostroot/etc/getty.shadow
|
||||||
if [ -f $ROOTSHADOW ]; then
|
if [ -f $ROOTSHADOW ]; then
|
||||||
|
@ -30,7 +30,7 @@ onboot:
|
|||||||
- /var/lib:/var/lib
|
- /var/lib:/var/lib
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -30,7 +30,7 @@ onboot:
|
|||||||
- /var/lib:/var/lib
|
- /var/lib:/var/lib
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -11,7 +11,7 @@ onboot:
|
|||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
trust:
|
trust:
|
||||||
|
@ -12,7 +12,7 @@ onboot:
|
|||||||
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:6cbeee0392b0670053ce2bf05a5a0d67ec2bce05
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -30,7 +30,7 @@ services:
|
|||||||
- name: sshd
|
- name: sshd
|
||||||
image: linuxkit/sshd:dc98a72c1d1285c30f2db176252f3ce2bf645d5b
|
image: linuxkit/sshd:dc98a72c1d1285c30f2db176252f3ce2bf645d5b
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
files:
|
files:
|
||||||
|
@ -16,7 +16,7 @@ onboot:
|
|||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: rngd
|
- name: rngd
|
||||||
|
@ -23,7 +23,7 @@ onboot:
|
|||||||
image: linuxkit/metadata:f5d4299909b159db35f72547e4ae70bd76c42c6c
|
image: linuxkit/metadata:f5d4299909b159db35f72547e4ae70bd76c42c6c
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
env:
|
env:
|
||||||
- INSECURE=true
|
- INSECURE=true
|
||||||
- name: qemu-ga
|
- name: qemu-ga
|
||||||
|
@ -12,7 +12,7 @@ onboot:
|
|||||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||||
services:
|
services:
|
||||||
- name: getty
|
- name: getty
|
||||||
image: linuxkit/getty:894eef1e5f62f3bc31de8ffaff2b6c0e093c4595
|
image: linuxkit/getty:58620cff1b0bf8b5d144d087602115e996f18a02
|
||||||
files:
|
files:
|
||||||
- path: etc/getty.shadow
|
- path: etc/getty.shadow
|
||||||
# sample sets password for root to "abcdefgh" (without quotes)
|
# sample sets password for root to "abcdefgh" (without quotes)
|
||||||
|
Loading…
Reference in New Issue
Block a user