-
Notifications
You must be signed in to change notification settings - Fork 18
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
Heads integration of wyng #54
Comments
@tasket : any insight? |
With better understanding, I think 2 above is the way to go, providing both integrity verification (diff returns 1 if different) and restoration of initial deployment state if desired (deleting all other LVMs, restoring dom0 and QubesOS known volumes). @tasket Would it be possible to customize /var/lib/wyng.backup path from command line so that the archive.ini points to /boot backups directly? The more I think about it and the more I'm thinking that those volumes should become the alternative to rpm template deployments from QubesOS, no? |
I can't say just yet how well wyng could support this use case, but it sure sounds interesting. I'll try to get you a detailed response by Saturday, as I've only ever used AEM and don't want to sound stupid. ;) Initial thought is that right now wyng has value as a hash generator and fast updater; anything involving crypto verification has to come from another tool (e.g. Heads) which would operate on wyng hash manifests. More later... |
Short answer on custom path is yes the metadata path could be overridden if an option for it was added. |
@taskset Let me know your ideas on 1, I will continue thin-provisioning-tools inclusion under heads and explore if micropython could fill wyng requirements. |
My current strategy will be to use a QubesOS AppVM to store wyng backups inside of a thin provisioned LVM, not backuped by wyng, and access that thin LVM from Heads after unlocking the LUKS container for which the user receives temporary decryption passphrase when hardware is in his hands(transit tamper proofing). Once integrity of LVMs is validated/restored, the user will proceed to reencrypt received sdcard and SSD LUKS containers as per actual process. Consequently, only wyng metadata would be present under /boot, for which Heads generates a digest at each boot and verifies this generated digest integrity against a signed one. This adds a 5 seconds delay at boot time, since the number of files is important, but would be less disastrous then having the backups also under /boot. (Need to test how long Heads would take to generate a digest for all backup files) Not including the backups inside of /boot would saves a lot of time at each boot, since those files are not considered when generating the digest then verified against the signed one for all those files. The downside of this is that if the LVM pool is broken, the user would also loose his backup VM and wouldn't be able to restore dom0 and original AppVMs and templates. Other possible strategies:
|
First comment: I'll limit myself to addressing 1 & 2 for now... I think this is feasible for verification without storing actual backup data. However:
I plan to add Zstandard compression as an option in v0.3. This should greatly increase verification performance. But making wyng verify as fast as direct hashing would require a format change that almost doubles the metadata size on disk (currently, the trade-off being made is for a combination of space efficiency and security). On metadata size: Its possible wyng will begin to compress manifest files in a future release, which would lessen boot delays. You could forgo wyng and hash the volumes directly ( |
@tasket Well. Generating a digest for backups takes 3minutes for standard templates and VMs. Acceptable if outside of /boot, but not in from Heads perspective. Detaced-signed digest on external volume to be checked again only when needed fits the bill as of right now. |
That 3min run time sounds like you are hashing all the data with the metadata. What if you only hashed the volinfo, info and manifest files? |
I'm still not clear on the use cases and workflow associated with the integration. For example, the need for thin-provisioning-tools in the Heads startup environment... Wyng only uses If what you need is |
I was effectively basing digest creation on all the data to make sure it was not tampered with. Heads measuring the public keys inserted in ROM in its TPM measurements, I was basing myself in that root of trust to detach sign that digest with USB security key on all the backup data, not just it's metadata. Unless wyng could fail if metadata doesn't match actual data in backups then it might not be a need. |
The use cases would be multiple. First one would be to verify consistency of all lvm-volumes against backup once at reownership. Goal being to discourage distributed reprogrammers to tamper with disk image or even booting the OS while he has the decryption key prior of reencrypting content. Another use case would be to add into heads a OEM ssh public key and a remote backup repository, where the user would basically be offered the possibility to deploy/restore from remotely available TemplateVMs and AppVMs from a list proposed to him. |
Since Wyng keeps 256bit hashes for all the data chunks (these are the 'manifest' files), you can just create digests for those 3 file types (plus 'archive.ini') as I suggested earlier; digests could be in a single list that is signed by Heads. This allows you to quickly check the archive integrity on a basic level on each Heads startup, for example, and then you can have Wyng perform data verification if/when it is necessary. Data verification would probably take about the same amount of time, but doing it this way might give you more flexibility and better UX. I just ran a test with thin-provisioning-tools removed, and indeed you can have LVM access and create thin LVs without them. Only caveat is that |
Of course, current Wyng version will exit if |
Will play with building micropython and python packaging tommorow. Thanks! |
Based on a quick examination of micropython v1.12 in Debian, some critical libraries that are missing are: subprocess, stat, shutil, tmpfile, argparse and datetime. Best strategy for conversion to micropython would be to isolate the receive_volume() function and the functions it calls; this would cover receive, verify and possibly diff commands. Converting commands like monitor, send and prune would not be realistic, however (at least, not for myself). Another avenue is to script it in the shell. As you may know, early sparsebak had a compact shell script that could verify and extract a volume from an archive; adapting it should be possible. |
Nah, goal would be to package wyng, not to rewrite it. Will look into python3 |
If shoe-horning CPython into Heads is a struggle, I can still provide a shell script for about 1/100 the effort. After adding xz/lzma support to wyng, I tested the ability of This cat-ing ability wasn't really an option with the default zlib compression bc I couldn't find a shell tool to decompress naked zlib chunks (gzip won't do it). |
Well, that's interesting. The |
Here's a gist that can check and extract a volume (uses |
Can we rely on standard gzip from busybox? |
No, unless you use some tricks to pad gzip headers to the data files. Very messy and slow. That's why I was trying out lzma/xz format. IIRC its found in most startup/rescue environments. Another option is to make gzip a separate compression choice so the files are created in gzip format. |
xz is supported AFAIK.
On March 3, 2020 5:20:24 PM UTC, tasket ***@***.***> wrote:
No, unless you use some tricks to pad gzip headers to the data files. Very messy and slow.
That's why I was trying out lzma/xz format. IIRC its found in most startup/rescue environments.
Another option is to make gzip a separate compression choice so the files are created in gzip format.
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#54 (comment)
-- Sent from /e/ Mail
|
This is giving me second thoughts about using
Looking at the alternatives and the APIs in the old dom0 version of Python, I think |
@tasket small update while revising my notes: QubesOS/qubes-issues#4371 (comment) |
FWIW, a factor is that the target partition /boot is small. It would be easy to run a My own personal routine is before doing system update to dom0, to do an |
@tlaurion I know this has taken considerable time and seems like it may be out of steam, but here is what I would do to get this working in the short-term:
Number 1, handled by you already I think. Number 2, porting Number 3, handled by me; should take a few days. I would probably have it call another, generic file-fetching script where we can put any specific protocol details. This approach produces the fastest, most efficient result from |
Hello there again.
I'm really impressed by this project. Good work!
I would love to bundle wyng under Heads for different reasons:
My main interest would be to figure out the feasibility of 1 or if 2 would be required to obtain 1 goal's. And move incrementally from there.
If that would be possible, i would restart integration of lvm-provisioning-tools inside of Heads to make this go forward, since my main problem right now is to make OS integrity measurable by the user upon hardware reception against what I intend to be deployed from distributors (make sure they can't tamper with the LVM integrity inside of downloaded disk image they deploy).
That way, localized distribution of hardware would be possible, removing trust into remote hardware reprogrammers. Let me know what you think, else i'll investigate deeper the dm-verity way to provide needed LVMs verified integrity of volumes contained inside of LUKS encrypted container.
The text was updated successfully, but these errors were encountered: