aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2018-01-28 04:52:01 +0000
committerMike Crute <mike@crute.us>2018-01-28 04:52:01 +0000
commitfe26bc91ff84f86cca6aa8e1c0940ff45c8181b8 (patch)
treee6595b758116844aa5a15d9d87579f8888029e78
parent20513b6595ff1ae1bf0be4d899bfc83806b5f5d4 (diff)
downloadtiny-ec2-bootstrap-fe26bc91ff84f86cca6aa8e1c0940ff45c8181b8.tar.bz2
tiny-ec2-bootstrap-fe26bc91ff84f86cca6aa8e1c0940ff45c8181b8.tar.xz
tiny-ec2-bootstrap-fe26bc91ff84f86cca6aa8e1c0940ff45c8181b8.zip
Scramble root and alpine passwords
-rw-r--r--tiny-ec2-bootstrap6
1 files changed, 6 insertions, 0 deletions
diff --git a/tiny-ec2-bootstrap b/tiny-ec2-bootstrap
index 510f4f7..b0e3ca0 100644
--- a/tiny-ec2-bootstrap
+++ b/tiny-ec2-bootstrap
@@ -52,12 +52,18 @@ _run_userdata() {
52 fi 52 fi
53} 53}
54 54
55_scramble_password() {
56 echo "$1:$(head -c 100 /dev/urandom | sha512sum | cut -d' ' -f1)" | chpasswd
57}
58
55start() { 59start() {
56 # Don't bootstrap if the host has already been bootstrapped 60 # Don't bootstrap if the host has already been bootstrapped
57 [ -f "/var/lib/cloud/.bootstrap-complete" ] && return 0 61 [ -f "/var/lib/cloud/.bootstrap-complete" ] && return 0
58 62
59 [ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud 63 [ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud
60 64
65 ebegin "Scrambling root password"; _scramble_password root; eend $?
66 ebegin "Scrambling alpine password"; _scramble_password alpine; eend $?
61 ebegin "Setting ec2 hostname"; _update_hostname; eend $? 67 ebegin "Setting ec2 hostname"; _update_hostname; eend $?
62 ebegin "Setting ec2 user ssh keys"; _set_ssh_keys "alpine"; eend $? 68 ebegin "Setting ec2 user ssh keys"; _set_ssh_keys "alpine"; eend $?
63 ebegin "Running ec2 user data script"; _run_userdata; eend $? 69 ebegin "Running ec2 user data script"; _run_userdata; eend $?