Skip to content

Commit

Permalink
Update SSH keys
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddyGuthridge committed Aug 3, 2024
1 parent dda6ca2 commit c4d0f02
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/secrets/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
id_ed25519
# Just in case
id_ed25519.new
19 changes: 14 additions & 5 deletions .github/workflows/secrets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,24 @@ The test suite should then be able to clone and push to the repo in CI.
```sh
# Generate SSH key
ssh-keygen -t ed25519 -f .github/workflows/secrets/id_ed25519 -C "maddy-portfolio" -N ""
# Generate encryption password (copy this output)
pwgen 32 1
# Generate encryption password
export PASSWORD=$(pwgen 32 1)
# And encrypt it
openssl aes-256-cbc -in .github/workflows/secrets/id_ed25519 -out .github/workflows/secrets/id_ed25519.enc -pbkdf2
gpg --passphrase $PASSWORD --cipher-algo AES256 --output .github/workflows/secrets/id_ed25519.enc --symmetric --batch .github/workflows/secrets/id_ed25519C
# Copy the password to your clipboard
echo $PASSWORD
```

Make sure to update the `SSH_ENCRYPTION_KEY` in the repo's GitHub Actions
secrets settings. Its value should be set to the password you copied.

### How it works
### Decrypting the key

See [this answer on StackOverflow](https://stackoverflow.com/a/76888551/6335363).
```sh
gpg --batch --passphrase $PASSWORD --output .github/workflows/secrets/id_ed25519.new --decrypt .github/workflows/secrets/id_ed25519.enc
```

### Sources

* [GitHub actions](https://stackoverflow.com/a/76888551/6335363)
* [Encrypting the keys](https://stackoverflow.com/a/31552829/6335363)
Binary file modified .github/workflows/secrets/id_ed25519.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/secrets/id_ed25519.pub
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJJQA8Rn6wgF5t2pBTAaMZkMhj5ur8ecq67k5JpriAPK maddy-portfolio
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHOIa0tsZl13SrOUC73Krg/UJlBJjlgO3b3PlWujcfW+ maddy-portfolio

0 comments on commit c4d0f02

Please sign in to comment.