-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-type: patch Signed-off-by: Kyle Harding <kyle@balena.io>
- Loading branch information
Showing
14 changed files
with
79 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/scripts/addusers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -f /var/run/docker.pid | ||
|
||
# # halt the container if dockerd stops | ||
# if [ "$1" -ne 0 ]; then | ||
# echo "$1" >/run/s6-linux-init-container-results/exitcode | ||
# /run/s6/basedir/bin/halt | ||
# fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -f /var/run/sshd.pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
[[ ${VERBOSE:-,,} =~ true|yes|on|1 ]] && set -x | ||
|
||
mkdir -p /run/sshd | ||
|
||
ssh-keygen -A | ||
|
||
# run sshd in the foreground | ||
/usr/sbin/sshd -De \ | ||
-o "LogLevel=${SSHD_LOG_LEVEL:-INFO}" \ | ||
-o PermitRootLogin=no \ | ||
-o PasswordAuthentication=no \ | ||
-o PubkeyAuthentication=yes \ | ||
-o AcceptEnv="LANG LC_*" \ | ||
-o PrintMotd=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
longrun |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
[[ ${VERBOSE:-,,} =~ true|yes|on|1 ]] && set -x | ||
|
||
GH_HANDLES="${GH_HANDLES:-alexgg klutchell jakogut mtoman floion acostach majorz lmbarros}" | ||
|
||
fetch_ssh_keys() { | ||
local _username="${1}" | ||
local _home="${2}" | ||
( | ||
cd "${_home}" || exit 1 | ||
mkdir -p .ssh | ||
curl -fsSL "https://github.com/${_username}.keys" >>.ssh/authorized_keys | ||
chown -R "${_username}:${_username}" .ssh | ||
chmod -R 700 .ssh | ||
) | ||
} | ||
|
||
for username in ${GH_HANDLES:-}; do | ||
home="$(eval echo ~"${username}")" | ||
|
||
if [ -d "${home}" ]; then | ||
# create the user with the same uid as the existing home directory | ||
uid="$(stat -c "%u" "${home}")" | ||
adduser --disabled-password --gecos "${username}" "${username}" --uid "${uid}" | ||
else | ||
# create a new user and home directory | ||
adduser --disabled-password --gecos "${username}" "${username}" | ||
fi | ||
|
||
# add the user to the sudo and docker groups | ||
usermod -aG sudo "${username}" || true | ||
usermod -aG docker "${username}" || true | ||
|
||
# fetch the user's ssh keys from github | ||
fetch_ssh_keys "${username}" "${home}" || true | ||
done |