mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-16 03:42:44 +03:00
make ec2 user configurable
This commit is contained in:
parent
959968fa54
commit
3ceb90d1ff
26
README.md
26
README.md
@ -9,8 +9,8 @@ and cloud platform support for small size and limited external dependencies.
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
The most important feature of this bootstrapper is the very limited set of
|
The most important feature of this bootstrapper is the very limited set of
|
||||||
dependencies. In-fact this works with just busybox provided the wget applet is
|
dependencies. In-fact, this works with just busybox -- provided the wget applet
|
||||||
built-in. The only required dependencies are:
|
is 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
|
||||||
@ -30,15 +30,23 @@ installing packages, and many other things. This bootstrap does not support
|
|||||||
those things. Instead it supports:
|
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
|
- installing the instance's SSH keys in the EC2 user's authorized_keys file
|
||||||
- run any script-like user data (must start with #!)
|
- running any script-like user data (must start with #!)
|
||||||
- disable root and alpine password
|
- disabling root and the EC2 user's password
|
||||||
- resize root partition to available disk space
|
- resizing 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
|
||||||
is a no-op. To force the script to run again at boot time remove the file
|
is a no-op. To force the script to run again at boot time remove the file
|
||||||
`/var/lib/cloud/.bootstrap-complete` and reboot the instance.
|
`/var/lib/cloud/.bootstrap-complete` and reboot the instance.
|
||||||
|
|
||||||
|
The default EC2 user is `alpine`; this can be overriden with a
|
||||||
|
`/etc/conf.d/tiny-ec2-bootstrap` containing...
|
||||||
|
```
|
||||||
|
EC2-USER="otheruser"
|
||||||
|
```
|
||||||
|
The EC2 user *must* already exist in the AMI -- `tiny-ec2-bootstrap` will
|
||||||
|
**NOT** add the user automatically.
|
||||||
|
|
||||||
## User Data
|
## User Data
|
||||||
|
|
||||||
User data is provided at instance boot time and can be any arbitrary string of
|
User data is provided at instance boot time and can be any arbitrary string of
|
||||||
@ -53,7 +61,7 @@ made at the point the script runs.
|
|||||||
|
|
||||||
## Assumptions
|
## Assumptions
|
||||||
|
|
||||||
- This was written for Alpine Linux and thus assumes that the login user is
|
- This was written for Alpine Linux; use on other distributions has not been
|
||||||
called alpine. This could be configurable in the future but currently is not.
|
tested.
|
||||||
|
|
||||||
- The script is run by OpenRC
|
- The script is run by OpenRC.
|
||||||
|
|||||||
@ -64,13 +64,17 @@ start() {
|
|||||||
# Don't bootstrap if the host has already been bootstrapped
|
# Don't bootstrap if the host has already been bootstrapped
|
||||||
[ -f "/var/lib/cloud/.bootstrap-complete" ] && return 0
|
[ -f "/var/lib/cloud/.bootstrap-complete" ] && return 0
|
||||||
|
|
||||||
|
# load configuration, set defaults
|
||||||
|
[ -f "/etc/conf.d/tiny-ec2-bootstrap" ] && . /etc/conf.d/tiny-ec2-bootstrap
|
||||||
|
EC2_USER=${EC2_USER:-alpine}
|
||||||
|
|
||||||
[ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud
|
[ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud
|
||||||
|
|
||||||
ebegin "Disabling root password"; _disable_password root; eend $?
|
ebegin "Disabling root password"; _disable_password root; eend $?
|
||||||
ebegin "Disabling alpine password"; _disable_password alpine; eend $?
|
ebegin "Disabling $EC2_USER password"; _disable_password "$EC2_USER"; 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 "$EC2_USER"; eend $?
|
||||||
ebegin "Running ec2 user data script"; _run_userdata; eend $?
|
ebegin "Running ec2 user data script"; _run_userdata; eend $?
|
||||||
|
|
||||||
touch "/var/lib/cloud/.bootstrap-complete"
|
touch "/var/lib/cloud/.bootstrap-complete"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user