mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 21:16:57 +02:00
The default is --standard_backdoor, which installs well-known ssh keys and sets a well-known root password. Passing --nostandard_backdoor will cause mod_image_for_test to use ssh keys from ~/.ssh/*.pub instead of the test keys and not set the root password. BUG=chromium-os:11744 TEST=Adhoc Build an image with --standard_backdoor. ssh -i ${SRC}/src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa root@${DUT} ssh root@${DUT} with 'test0000' cat /root/.ssh/authorized_keys # check for the test key Build an image with --nostandard_backdoor. ssh -o PubkeyAuthentication=no root@${DUT} # this will fail ssh root@${DUT} # this should work cat /root/.ssh/authorized_keys # check for just your keys Change-Id: Ie92fbc9d3815f478698c8c94d938daca2b5cd53e Signed-off-by: Elly Jones <ellyjones@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/3449 Reviewed-by: David Rochberg <rochberg@chromium.org>
26 lines
838 B
Bash
Executable File
26 lines
838 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
#
|
|
# Copy public keys to root's homedir for ssh pubkey auth, which
|
|
# is necessary for test automation.
|
|
|
|
echo "Copying public keys and changing PATH for ssh clients"
|
|
|
|
if [ "$BACKDOOR" -eq 1 ]; then
|
|
KEYS_DIR=${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys
|
|
else
|
|
KEYS_DIR=${GCLIENT_ROOT}/../.ssh
|
|
fi
|
|
|
|
mkdir -p ${ROOT_FS_DIR}/root/.ssh
|
|
ROOT_AUTHKEYS=${ROOT_FS_DIR}/root/.ssh/authorized_keys
|
|
cat ${KEYS_DIR}/*.pub >> ${ROOT_AUTHKEYS}
|
|
|
|
# Environment on test machines for su and ssh now set to include
|
|
touch ${ROOT_FS_DIR}/etc/environment
|
|
echo "PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" \
|
|
>> "${ROOT_FS_DIR}/etc/environment"
|