-
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.
Add ci-storage private key for root user too to allow sudo for ci-sto…
…rage (#27) ## PRs in the Stack - ➡ #27 (The stack is managed by [git-grok](https://github.com/dimikot/git-grok).)
- Loading branch information
Showing
2 changed files
with
9 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
#!/bin/bash | ||
# | ||
# Puts SSH keys into the guest's home directory. | ||
# Puts SSH keys into the guest's and root's home directories. | ||
# | ||
set -u -e | ||
|
||
mkdir -p ~guest/.ssh && chmod 700 ~guest/.ssh | ||
mkdir -p ~root/.ssh && chmod 700 ~root/.ssh | ||
|
||
secret_file=/run/secrets/CI_STORAGE_PRIVATE_KEY | ||
if [[ -f "$secret_file" ]]; then | ||
cat "$secret_file" > ~guest/.ssh/id_rsa | ||
cat "$secret_file" > ~root/.ssh/id_rsa | ||
fi | ||
|
||
chmod 600 ~guest/.ssh/* || true | ||
chown -R guest:guest ~guest/.ssh || true | ||
|
||
chmod 600 ~root/.ssh/* || true | ||
chown -R root:root ~root/.ssh || true |