eclipse-equinox / p2

Eclipse Public License 2.0
14 stars 41 forks source link

Documentation about pgp signing of Eclipse plugins #32

Open iloveeclipse opened 2 years ago

iloveeclipse commented 2 years ago

Follow up on my questions in https://www.eclipse.org/lists/p2-dev/msg05945.html.

Initial issue is https://github.com/spotbugs/spotbugs/issues/2008.

As a small open source progect spotbugs doesn't have resources to provide valid certificates for signing plugins, so we are looking for documentation how we could sign Eclipse plugins with pgp.

It seems there is no documentation available, and various pointers given aren't complete or enough for 3rd party developers. The best source so far is the following bug from Ed : https://gitlab.eclipse.org/eclipse-wg/ide-wg/eclipseide.org/-/issues/11.

Would be great to have an official Eclipse help article (shipped with SDK) which explains step by step following :

merks commented 2 years ago

My sense is that installing PGP content into any < Eclipse 4.23 is rather problematic.

To do PGP signing, you'll need gpg installed. I use the one that came with git. I expect every build server has that too.

Not that I'm suggesting it's a better way, but it's possible to generate a self-signed x509 certificate and just use that too. I tried that with these instructions:

https://lists.gnupg.org/pipermail/gnupg-devel/2011-March/025989.html

The user will be prompted to approve such an "unrooted" certificate in the same way as is the case for a PGP key, and even in the same dialog. On the plus side, this works on all versions of Eclipse and you can keep doing the build how you are doing it now.

If you don't use Tycho, you'll have to do stuff like this to create the *.asc files:

https://www.benmccann.com/creating-asc-signature-files-with-gpg/

And you'll need to get the key and signature properties into the artifacts.xml like in this example:

https://github.com/eclipse/tycho/issues/872

    <artifact classifier="osgi.bundle" id="org.objectweb.asm" version="9.3.0">
      <properties size="12">
        <property name="maven-groupId" value="org.ow2.asm"/>
        <property name="maven-artifactId" value="asm"/>
        <property name="maven-version" value="9.3"/>
        <property name="maven-repository" value="central"/>
        <property name="maven-type" value="jar"/>
        <property name="download.size" value="122176"/>
        <property name="artifact.size" value="122176"/>
        <property name="download.md5" value="e1c3b96035117ab516ffe0de9bd696e0"/>
        <property name="download.checksum.md5" value="e1c3b96035117ab516ffe0de9bd696e0"/>
        <property name="download.checksum.sha-256" value="1263369b59e29c943918de11d6d6152e2ec6085ce63e5710516f8c67d368e4bc"/>
        <property name="pgp.signatures" value="-----BEGIN PGP SIGNATURE-----&#10;&#10;iQGzBAABCAAdFiEEXONvkY2X+4JrdhoCGmZnOeZvPwcFAmJSsl8ACgkQGmZnOeZv&#10;Pwe+ZAwApzYOMaSL+2Y6O4mF8x/Kw32KTxKtg/4AGpwQEnW3LGAXVOGAHvVhsDoh&#10;5mM+uBKSx/cpGVK/jahIj0E+TFgLj0HmpLql232MKvnrL4bpjUd/YKb+0PkY8ZV7&#10;f+yt+6hcjhjHaiJa9ejGVbxntxxGy+HdZoUYYC/ijDiRmcdyTIMkq1UzinrL7jFb&#10;ycNp4oqwWfP2d8AfMRKeMHT8PazZSIMHm1Y0WCPkXuk+A+izxZAC/YI4nVu6S0Cx&#10;rSekszwvChZNDUufX/7M7YH8aJlvagQ9MfeMEyVmwPIlmUaijAyrwTbYGkmTJspG&#10;2WshBGweWw739Iqv8OHeQu67mPZ5EI+P13uEpilMm7y5V10K9NGMjEjeXZcJ9dST&#10;l3Xl7qvyxZGrtOUGENN7Skx0KcC+6nHAfodyZ9OBQFfsOTKJwNeC62LPIISHBbVR&#10;31CDW2amQmhmIFzLhyIh8DrFU9pWuZUZw7Xg7pHXQ5JXElFdxWsv6Fd7j8oNNR6a&#10;idY6vFbz&#10;=u3wh&#10;-----END PGP SIGNATURE-----&#10;"/>
        <property name="pgp.publicKeys" value="-----BEGIN PGP PUBLIC KEY BLOCK-----&#10;&#10;mQGNBGJSsZYBDADZFfm8oI9HeYApA1g1SctwxyzNq1B6lyp8KsFM8TNPnHdY1ATP&#10;auqS0t1OP3wtDAa7fxGVQevWZYmB8wuQUS1srQMwpOOhNib/EKCJ7AayaExJ0o0n&#10;HCFB6R0vm8SUo/V4SQfhwAVV/2b9bfGWxoMyMNXUSl4fJssPcb55tN9e+73RdzJk&#10;lh5ko22tOPC4wohivQihL4G6TqD5Blsuw4055b+mzcLuUH+H9NBebl5pSDTpendN&#10;I+zDPFA8PjJqs13HsviBXoTgnlitPx2qAbT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5TF2oaKTKRPXskg==&#10;=skba&#10;-----END PGP PUBLIC KEY BLOCK-----&#10;"/>
      </properties>
    </artifact>
mickaelistria commented 2 years ago

There is https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_pgp.html . What do you think is missing particularly?

iloveeclipse commented 2 years ago

@mickaelistria : see the bug description about what is missing. I see no answers in the documentation link you've provided.

mickaelistria commented 2 years ago

Where should such documentation be located? How to produce signatures in a build flow doesn't really belong to p2 per se (although p2 publisher could host a PGPSignatureAdvice to produce them more easily via API but that would be another topic), similarly to how to use jarsigner and integrate it in some build.

iloveeclipse commented 2 years ago

We provide a support for a feature without anyone ever explained how that feature could be actually implemented, that is at least strange. So far the docu only says that you can use pgp signed bundles from 4.21 and gives some insights into some internal design of the feature, but it doesn't explain at all how the user can produce the signed bundles.

I'm probably a first client trying to use that feature and I have no clue at all (except answers on mailing lists on my questions).

I personally would expect that on the same Eclipse help page a simple step by step example is given: how one can produce a signed bundle, using concrete commands, and limitation of the current solution is also explained. If you or someone else did that during implementation of the feature (I think so), that should be not a big deal to add this info to the help, right?

Reading comments from Ed / Stephan I assume users should also have been informed by the help about following limitations:

Side note: searching the help for "Using PGP signatures in p2" doesn't deliver any relevant matches, the direct link https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_pgp.html doesn't have a bread crumb and doesn't show up in the "Content" tree structure on the left side if clicking on the "Link with contents" button - it looks like there is something missing in the help contribution. Compare that with the jarsigner link: https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/guide/bundle_security.html?cp=2_0_3_7_1