1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-16 03:42:44 +03:00

Merge pull request #2 from tomalok/master

Disable root/alpine passwords instead scrambling them
This commit is contained in:
Mike Crute 2018-08-19 13:17:42 -07:00 committed by GitHub
commit 959968fa54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -14,6 +14,7 @@ built-in. The only required dependencies are:
- bash-like shell (e.g. bash, dash, ash) - bash-like shell (e.g. bash, dash, ash)
- wget - wget
- resize2fs
## Supported Features and Environments ## Supported Features and Environments
@ -31,7 +32,7 @@ those things. Instead it supports:
- setting system hostname - setting system hostname
- install user's configured SSH keys to the alpine user's authorized_keys file - install user's configured SSH keys to the alpine user's authorized_keys file
- run any script-like user data (must start with #!) - run any script-like user data (must start with #!)
- scramble root and alpine password - disable root and alpine password
- resize root partition to available disk space - resize root partition to available disk space
These steps only run once. After the initial bootstrap the bootstrapper script These steps only run once. After the initial bootstrap the bootstrapper script

View File

@ -56,8 +56,8 @@ _resize_root_partition() {
resize2fs $(mountpoint -n / | cut -d' ' -f1) resize2fs $(mountpoint -n / | cut -d' ' -f1)
} }
_scramble_password() { _disable_password() {
echo "$1:$(head -c 100 /dev/urandom | sha512sum | cut -d' ' -f1)" | chpasswd echo "$1:*" | chpasswd -e
} }
start() { start() {
@ -66,8 +66,8 @@ start() {
[ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud [ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud
ebegin "Scrambling root password"; _scramble_password root; eend $? ebegin "Disabling root password"; _disable_password root; eend $?
ebegin "Scrambling alpine password"; _scramble_password alpine; eend $? ebegin "Disabling alpine password"; _disable_password alpine; eend $?
ebegin "Resizing root partition"; _resize_root_partition; eend $? ebegin "Resizing root partition"; _resize_root_partition; eend $?
ebegin "Setting ec2 hostname"; _update_hostname; eend $? ebegin "Setting ec2 hostname"; _update_hostname; eend $?
ebegin "Setting ec2 user ssh keys"; _set_ssh_keys "alpine"; eend $? ebegin "Setting ec2 user ssh keys"; _set_ssh_keys "alpine"; eend $?