Add debug-user element

This adds an element that can be used to set up a separate user for
in the appliance for debugging purposes.

Change-Id: I46777b785f8575acdc50ee19c059b08b89bfed98
This commit is contained in:
Adam Gandelman 2015-05-22 16:30:50 -07:00
parent e41b74ae9a
commit 7fbd58f476
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,10 @@
Creates a sudo privileged user in the appliance VM that can be used for
debugging connectivity issues via the console, when SSH connectivity is
not possible. Note that an 'akanda' user is created by the RUG and setup
to authenticate using a SSH public key. This element should only be included
when building images for develoment environments.
The username and password can be set in the build environment as
$DIB_AKANDA_APPLIANCE_DEBUG_USER and $DIB_AKANDA_APPLIANCE_DEBUG_PASSWORD
The defaults are akanda-debug/akanda.

View File

@ -0,0 +1,21 @@
#!/bin/bash
DIB_AKANDA_APPLIANCE_DEBUG_USER=${DIB_AKANDA_APPLIANCE_DEBUG_USER:-akanda-debug}
DIB_AKANDA_APPLIANCE_DEBUG_PASSWORD=${DIB_AKANDA_APPLIANCE_DEBUG_PASSWORD:-akanda}
set -eu
set -o xtrace
useradd -m $DIB_AKANDA_APPLIANCE_DEBUG_USER -s /bin/bash
passwd $DIB_AKANDA_APPLIANCE_DEBUG_USER <<EOF
$DIB_AKANDA_APPLIANCE_DEBUG_PASSWORD
$DIB_AKANDA_APPLIANCE_DEBUG_PASSWORD
EOF
cat > /etc/sudoers.d/akanda-debug-user <<eof
$DIB_AKANDA_APPLIANCE_DEBUG_USER ALL=(ALL) NOPASSWD:ALL
eof
chmod 0440 /etc/sudoers.d/akanda-debug-user
visudo -c