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

Instance GPG key not recognized if subkey #10309

Closed
2 of 7 tasks
cleverer opened this issue Feb 17, 2020 · 17 comments · Fixed by #11713
Closed
2 of 7 tasks

Instance GPG key not recognized if subkey #10309

cleverer opened this issue Feb 17, 2020 · 17 comments · Fixed by #11713
Labels
type/enhancement An improvement of existing functionality
Milestone

Comments

@cleverer
Copy link
Contributor

  • Gitea version (or commit ref): 1.11.0
  • Git version: 2.17.2
  • Operating system: macOS 10.13.6 (17G11023)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Regarding the new signing functionality introduced in #7631

Gitea only checks for the primary key when checking a commit with gpgSettings:
https://github.com/go-gitea/gitea/blob/master/models/gpg_key.go#L738-L742
If one uses a subkey to sign, this doesn't get recognized in the GUI.

Screenshots

Bildschirmfoto 2020-02-17 um 08 40 17

@lunny
Copy link
Member

lunny commented Feb 17, 2020

@cleverer Could you confirm the old gitea version worked?

@cleverer
Copy link
Contributor Author

That wouldn't make sense, as the possibility of signed merge commits, repository creations etc. was only introduced in 1.11.0.

I'm not talking about a manually signed commit but a commit automatically created and signed from the GUI.

@lunny lunny added the type/enhancement An improvement of existing functionality label Feb 17, 2020
@stale
Copy link

stale bot commented Apr 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Apr 17, 2020
@stale
Copy link

stale bot commented May 1, 2020

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale stale bot closed this as completed May 1, 2020
@cleverer
Copy link
Contributor Author

cleverer commented May 1, 2020

Bad bot. Could a member please reopen this?

Is there anything I can do to help get this resolved?

@lafriks lafriks reopened this May 1, 2020
@stale stale bot removed the issue/stale label May 1, 2020
@b90g
Copy link

b90g commented May 30, 2020

I use subkeys successfully but had issues at the beginning, i had to add the email address of the gpg key also to the account and verify it.

@zeripath
Copy link
Contributor

@b90g can you put an example up on try.gitea.io?

@zeripath
Copy link
Contributor

(I'm currently working on GPG verification again - so if I can get an example I can get this fixed and backported in to 1.12 PDQ.)

@b90g
Copy link

b90g commented May 30, 2020

https://try.gitea.io/klaus/lhmmm/commit/25752a80e3913e1a04a42e140016f79d40d6766e

[email protected]
Key ID: REDACTEDHASH Subkeys: REDACTEDHASH REDCATEDHASH
Added on May 30, 2020 - Valid forever 

feel free to request more interaction (altough a lot of requests fail torwards try.gitea.io from bad gateway to 404..)

Its a completly stripped subkey. ( https://wiki.debian.org/Subkeys )

@cleverer
Copy link
Contributor Author

To clarify, regular git commits signed with a subkey work just fine. However you can set up Gitea so it signs commits done on the web (eg. when merging or creating a new repo).

If you configure your gitea with a subkey the verification fails. If you pull that repository and check locally with the correct public key, everything is fine.

I think the problem lies somewhere here. I think the parsing of the key doesn't work with subkeys somehow. However I'm not too familiar with Go, so I might be wrong…

@zeripath
Copy link
Contributor

Hi!

So that appears to be matching and verifying fine on try

@zeripath
Copy link
Contributor

@cleverer could you give me the commands used to create the subkey so I can try to repeat your problem?

@zeripath
Copy link
Contributor

Ah figured it out!

zeripath added a commit to zeripath/gitea that referenced this issue May 31, 2020
@cleverer
Copy link
Contributor Author

👍 Let me know if you still need the instructions or some help in other form! (I think I originally created the subkeys in GPG Keychain for mac, so not sure about the specific commands right now).

#11713 looks very promising though!

@zeripath
Copy link
Contributor

If you could have a go with it and confirm it fixes your issue that would be good

@cleverer
Copy link
Contributor Author

I can try to get the PR running tomorrow, but I can't promise anything, I haven't set up a gitea dev-environment and am not really familiar with Go (yet).

Thanks a lot for your effort though!

@cleverer
Copy link
Contributor Author

cleverer commented Jun 1, 2020

I can confirm, it works like a charm! Thanks a lot!

techknowlogick added a commit that referenced this issue Jun 3, 2020
* Fix verification of subkeys of default gpg key

Fix #10309

Signed-off-by: Andrew Thornton <[email protected]>

* Remove debug log

* Update models/gpg_key.go

* As per @6543

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue Jun 3, 2020