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

Fix GPG Key Import Error #3208

Merged
merged 3 commits into from
Nov 23, 2020
Merged

Fix GPG Key Import Error #3208

merged 3 commits into from
Nov 23, 2020

Conversation

techman83
Copy link
Member

GPG wasn't working with how the private key was being retrieved from however the key was being exposed resulting in nothing being imported.

Run echo -e "$DEBIAN_PRIVATE_KEY" | gpg --batch --import
gpg: directory '/github/home/.gnupg' created
gpg: keybox '/github/home/.gnupg/pubring.kbx' created
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

The base64 encoded export (gpg --export-secret-keys debian@ksp-ckan.space|base64) seems to work just fine.

Run printf "$DEBIAN_PRIVATE_KEY" | base64 --decode | gpg --batch --import
gpg: directory '/github/home/.gnupg' created
gpg: keybox '/github/home/.gnupg/pubring.kbx' created
gpg: /github/home/.gnupg/trustdb.gpg: trustdb created
gpg: key 20338C5DC15BF412: public key "KSP CKAN <debian@ksp-ckan.space>" imported
gpg: key 20338C5DC15BF412: secret key imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg:       secret keys read: 1
gpg:   secret keys imported: 1
/github/home/.gnupg/pubring.kbx
-------------------------------
sec   rsa3072/20338C5DC15BF412 2020-11-19 [SC] [expires: 2022-11-19]
      4A7DA73A1C091FC6AC7FF24120338C5DC15BF412
uid                 [ unknown] KSP CKAN <debian@ksp-ckan.space>
ssb   rsa3072/59167D3E3035FA8B 2020-11-19 [E]

All packages listed in packages.config are already installed.

----------------------------------------
Setup
----------------------------------------

========================================
deb-sign
========================================
gpg --clearsign -o ../_build/deb/apt-repo-dist/InRelease ../_build/deb/apt-repo-dist/Release
gpg -abs -o ../_build/deb/apt-repo-dist/Release.gpg ../_build/deb/apt-repo-dist/Release

----------------------------------------
Teardown
----------------------------------------

I've adjusted the expiry as it probably isn't necessary for this use case.

@techman83 techman83 requested a review from HebaruSan November 23, 2020 07:58
Copy link
Member

@HebaruSan HebaruSan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printf interprets its first argument specially, as a format string, so it will do weird things if our file ever contains a percent sign character. Is there a reason you chose that command?

@techman83
Copy link
Member Author

I was following some posts relating to importing this and it worked. Being a base64 encoded string, a percent sign shall not be an issue.

➜  ~ echo "%cats%"       
%cats%
➜  ~ echo "%cats%"|base64
JWNhdHMlCg==

@HebaruSan
Copy link
Member

Try those commands wtih printf. We should use the command that does what we want, which is echo.

@HebaruSan
Copy link
Member

Or another option is no command at all, with here-strings:

base64 --decode <<<"$DEBIAN_PRIVATE_KEY" | gpg --batch --import

@techman83
Copy link
Member Author

Happy for you to go with whatever seems the neatest, if it doesn't work we can always change it. The no command at all seems pretty good to me.

@HebaruSan HebaruSan merged commit 05c8478 into KSP-CKAN:master Nov 23, 2020
@HebaruSan
Copy link
Member

Works! Just a few loose ends to tie up.

W: Invalid 'Date' entry in Release file /var/lib/apt/lists/ksp-ckan.s3-us-west-2.amazonaws.com_deb_dists_nightly_InRelease
W: Conflicting distribution: https://ksp-ckan.s3-us-west-2.amazonaws.com/deb nightly InRelease (expected nightly but got )
N: Skipping acquire of configured file 'main/binary-amd64/Packages' as repository 'https://ksp-ckan.s3-us-west-2.amazonaws.com/deb nightly InRelease' doesn't support architecture 'amd64'
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://ksp-ckan.s3-us-west-2.amazonaws.com/deb nightly InRelease' doesn't support architecture 'i386'

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.

2 participants