mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-15 11:22:43 +03:00
Merge pull request #2 from tomalok/master
Disable root/alpine passwords instead scrambling them
This commit is contained in:
commit
959968fa54
@ -14,6 +14,7 @@ built-in. The only required dependencies are:
|
||||
|
||||
- bash-like shell (e.g. bash, dash, ash)
|
||||
- wget
|
||||
- resize2fs
|
||||
|
||||
## Supported Features and Environments
|
||||
|
||||
@ -31,7 +32,7 @@ those things. Instead it supports:
|
||||
- setting system hostname
|
||||
- install user's configured SSH keys to the alpine user's authorized_keys file
|
||||
- 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
|
||||
|
||||
These steps only run once. After the initial bootstrap the bootstrapper script
|
||||
|
||||
@ -56,8 +56,8 @@ _resize_root_partition() {
|
||||
resize2fs $(mountpoint -n / | cut -d' ' -f1)
|
||||
}
|
||||
|
||||
_scramble_password() {
|
||||
echo "$1:$(head -c 100 /dev/urandom | sha512sum | cut -d' ' -f1)" | chpasswd
|
||||
_disable_password() {
|
||||
echo "$1:*" | chpasswd -e
|
||||
}
|
||||
|
||||
start() {
|
||||
@ -66,8 +66,8 @@ start() {
|
||||
|
||||
[ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud
|
||||
|
||||
ebegin "Scrambling root password"; _scramble_password root; eend $?
|
||||
ebegin "Scrambling alpine password"; _scramble_password alpine; eend $?
|
||||
ebegin "Disabling root password"; _disable_password root; eend $?
|
||||
ebegin "Disabling alpine password"; _disable_password alpine; eend $?
|
||||
ebegin "Resizing root partition"; _resize_root_partition; eend $?
|
||||
ebegin "Setting ec2 hostname"; _update_hostname; eend $?
|
||||
ebegin "Setting ec2 user ssh keys"; _set_ssh_keys "alpine"; eend $?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user