Release: harden multiline secret handling
Modular container CI / release-build (push) Has been cancelled
Modular container CI / release-build (push) Has been cancelled
This commit is contained in:
9 files changed
+133
-56
No files matched your search
+23
-12
@@ -37,12 +37,12 @@ through that container's Docker mount table. The release wrapper and
|
||||
control-plane tests both use it because bind mount paths passed to the socket
|
||||
are resolved by the runner host daemon, not inside the Actions job container.
|
||||
|
||||
The SSH checkout steps and `scripts/lib/component-ssh.sh` pin the current
|
||||
The shared `scripts/lib/component-ssh.sh` helper pins the current
|
||||
`git.faumaray.ru` RSA host key. Its verified fingerprint is
|
||||
`SHA256:fugBYnqAnqmTLsGpafVgQF9gPQzJqps7uHvs48blg2A`. If the Gitea SSH host key
|
||||
is intentionally rotated, verify the new fingerprint through an independent
|
||||
administrator channel and update `ssh-known-hosts` in all three workflows plus
|
||||
the shared helper. Component Git commands use `BatchMode=yes` and strict host
|
||||
administrator channel and update the shared helper. Component Git commands use
|
||||
`BatchMode=yes` and strict host
|
||||
checking, so missing credentials or a changed host key fail instead of waiting
|
||||
for interactive runner input. Never work around a rotation by disabling strict
|
||||
host-key checking.
|
||||
@@ -57,16 +57,25 @@ workflow. A global runner such as the default installation shown in Gitea must
|
||||
only serve repositories you trust: a workflow with Docker-daemon access can
|
||||
control the runner host.
|
||||
|
||||
Enable Actions and add these repository secrets:
|
||||
Enable Actions and configure these secrets:
|
||||
|
||||
| Secret | Purpose |
|
||||
| --- | --- |
|
||||
| `RELEASE_CHECKOUT_SSH_KEY` | Release-bot SSH key used to read every private component/dependency repository and to fast-forward the protected Echoion `release-feed` branch. |
|
||||
| `RELEASE_BOT_TOKEN` | PAT owned by a dedicated bot. It needs repository write scope for component releases and package write scope for the public organization registry. It does not need `release-feed` write access. |
|
||||
| `RELEASE_TAG_ALLOWED_SIGNERS` | Complete OpenSSH `allowed_signers` lines for maintainers allowed to publish `v*` tags. |
|
||||
| `RELEASE_FEED_ED25519_PUBLIC_KEY` | PEM public key matching the component-feed signing key. It verifies independently published components without exposing signing authority to the product workflow. |
|
||||
| Secret | Scope | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `RELEASE_CHECKOUT_SSH_KEY` | `Void` organization | Single-line base64 of the release-bot OpenSSH private key used to read every private component/dependency repository and to fast-forward the protected Echoion `release-feed` branch. |
|
||||
| `RELEASE_BOT_TOKEN` | `Void` organization | PAT owned by a dedicated bot. It needs repository write scope for component releases and package write scope for the public organization registry. It does not need `release-feed` write access. |
|
||||
| `RELEASE_TAG_ALLOWED_SIGNERS` | `Void` organization | Complete OpenSSH `allowed_signers` lines for maintainers allowed to publish `v*` tags. |
|
||||
| `RELEASE_FEED_ED25519_PRIVATE_KEY` | `Void` organization | Single-line base64 of the Ed25519 PEM private key that signs component feeds. |
|
||||
| `RELEASE_FEED_GIT_SIGNING_KEY` | `Void` organization | Single-line base64 of the OpenSSH private key that signs `release-feed` commits. |
|
||||
| `RELEASE_FEED_ED25519_PUBLIC_KEY` | Echoion repository | PEM public key matching the component-feed signing key. It verifies independently published components without exposing signing authority to the product workflow. |
|
||||
|
||||
Root product checkouts use pinned SSH with `persist-credentials: false`.
|
||||
Encode multiline private keys with `base64 -w0` before storing them. This is a
|
||||
security requirement: the release scripts reject raw multiline private keys so
|
||||
runner environment diagnostics cannot disclose them. Keep the public
|
||||
`RELEASE_TAG_ALLOWED_SIGNERS` and `RELEASE_FEED_ED25519_PUBLIC_KEY` values in
|
||||
their documented text formats.
|
||||
|
||||
Root product checkouts use the public repository over HTTPS with
|
||||
`persist-credentials: false`.
|
||||
Independent workflows check out their current repository with Gitea's job
|
||||
token and the public Echoion release tools over HTTPS; their private
|
||||
component/dependency reads and `release-feed` push use the pinned SSH helper.
|
||||
@@ -212,7 +221,9 @@ signing run as urgent.
|
||||
## Feed key custody and rotation
|
||||
|
||||
The active component-feed public key id is
|
||||
`echoion-component-release-2026-07-30`. The older
|
||||
`echoion-component-release-2026-07-30-r2`. The superseded
|
||||
`echoion-component-release-2026-07-30` key is intentionally absent because its
|
||||
private material was revoked before any feed publication. The older
|
||||
`echoion-component-release-2026-07` and `echoion-release-2026-07` keys remain
|
||||
embedded for compatibility. To rotate,
|
||||
generate the private key on a trusted operator machine:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"ed25519": "vUZXQXNkY/f/D42z6/dYK8SNxCvXjxYQ8ZCpjecIclk="
|
||||
},
|
||||
{
|
||||
"id": "echoion-component-release-2026-07-30",
|
||||
"ed25519": "ZPRktsjik0zKyxPj1/TZT0CdLU1TIgxVPehTyGDNz1E="
|
||||
"id": "echoion-component-release-2026-07-30-r2",
|
||||
"ed25519": "0ioZyP3v38st9qShLG9+gvdM8xd8AgO7UNaP5eeHflk="
|
||||
}
|
||||
]
|
||||
@@ -22,14 +22,10 @@ jobs:
|
||||
docker version
|
||||
docker info
|
||||
|
||||
- name: Check out root over SSH
|
||||
- name: Check out public root
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
ssh-user: gitea
|
||||
ssh-known-hosts: >-
|
||||
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
|
||||
persist-credentials: false
|
||||
|
||||
- name: Verify source-free root and resolve every lock over SSH
|
||||
@@ -69,6 +65,7 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash scripts/tests/test-gitea-tag-verification.sh
|
||||
bash scripts/tests/test-component-ssh-secrets.sh
|
||||
. scripts/lib/docker-daemon-path.sh
|
||||
docker_workspace=$(docker_daemon_path "$PWD")
|
||||
for test_script in \
|
||||
|
||||
@@ -25,15 +25,11 @@ jobs:
|
||||
docker version
|
||||
docker info
|
||||
|
||||
- name: Check out signed main over SSH
|
||||
- name: Check out public signed main
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
ssh-user: gitea
|
||||
ssh-known-hosts: >-
|
||||
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
|
||||
persist-credentials: false
|
||||
|
||||
- name: Verify root cutover and check out locked components over SSH
|
||||
|
||||
@@ -25,15 +25,11 @@ jobs:
|
||||
docker version
|
||||
docker info
|
||||
|
||||
- name: Check out the signed root tag over SSH
|
||||
- name: Check out the public signed root tag
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
ref: ${{ gitea.ref }}
|
||||
fetch-depth: 0
|
||||
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
ssh-user: gitea
|
||||
ssh-known-hosts: >-
|
||||
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
|
||||
persist-credentials: false
|
||||
|
||||
- name: Reject embedded component sources and gitlinks
|
||||
@@ -84,10 +80,17 @@ jobs:
|
||||
test "$EXPECTED_REF_TYPE" = tag
|
||||
test "$EXPECTED_REF" = "refs/tags/$TAG"
|
||||
allowed_signers="$RUNNER_TEMP/echoion-release-allowed-signers"
|
||||
trap 'rm -f -- "$allowed_signers"' EXIT
|
||||
tag_credentials="$RUNNER_TEMP/echoion-release-tag-ssh"
|
||||
trap 'rm -rf -- "$tag_credentials"; rm -f -- "$allowed_signers"' EXIT
|
||||
umask 077
|
||||
printf '%s\n' "$TAG_ALLOWED_SIGNERS" >"$allowed_signers"
|
||||
test -s "$allowed_signers"
|
||||
. scripts/lib/component-ssh.sh
|
||||
echoion_configure_component_ssh \
|
||||
"$tag_credentials" "$ECHOION_COMPONENT_SSH_KEY"
|
||||
scripts/restore-gitea-release-tag.sh \
|
||||
--repository "ssh://gitea@git.faumaray.ru/$REPOSITORY.git" \
|
||||
--tag "$TAG"
|
||||
target_commit=$(
|
||||
scripts/verify-gitea-release-tag.sh \
|
||||
--tag "$TAG" \
|
||||
@@ -147,16 +150,19 @@ jobs:
|
||||
printf 'RELEASE_FEED_URL=%s\n' "$feed_url"
|
||||
} >>"$GITHUB_ENV"
|
||||
|
||||
- name: Check out the protected release-feed branch over SSH
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
ref: release-feed
|
||||
path: feed-state
|
||||
fetch-depth: 0
|
||||
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
ssh-user: gitea
|
||||
ssh-known-hosts: >-
|
||||
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
|
||||
- name: Check out the protected release-feed branch
|
||||
shell: bash
|
||||
env:
|
||||
ECHOION_COMPONENT_SSH_KEY: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
feed_credentials="$RUNNER_TEMP/echoion-release-feed-ssh"
|
||||
trap 'rm -rf -- "$feed_credentials"' EXIT
|
||||
. scripts/lib/component-ssh.sh
|
||||
echoion_configure_component_ssh \
|
||||
"$feed_credentials" "$ECHOION_COMPONENT_SSH_KEY"
|
||||
git clone --filter=blob:none --branch release-feed --single-branch \
|
||||
ssh://gitea@git.faumaray.ru/Void/Echoion.git feed-state
|
||||
|
||||
- name: Verify every locked component was independently published
|
||||
shell: bash
|
||||
|
||||
@@ -75,18 +75,23 @@ The following Gitea Actions variables are required:
|
||||
- `COMPONENT_OBJECT_STORAGE_PREFIX`, normally `components`, for S3
|
||||
- `COMPONENT_OBJECT_STORAGE_REGION` for S3
|
||||
|
||||
The following secrets are required in each component repository:
|
||||
The following secrets are required once at the `Void` organization level and
|
||||
are inherited by every component release workflow:
|
||||
|
||||
- `RELEASE_CHECKOUT_SSH_KEY` (read access to every private component and
|
||||
dependency repository, plus write access to Echoion's protected
|
||||
`release-feed` branch)
|
||||
- `RELEASE_CHECKOUT_SSH_KEY` (single-line base64 of an OpenSSH private key with
|
||||
read access to every private component and dependency repository, plus write
|
||||
access to Echoion's protected `release-feed` branch)
|
||||
- `RELEASE_TAG_ALLOWED_SIGNERS`
|
||||
- `RELEASE_BOT_TOKEN`
|
||||
- `RELEASE_FEED_ED25519_PRIVATE_KEY`
|
||||
- `RELEASE_FEED_GIT_SIGNING_KEY`
|
||||
- `RELEASE_FEED_ED25519_PRIVATE_KEY` (single-line base64 of the PEM private key)
|
||||
- `RELEASE_FEED_GIT_SIGNING_KEY` (single-line base64 of the OpenSSH private key)
|
||||
- `COMPONENT_OBJECT_STORAGE_ACCESS_KEY` only for S3
|
||||
- `COMPONENT_OBJECT_STORAGE_SECRET_KEY` only for S3
|
||||
|
||||
Create single-line private-key values with `base64 -w0`. Raw multiline private
|
||||
keys are deliberately rejected because some runner versions expose multiline
|
||||
environment values in job diagnostics.
|
||||
|
||||
The Echoion product repository needs only
|
||||
`RELEASE_FEED_ED25519_PUBLIC_KEY` for feed verification. It must not receive
|
||||
the component-feed private key.
|
||||
|
||||
@@ -6,26 +6,48 @@
|
||||
# verifying the replacement server fingerprint.
|
||||
readonly ECHOION_GITEA_SSH_RSA_HOST_KEY='git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw=='
|
||||
|
||||
echoion_decode_base64_secret() {
|
||||
if (($# != 2)); then
|
||||
echo "usage: echoion_decode_base64_secret BASE64 OUTPUT" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
local encoded=$1
|
||||
local output=$2
|
||||
if [[ -z $encoded || $encoded == *[!A-Za-z0-9+/=]* ]]; then
|
||||
echo "release secret is not single-line base64" >&2
|
||||
return 2
|
||||
fi
|
||||
if ! printf '%s' "$encoded" | base64 --decode >"$output"; then
|
||||
rm -f -- "$output"
|
||||
echo "release secret is not valid base64" >&2
|
||||
return 2
|
||||
fi
|
||||
if [[ ! -s $output ]]; then
|
||||
rm -f -- "$output"
|
||||
echo "decoded release secret is empty" >&2
|
||||
return 2
|
||||
fi
|
||||
chmod 0600 "$output"
|
||||
}
|
||||
|
||||
echoion_configure_component_ssh() {
|
||||
if (($# != 2)); then
|
||||
echo "usage: echoion_configure_component_ssh CREDENTIAL_DIR PRIVATE_KEY" >&2
|
||||
echo "usage: echoion_configure_component_ssh CREDENTIAL_DIR PRIVATE_KEY_BASE64" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
local credential_dir=$1
|
||||
local private_key=$2
|
||||
if [[ -z $private_key ]]; then
|
||||
echo "component SSH private key is empty" >&2
|
||||
return 2
|
||||
fi
|
||||
local private_key_base64=$2
|
||||
|
||||
local ssh_key="$credential_dir/component-ssh-key"
|
||||
local known_hosts="$credential_dir/component-known-hosts"
|
||||
mkdir -p -- "$credential_dir"
|
||||
chmod 0700 "$credential_dir"
|
||||
printf '%s\n' "$private_key" >"$ssh_key"
|
||||
echoion_decode_base64_secret "$private_key_base64" "$ssh_key"
|
||||
printf '%s\n' "$ECHOION_GITEA_SSH_RSA_HOST_KEY" >"$known_hosts"
|
||||
chmod 0600 "$ssh_key" "$known_hosts"
|
||||
chmod 0600 "$known_hosts"
|
||||
ssh-keygen -y -f "$ssh_key" >/dev/null
|
||||
|
||||
printf -v GIT_SSH_COMMAND \
|
||||
'ssh -i %q -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=%q' \
|
||||
|
||||
@@ -16,6 +16,7 @@ configuration=$(realpath -- "$1")
|
||||
source "$script_dir/lib/component-ssh.sh"
|
||||
|
||||
required_commands=(
|
||||
base64
|
||||
cmake
|
||||
cmp
|
||||
ctest
|
||||
@@ -28,6 +29,7 @@ required_commands=(
|
||||
python3
|
||||
realpath
|
||||
ssh
|
||||
ssh-keygen
|
||||
zstd
|
||||
)
|
||||
for command_name in "${required_commands[@]}"; do
|
||||
@@ -134,8 +136,8 @@ umask 077
|
||||
feed_key="$secrets_dir/feed-ed25519.pem"
|
||||
commit_key="$secrets_dir/feed-commit-key"
|
||||
allowed_signers="$secrets_dir/tag-allowed-signers"
|
||||
printf '%s\n' "$ECHOION_FEED_PRIVATE_KEY" >"$feed_key"
|
||||
printf '%s\n' "$ECHOION_FEED_COMMIT_SIGNING_KEY" >"$commit_key"
|
||||
echoion_decode_base64_secret "$ECHOION_FEED_PRIVATE_KEY" "$feed_key"
|
||||
echoion_decode_base64_secret "$ECHOION_FEED_COMMIT_SIGNING_KEY" "$commit_key"
|
||||
printf '%s\n' "$ECHOION_RELEASE_TAG_ALLOWED_SIGNERS" >"$allowed_signers"
|
||||
chmod 0600 "$feed_key" "$commit_key" "$allowed_signers"
|
||||
echoion_configure_component_ssh \
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)
|
||||
# shellcheck source=scripts/lib/component-ssh.sh
|
||||
source "$root/scripts/lib/component-ssh.sh"
|
||||
|
||||
temporary=$(mktemp -d)
|
||||
trap 'rm -rf -- "$temporary"' EXIT
|
||||
|
||||
ssh-keygen -q -t ed25519 -N '' -f "$temporary/source-key"
|
||||
encoded=$(base64 -w0 "$temporary/source-key")
|
||||
|
||||
echoion_decode_base64_secret "$encoded" "$temporary/decoded-key"
|
||||
cmp -- "$temporary/source-key" "$temporary/decoded-key"
|
||||
|
||||
echoion_configure_component_ssh "$temporary/credentials" "$encoded"
|
||||
expected_public=$(ssh-keygen -y -f "$temporary/source-key")
|
||||
actual_public=$(ssh-keygen -y -f "$temporary/credentials/component-ssh-key")
|
||||
test "$actual_public" = "$expected_public"
|
||||
test -n "$GIT_SSH_COMMAND"
|
||||
|
||||
if echoion_decode_base64_secret \
|
||||
"$(<"$temporary/source-key")" "$temporary/rejected-raw-key" \
|
||||
>/dev/null 2>&1
|
||||
then
|
||||
echo "raw multiline private key was accepted" >&2
|
||||
exit 1
|
||||
fi
|
||||
if echoion_decode_base64_secret 'not-base64!' "$temporary/rejected-invalid-key" \
|
||||
>/dev/null 2>&1
|
||||
then
|
||||
echo "invalid base64 private key was accepted" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "component SSH secret encoding tests passed"
|
||||
Reference in new issue
Block a user