-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
Signing AppImages #238
Comments
No, the |
Would there be any way to embed this into an AppImage in the future? I really like the idea of 1 app = 1 file. It would be great if this could remain true and have the signature inside. |
Agree. Ideas on how to improve this are welcome. How does debian do it? |
@probonopd debain doesn't store key files with packages either. they are just signed with the packagers keys and the Repos Keys and the keys have to be in the system Keyring with the rest of the trusted keys. almost every Linux distro does it this way. What could be done I guess is have a script or something (the desktopintergration?) go off and ask the users if they want to import the key into the keyring if they trust the Developer/Packager. |
According to this, three files within the deb pacakge (control.tar.gz, data.tar.gz and debian-binary) are signed, then this signature is stored within the deb package. This is kind-of how I imagined it could work with AppImage's, but we would have to sign every file inside the AppImage, then store the signature inside the AppImage. I thought of creating an AppImage, signing it, then storing this AppImage and its signature inside another AppImage, but I think this would be a terrible way to achieve this. Any thoughts? |
yes but the actual key file isn't stored in the deb files at all and is why the keys have to be in the systems keyring. the keys are stored on gpg key servers most the time and then are imported from said key servers into the keyring |
I think best option would be to store the keys on key servers and then sign the Appimage with the keys and come up with some way to import the keys into the keyring and then have some way to verify the key and make sure the Appimage is from a trusted source |
you know I just realized me and you both are developing an OS centered around Appimages.. maybe we should chit chat sometime :) |
Of course, the key would have to be stored in the users keyring, but the signature could be stored in the AppImage somehow, then this signature would be verified against the users keyring to see if its trusted. |
@PHPJosh Funnily enough, I just realised the exact same thing. We should definitely have a chat sometime. |
and we are both using Arch as a Base.. think difference is I am forking Arch as I don't want rolling updates in my Project as with rolling updates things can break as since I have been working on my project i have already had some things break. will provide security and bug fix updates and Hardware updates for my project in between major versions. well as far as talking guess we could use skype TS3 or something.. i have a ts3 server i can bring back online anytime as its been offline for months atm lol |
So the question is: Say we generate a signature for an AppImage. Now we put the signature "into" the AppImage (into a location that was 0x00 padding before). Now, the file is no longer the same and the signature will no longer match the file. How can we work around that? One idea is that the code that checks the signature first copies out the embedded signature from the AppImage, then overwrites the signature inside the AppImage with the original padding (0x00), verifies the signature (it should now match again!) and finally puts back the signature into the AppImage. But that is not very elegant, there must be a better way... any ideas? @Chaz6 suggested piping into gpg. That might work, using a tiny helper in C that replaces a given range of bytes with an equal amount of 0x00s. http://hick.org/code/skape/papers/elfsign.txt suggests:
So not sign the ELF but a md5 "digest" of it. |
There seem to be ready solutions:
|
signelf by @rhvgoyal from https://lkml.org/lkml/2013/1/15/610
Seems to have signed the binary BUT when I tried to sign an AppImage (which is an ELF with some filesystem image appended to the end of the ELF) it has truncated the filesystem that is appended to the ELF. So I guess it could now be about time to change the AppImage format to embed the filesystem into the ELF rather than append to it. But that would mean that it wouldn't be possible to put together AppImages easily without using a compiler, e.g., it would break what @develar does in electron-builder. So maybe we can wrok with @rhvgoyal need to address the above, or roll our own, possibly based on signelf (seems like it didn't go much anywhere on LKML so far but hey, why not use it as inspiration). |
Tor uses GPG for signature verification. The advantage of GPG might be that there is a web of trust that does not come from commercial "Root CAs". https://www.torproject.org/docs/verifying-signatures.html.en |
This is how I imagine it using GPG, what do you think?
|
@probonopd Looks great. Is that something that would work now? It would be good if we could integrate this into AppImageAssistant.
What do you think? |
I wonder if we could also embed the public key into the AppImage? This way, if the user does not have the public key, then we can ask the user if they want to trust AppImages from this developer? Or is this a bad idea from a security standpoint? |
You guessed it, bad idea from a security standpoint. An attacker could just sign the package himself and sneak in his own public key. Keyservers/web of trust is it. |
No, since we don't have the ELF section for it yet. But I am working on it.
Yes. Or a successor of it. |
will if this gets integrated into Appimage I will pitch in on desktop integration . like Crisnharvey was saying we need to come up for a way for the end users to import the keys into the keyring |
which i am with probonopd key servers all the way |
What worries me a bit is that there were several attempts at signing ELF (all technically working) around 10 years ago but none seems to have sparked much interest. Well, the same can be said for application bundles... but that's seemingly changing now. |
well hopfully the App bundle situation changes soon. I have known about AppImageKit for years and it has baffled me why no one before Me and Crisnharvey has build a Distro around them. and frankly IMO Snaps and Flatpaks are no good as the end result to me seems like a lot of unneeded bloat compared to AppImage |
dd bs=1 is way too slow...
|
Looks like elfsign cripples ELFs:
Can anyone get it to work? |
elfgpg doesn't work for me either:
Can anyone get it to work? |
I will mess with it once i have some spare time ( still compiling packages) as this is very important to figure out :) |
maybe by looking at the elfsign code u posted the actual elf in the appimage needs to be signed and not the resulting appimage cause the appimage is an iso |
We want the ISO part to be signed too! Otherwise the signature is worthless... |
yep i know but i think the elfsign is breaking it cause its actually an ISO with an elf on the inside. but best i can think is sign it like any other file which would produce a .sig file which couldn't we embed that in the appimage and somehow when its needs to be verified check the keys against the sig file? little read here how these guys verify ISO's http://www.mepiscommunity.org/wiki/system/signed-iso-files |
Let's not focus on ISOs so much since AppImage type 2 format will not be ISO based anymore. |
ah was the code you posted with the new squashfs format? if so should look into if squashfs can be signed. pretty sure it can be |
The signature mechanism should be independent of the particular file format used. It should sign the entire file except for a "hole" in which the signature goes. This will be an ELF segment. |
Writing digest.c which takes a file, an offset in bytes, and a length in bytes, and calculates the sha256 checksum over the file except the area from byte offset to byte offset+length. This is useful when a signature is placed in the skipped area. The idea is that this sha256 sum will be signed, and then the signature can be stored inside the skipped area. On the receiving end, the same sha256 sum will be generated and the signature will match. Here is an example of how it works:
|
Modified the behavior so that the skipped area is not actually skipped but filled with 0x00s during checksum calculation. This allows one to use the Test cases change as follows:
|
Digital signatures added to the AppImageSpec draft. Note that no specific format (e.g., GPG vs. X.509) has been mandated, which means that both could be used. The following works with the new squashfs-based type 2 AppImages generated with appimagetool:
Gives:
|
It works! We now have signatures inside (type 2) AppImages. Try it yourself. Generating a signed AppImage:
Reading the signature:
Validating the signature:
|
Nice! once i get my repos built (which should be next 2 days) so i can make ISO's will start messing with all this but this is going to be nice :) |
|
Quick question. Is there any way to sign AppImages and store the signature inside the AppImage itself, similar to how Mac apps have their code signature info stored inside the application bundle?
The text was updated successfully, but these errors were encountered: