-
Notifications
You must be signed in to change notification settings - Fork 15
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
[DRAFT] Digital Signature of Packs #8
Comments
Feedback from the project meeting: |
While testing cpackget on all packs from the public index, I've found packs under HTTP domains and packs with expired HTTPS certs. Should these be notified when installing packs? I'd say yes, but don't know if installation should be aborted. |
Good points. I suggest that:
b) if an https url has an expired certificate
|
Hi guys, as usual I am going to be a bit pedantic and picky on the wording...so please feel free to kick my ass when needed :-) ConceptTo me, GPG is the GNU implementation of the OpenPGP standard: https://www.ietf.org/rfc/rfc4880.txt So, my first point is: do you really want to rely on GPG which has a GPL-3.0 license ? Now, coming to OpenPGP. To me, what we want is proving the authenticity and integrity of our packs. But, to do so, we do not need OpenPGP in its wholeness. To be more precise, we need:
I would vote for ECDSA + SHA256 as we may work with "small" keys compared to RSA. AttacksForging a fake packI understand that you propose to have:
So, as a hacker I can:
This would be accepted by the tool if we have no "trusted third party" to certify the origin of the public key. Countermeasure : we must prove the ownership of the public key. So, to me, a smart and standard way to solve this issue is to use X.509 certificates to distribute the public keys (no need for a special server to register the authorized keys or hard-code the authorized keys in the cpackget binary). Besides, with the X.509 certificates chain concept we can easily have a hierarchy of certificates and accept/revoke certificates at any level. Circumventing cpackget checkAs a hacker, I may very well:
So, I can install any pack on my machine without cpackget checking it. Countermeasure : the pack authenticity and integrity mustbe checked at usage step, not only at installation step. So, each time the project manager uses a pack, it verifies its authenticity and integrity. Public Key InfrastructureI recommend using X.509 certificates to distribute the public keys.
The tool would have a secure store of root certificates and it would be easy to maintain it (just like web browsers do). Or we may have specific CAs and if you want to publish a pack accepted by the tool then you must first obtain a public certificate signed by this CA. Or, we may be permissive for some packs (libraries: accept any certificate) and restrictive for some others (device packs: accept only the certificates signed by silicon vendors CA). Many strategies can be imagined... but X.509 is the building block for this IMO. |
Maybe I should have started by this...but probably we need to clarify what we want to achieve here ? To me what is important is:
That's why digital signature + PKI sounds good to me. A 3rd goal may be: For instance, if a pack is a CMSIS pack, then my tool may refuse to use this pack if it is not signed by ARM or a 3rd party whose certificate has been signed by ARM. What do you think ? |
We may have servers hosting some certificates but I guess it is not mandatory. Then, the intermediate certs and leaf certificate signing the pack can be delivered together with the pack. Of course, certs expiry must be considered. Then it depends on the tool implementation:
So, I am more in favor of distributing the public keys together with the packs. |
The latest recommendations (for the web) seem to be to issue certificates with a one year validity period: But the Root CAs themselves have much longer validity period: So, probably we can go for longer validity periods in our case. Anyway, we can have a configurable "cpackget" with a permissive mode. The question is also: should the signature be checked only by cpackget when installing the pack? (so we assume that once the pack is installed on the local machine the security is fine). Or shall the tool using the pack check the signature too ? Nevertheless, this may have an impact on the architecture : maybe the service to check the packs should be "externalized" from cpackget (or at least built with an external API?) so that any tool can use it ? |
Regarding this point: Q2: How to ensure that the pack was created by the vendor? This is the idea. We need in the certs chain an intermediate certificate from ARM. So one may imagine a certificate chain like this: Then having the "Globalsign Root CA" in your trusted store of certificates (maybe the one from your OS) is sufficient to trust the entire certs chain. You just need to say:
CN = ARM packs issuing entity |
Another aspect also : to avoid making packs distribution too painful (people may want to distribute packs easily), all these checks must be configurable. An end-user may say : I do not want any check, I accept any pack from anywhere, even if the pack is not signed at all. |
Hi @fred-r, let me try to compile your comments' answers in this comment.
Are there any public certs store out there as MIT or Ubuntu do for GPG public keys? Perhaps these servers will become handy when distributing or keeping the list of CRL.
Ack.
Do you know if cert renewal also requires new keys? If so, I'm afraid pack re-signing would be a recurring task for vendors.
My initial idea was exactly that. But now that I re-read this statement, I think perhaps cpackget could by default check for pack signatures and avoid it via special flags, e.g.
Agreed! In my initial proposal, I suggested to build a tool ("cpacksec") that could be used to generate keys, sign packs and verify signature. The idea was to have it both as a standalone tool and as a Golang API that cpackget could make use of. I think the principle remains the same for PKI/x509 certs. The upside is that we could customize it as we wish.
I remember from one of our email threads that you didn't like the idea of having a single RootCA signing all vendors certs. Or am I missing something? I had in mind that ARM certificate would be the Root cert in this chain, that it would be the one with long expiration dates and that this would be shipped in cpackget's secure certs store. |
For the Root CA cert : agree, any vendor must have the freedom to choose the CA signing his certificate. This way, the tool does not need to maintain its own store of root certs and can reuse the OS store. I do.not think it is mandatory for ARM to play the role of the CA, this would be complex. What I suggest is that the ARM intermediate cert (and it can be any intermediate cert assignef to the subjectcARM Ltd by a CA) is required for packs whose vendor is ARM. But, we also need to be careful : more security is great but it comes with constraints. Bypassing the security checks must be allowed (one may think that all this signing is overkill and that they want to trust anybody). |
Let me write a scratch tool to start off on this thread, it'll be useful moving our discussion forward. @fred-r Let me ask you something that crossed my mind: Do you think Vendors would want to re-use x509 certs? For instance, let's say ARM already has another x509 cert that ARM uses somewhere else in the company, do you think it makes sense for ARM to reuse that to sign packs? Or should we always ensure that the cert to sign packs are created specifically for this use. |
Mmmh....not sure here. The difficulty comes when we introduce the intermediate company CA. This being said, your tool may very well accept this scheme (even if CA is set to FALSE), knowing that we do not use it to validate web sites. As you can see, there is still a little bit of thinking to do to make sure we do not reinvent the wheel:-) |
It sure does! It might also be the case that vendors re-use some certs to sign a "Pack-Signer RootCA" and have that one saved in cpackget's secure store. This is getting interesting. The tool will have to be very flexible to accommodate everyone's needs |
Yes, and we should also think about people who want to publish a pack without all this signing infrastructure. |
I just saw this tool that might be useful if we ever opt for setting a cert issuer server: https://smallstep.com/ I'm working on a scratch tool that implements things openssl did in @fred-r 's example. I'm not trying to reinvent the wheel here, but instead, by doing so I can really learn about it and properly do the job. For instance, I didn't know you could generate a cert for very specific needs, like signing other certs or simply to encrypt user data. Just for future reference, I've found this article about x509 & PKI: https://smallstep.com/blog/everything-pki/. It looks very thorough, I haven't finished reading it yet, it's a bit long too. |
How would this affect local packs? We use software packs for internal libraries and probably don't want to have to start messing around with signing them. Just wanting to make sure this is a use case that isn't forgotten about! |
In my opinion anyway, you should always have the possibility to disable the signature check by default. But, for people who want more security, then the check could be enabled. |
There's now a wiki page for proposals like this, which I added this feature to. Added the proposal Google Doc there for more technical discussion. |
Updated the wiki page regarding the latest implementation and the needed discussion/two possible mechanisms to fully deploy this feature. |
I'm glad to hear that signing is being added to CMSIS packs, I think this will give CMSIS Pack users real benefits. I have a suggestion that I think will give a more thorough solution than is currently proposed and potentially save time. Many of the concepts of secure package delivery have been implemented by existing systems and the lessons that have been learned from those systems have been written into a project called The Update Framework (TUF). TUF provides a flexible framework and specification that is designed to allow it to be adopted into any software update system including when retrofitting it as is the case for CMSIS packs. There is a lot of available reading material and videos explaining the benefits of TUF but to understand the potential benefits of implementing TUF over the benefits of implementing the currently proposal TUF's security page gives a list of the attacks and weaknesses it addresses. |
DRAFT
Pack Signing Motivation
This is a proposal to make cpackget installation more secure through pack signing by tackling the following top use cases:
Design
The fundamental idea is to use keys signed by PKI/x509 certificates to sign packs and be later on validated by
cpackget
.Each vendor would be responsible for generating their Root CA, then generate sub-certificates depending on their needs. Example:
1.1. MCU Group Cert
1.1.1. Joachim Krech's Cert
2.1. Software Center Cert
2.1.1. Le Mans Cert
2.1.1.1. Frederic Ruelle Cert
3.1. Bob Cert
Aspects of the approach:
2.1. Check integrity by checking the signature file and the original pack file
2.2. Validate its authenticity because it has been signed by MCU Group Cert which has been signed by ARM Root CA, present in the certs store.
2.3. Optionally check access control by matching the key's cert against the specific Root CA.
--ignore-validity-date
or--ignor-ownership
Q&A
The following questions have been asked during discussion of this proposal:
Q1: How to ensure that the pack file has not been modified?
The signature file is just an encrypted hash sum of the pack file, so during signature checking, the hash of the pack will be re-generated and compared against the one embedded in the signature file.
Q2: How to ensure that the pack was created by the vendor?
Because of the nature of X.509 certs, it's possible to track a signing key up to its original ROOT CA. All Root CAs should be in a secure store trusted by cpackget.
Q3: If a pack was signed by a key that is no longer valid, is there a solution without re-signing all packs signed with that key?
No, re-signing is required because the key is no longer trusted by cpackget.
The text was updated successfully, but these errors were encountered: