Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoke key update, closes #2278 #2279

Merged
merged 2 commits into from
Nov 11, 2024
Merged

invoke key update, closes #2278 #2279

merged 2 commits into from
Nov 11, 2024

Conversation

FloSch62
Copy link
Member

@FloSch62 FloSch62 commented Nov 5, 2024

Closes #2278

I have not found a better solution to keep the gpg keys updated/rotated automatically.
The gpg keys from the current release are valid until 2026, but with PR it ensures older Docker images of the clab-devcontainer can still function correctly even if the GPG key for the GitHub CLI repository has expired. The goal is to make the container update the GPG key as needed without requiring users to rebuild the image or manually intervene, allowing apt update to succeed seamlessly.

By configuring apt to run /usr/local/bin/update-github-cli-key.sh before any update operation, its ensure that the GPG key is refreshed every time apt update is invoked. This happens automatically and does not require any manual intervention from the user.
If the key installed in the image is expired, the script will fetch the latest key from the GitHub servers, updating the keyring so that apt can verify the repository signatures correctly.

@FloSch62 FloSch62 requested a review from hellt November 5, 2024 13:03
@hellt
Copy link
Member

hellt commented Nov 8, 2024

@FloSch62 I am actually thinking "screw this gpg thingy". All the bad things come from security :D
Let's instead curl the latest binary from the releases instead and forget all that nonsense

something like

RUN bash -c 'VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | grep -o "\"tag_name\": \".*\"" | sed -E "s/.*: \"(.*)\"/\1/") && \
    CLEAN_VERSION=${VERSION#v} && \
    DOWNLOAD_URL="https://github.com/cli/cli/releases/download/${VERSION}/gh_${CLEAN_VERSION}_linux_amd64.tar.gz" && \
    curl -L "$DOWNLOAD_URL" | tar xz -C /tmp && \
    mv /tmp/gh_${CLEAN_VERSION}_linux_amd64/bin/gh /usr/local/bin/ && \
    chmod +x /usr/local/bin/gh && \
    rm -rf /tmp/gh_${CLEAN_VERSION}_linux_amd64'

@FloSch62
Copy link
Member Author

@hellt I think you are right, I applied your proposal and tested it.

@hellt
Copy link
Member

hellt commented Nov 11, 2024

thanks @FloSch62

@hellt hellt merged commit aab8d2d into main Nov 11, 2024
20 checks passed
@hellt hellt deleted the fix_devcontainer_2278 branch November 11, 2024 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix GitHub CLI GPG key expiration in older clab-devcontainer releases
2 participants