diff options
author | Mike Crute <mike@crute.us> | 2018-08-19 13:17:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-19 13:17:42 -0700 |
commit | 959968fa54455ca71276d5cef1308d61517576b4 (patch) | |
tree | 99076cebbf3b73c78b5d45e4a33cfea31a540707 | |
parent | 95f7fc2b48177a8a673d5e3dbe016c642a465ded (diff) | |
parent | eaef72fef992e008b854f6a50d40f37c19688fb5 (diff) | |
download | tiny-ec2-bootstrap-959968fa54455ca71276d5cef1308d61517576b4.tar.bz2 tiny-ec2-bootstrap-959968fa54455ca71276d5cef1308d61517576b4.tar.xz tiny-ec2-bootstrap-959968fa54455ca71276d5cef1308d61517576b4.zip |
Merge pull request #2 from tomalok/masterrelease-1.2.0
Disable root/alpine passwords instead scrambling them
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | tiny-ec2-bootstrap | 8 |
2 files changed, 6 insertions, 5 deletions
@@ -14,6 +14,7 @@ built-in. The only required dependencies are: | |||
14 | 14 | ||
15 | - bash-like shell (e.g. bash, dash, ash) | 15 | - bash-like shell (e.g. bash, dash, ash) |
16 | - wget | 16 | - wget |
17 | - resize2fs | ||
17 | 18 | ||
18 | ## Supported Features and Environments | 19 | ## Supported Features and Environments |
19 | 20 | ||
@@ -31,7 +32,7 @@ those things. Instead it supports: | |||
31 | - setting system hostname | 32 | - setting system hostname |
32 | - install user's configured SSH keys to the alpine user's authorized_keys file | 33 | - install user's configured SSH keys to the alpine user's authorized_keys file |
33 | - run any script-like user data (must start with #!) | 34 | - run any script-like user data (must start with #!) |
34 | - scramble root and alpine password | 35 | - disable root and alpine password |
35 | - resize root partition to available disk space | 36 | - resize root partition to available disk space |
36 | 37 | ||
37 | These steps only run once. After the initial bootstrap the bootstrapper script | 38 | These steps only run once. After the initial bootstrap the bootstrapper script |
diff --git a/tiny-ec2-bootstrap b/tiny-ec2-bootstrap index 84f7af2..c03fcd3 100644 --- a/tiny-ec2-bootstrap +++ b/tiny-ec2-bootstrap | |||
@@ -56,8 +56,8 @@ _resize_root_partition() { | |||
56 | resize2fs $(mountpoint -n / | cut -d' ' -f1) | 56 | resize2fs $(mountpoint -n / | cut -d' ' -f1) |
57 | } | 57 | } |
58 | 58 | ||
59 | _scramble_password() { | 59 | _disable_password() { |
60 | echo "$1:$(head -c 100 /dev/urandom | sha512sum | cut -d' ' -f1)" | chpasswd | 60 | echo "$1:*" | chpasswd -e |
61 | } | 61 | } |
62 | 62 | ||
63 | start() { | 63 | start() { |
@@ -66,8 +66,8 @@ start() { | |||
66 | 66 | ||
67 | [ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud | 67 | [ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud |
68 | 68 | ||
69 | ebegin "Scrambling root password"; _scramble_password root; eend $? | 69 | ebegin "Disabling root password"; _disable_password root; eend $? |
70 | ebegin "Scrambling alpine password"; _scramble_password alpine; eend $? | 70 | ebegin "Disabling alpine password"; _disable_password alpine; eend $? |
71 | ebegin "Resizing root partition"; _resize_root_partition; eend $? | 71 | ebegin "Resizing root partition"; _resize_root_partition; eend $? |
72 | ebegin "Setting ec2 hostname"; _update_hostname; eend $? | 72 | ebegin "Setting ec2 hostname"; _update_hostname; eend $? |
73 | ebegin "Setting ec2 user ssh keys"; _set_ssh_keys "alpine"; eend $? | 73 | ebegin "Setting ec2 user ssh keys"; _set_ssh_keys "alpine"; eend $? |