Generate a random initial password for the image
Fixed default passwords should be avoided
This commit is contained in:
parent
699c77122a
commit
0cb73cc095
|
@ -37,7 +37,7 @@ VMDEBOOTSTRAP_VERSION=0.8
|
||||||
MAKEFILE=${PROJECT_NAME}-image-makefile
|
MAKEFILE=${PROJECT_NAME}-image-makefile
|
||||||
|
|
||||||
USERNAME=$(echo $USER)
|
USERNAME=$(echo $USER)
|
||||||
PASSWORD="${PROJECT_NAME}"
|
PASSWORD=
|
||||||
|
|
||||||
# IP address of the router (gateway)
|
# IP address of the router (gateway)
|
||||||
ROUTER_IP_ADDRESS="192.168.1.254"
|
ROUTER_IP_ADDRESS="192.168.1.254"
|
||||||
|
@ -52,6 +52,8 @@ NAMESERVER2='85.214.20.141'
|
||||||
# An optional freedombone configuration file
|
# An optional freedombone configuration file
|
||||||
CONFIG_FILENAME=
|
CONFIG_FILENAME=
|
||||||
|
|
||||||
|
DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local"
|
||||||
|
|
||||||
while [[ $# > 1 ]]
|
while [[ $# > 1 ]]
|
||||||
do
|
do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
@ -63,6 +65,11 @@ case $key in
|
||||||
-c|--config)
|
-c|--config)
|
||||||
shift
|
shift
|
||||||
CONFIG_FILENAME="$1"
|
CONFIG_FILENAME="$1"
|
||||||
|
if [ ! -f $CONFIG_FILENAME ]; then
|
||||||
|
echo "Config file $CONFIG_FILENAME not found"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
DEFAULT_DOMAIN_NAME=$(cat $CONFIG_FILENAME | grep 'DEFAULT_DOMAIN_NAME' | awk -F '=' '{print $2}')
|
||||||
;;
|
;;
|
||||||
-t|--target|--board)
|
-t|--target|--board)
|
||||||
shift
|
shift
|
||||||
|
@ -103,7 +110,10 @@ esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ ! $PASSWORD ]; then
|
||||||
|
# generate a random password
|
||||||
|
PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
|
||||||
|
fi
|
||||||
|
|
||||||
rm $CURR_DIR/*.img.bz2
|
rm $CURR_DIR/*.img.bz2
|
||||||
rm $CURR_DIR/*.img
|
rm $CURR_DIR/*.img
|
||||||
|
@ -162,9 +172,20 @@ mv build/${PROJECT_NAME}*.sig $CURR_DIR
|
||||||
rm -rf $BUILD_DIR
|
rm -rf $BUILD_DIR
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo '
|
echo "
|
||||||
Image was created
|
Image was created.
|
||||||
'
|
|
||||||
|
You will be able to log into it with:
|
||||||
|
|
||||||
|
ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p 2222
|
||||||
|
|
||||||
|
Password: $PASSWORD
|
||||||
|
"
|
||||||
ls -lh ${PROJECT_NAME}*.img ${PROJECT_NAME}*.sig ${PROJECT_NAME}*.bz2
|
ls -lh ${PROJECT_NAME}*.img ${PROJECT_NAME}*.sig ${PROJECT_NAME}*.bz2
|
||||||
|
|
||||||
|
# record the default login credentials for later use
|
||||||
|
echo "Username: $USERNAME
|
||||||
|
Password: $PASSWORD" > ${PROJECT_NAME}_login_credentials.txt
|
||||||
|
chmod 600 ${PROJECT_NAME}_login_credentials.txt
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue