mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
Merge pull request #2179 from deitch/read-only-securetty
Use existing securetty
This commit is contained in:
commit
f98a56fc2c
@ -20,7 +20,7 @@ onboot:
|
||||
command: ["/mount.sh", "/var/lib/docker"]
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: rngd
|
||||
|
@ -16,7 +16,7 @@ onboot:
|
||||
image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: rngd
|
||||
|
@ -14,7 +14,7 @@ onboot:
|
||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
# to make insecure with passwordless root login, uncomment following lines
|
||||
#env:
|
||||
# - INSECURE=true
|
||||
|
@ -11,7 +11,7 @@ onboot:
|
||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
trust:
|
||||
|
@ -7,7 +7,7 @@ init:
|
||||
- linuxkit/containerd:c977f27c234d55b85172813b8451f67ea86be4a3
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: rngd
|
||||
|
@ -13,7 +13,7 @@ onboot:
|
||||
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: redis
|
||||
|
@ -11,7 +11,7 @@ onboot:
|
||||
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: rngd
|
||||
|
@ -24,7 +24,7 @@ onboot:
|
||||
command: ["/swap.sh", "--path", "/var/external/swap", "--size", "1G", "--encrypt"]
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: rngd
|
||||
|
@ -11,7 +11,7 @@ onboot:
|
||||
image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: rngd
|
||||
|
@ -16,7 +16,7 @@ onboot:
|
||||
image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb
|
||||
services:
|
||||
- name: getty
|
||||
image: linuxkit/getty:5ab31289889d61a5d2ecbeea8e36ce74ac54737c
|
||||
image: linuxkit/getty:0bd92d5f906491c20e4177c57f965338fe5a8c5f
|
||||
env:
|
||||
- INSECURE=true
|
||||
- name: rngd
|
||||
|
@ -16,6 +16,12 @@ services:
|
||||
The above will launch a getty for each console defined in the cmdline, i.e. `/proc/cmdline`.
|
||||
|
||||
|
||||
### securetty
|
||||
Every console defined in the `cmdline` **must** also already exist in `/etc/securetty` if you wish to login on that tty as root. If it does not exist, a getty will be started, but you will not be able to login as root. A warning message will be sent to that tty.
|
||||
|
||||
If you are using a console that is not in `securetty`, you can add it by overriding the default `securetty` file in the linuxkit root filesystem using `files:` in your moby `.yml` file.
|
||||
|
||||
|
||||
### Login Options
|
||||
There are 3 ways to launch a getty on a linuxkit instance:
|
||||
|
||||
|
@ -35,7 +35,8 @@ start_getty() {
|
||||
fi
|
||||
|
||||
if ! grep -q -w "$tty" "$securetty"; then
|
||||
echo "$tty" >> "$securetty"
|
||||
# we could not find the tty in securetty, so start a getty but warn that root login will not work
|
||||
echo "getty: cmdline has console=$tty but does not exist in $securetty; will not be able to log in as root on this tty $tty." > /dev/$tty
|
||||
fi
|
||||
# respawn forever
|
||||
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
|
||||
@ -49,6 +50,13 @@ if [ -f $ROOTSHADOW ]; then
|
||||
echo >> /etc/shadow
|
||||
fi
|
||||
|
||||
ROOTSTTY=/hostroot/etc/securetty
|
||||
if [ -f $ROOTSTTY ]; then
|
||||
cp $ROOTSTTY /etc/securetty
|
||||
# just in case someone forgot a newline
|
||||
echo >> /etc/securetty
|
||||
fi
|
||||
|
||||
for opt in $(cat /proc/cmdline); do
|
||||
case "$opt" in
|
||||
console=*)
|
||||
|
Loading…
Reference in New Issue
Block a user