Differences between revisions 74 and 75
Revision 74 as of 2014-01-16 11:39:24
Size: 7467
Editor: GeoffSimmons
Comment: The existing DebianWheezy and DebianJessie pages contain release specific information.
Revision 75 as of 2014-01-17 14:34:10
Size: 7483
Editor: vyrly
Comment:
Deletions are marked like this. Additions are marked like this.
Line 80: Line 80:
 * install dependencies: '''`aptitude install byacc bison`'''.  * install dependencies: '''`aptitude install byacc bison`'''
Line 83: Line 83:
 * run '''`scripts/install-faketime-local.sh`'''  * run '''`install-faketime-local.sh`''' inside scripts directory

This allows to build Kernel in verificable way to know if .deb indeed matches the source code of kernel without added backdoors/viruses.

To use it just execute the 2 simple commands described in section "Install" below.

To get all needed files, on Debian use command: git clone https://github.com/mempo/deterministic-kernel.git

This is work in progress, ?Mempo team will help you in using/testing this software, contact us on #mempo and #debian-kernel on irc.oftc.net (see http://www.oftc.net/) or use this chat-webpage (for anon. use I2P irc #mempo) or see ?Mempo-Contact

As of now (2014-01-16) this work is:

  • about Linux kernel only, testing on amd64
  • work in progress

Progress

(!) Issues currenty worked on:

  • have tar avoid saving file creation times into .tar and use same order for packing - doing it now as ?Mempo/mempo-deb/tar

  • have ar pack files like ar -D. Explain why dpkg is not doing that, it seems to provide internal ar that always works in deterministic mode and yet it doesn't work. Manual ar -D works.

Steps of this project:

  • (./) Step1 configure kernel build to create identical intermittent files: .o

  • (./) Step2 configure kernel build to create identical final files: .ko

  • (./) Step3 identical .gz files (docs?)

  • (./) Step4 have identical all files and vmlinux including vmlinux .notes

  • Step5 have identical .deb file
  • Step6 remove certain restrictions on build situation (e.g. requiring same path)

(some steps where removed as plans changed)

See general instructions: ReproducibleBuilds how ever they are mainly for step 2,3.

We are trying to create a script that does this deterministic build in a bit more automated way with added:

  • verification of downloaded sources (check against hardcoded in script list of expected checksums of sources; also check PGP signature with hardcoded public key of kernel developers)
  • apply security patches for the ?Mempo subproject

  • grsecurity patch - http://grsecurity.net/

  • misc patches if needed (e.g. quick fixes regarding security)

This page should be usable for everyone in Debian, and script we're writing will be later easy to run in pure-Debian mode too.

Install

You can help yourself and this project easily!

/!\ Current extra tools needed:

  • use tar that supports --faketime and --sort-added like ?Mempo/mempo-deb/tar

  • use dpkg from jessie or equivalent

  • install the faketime (in wheezy)

As root install dependencies:

apt-get install faketime time git build-essential libncurses5-dev libncursesw5-dev kernel-package md5deep gcc-4.7-plugin-dev g++ make time

Also build dpkg version from jessie (assuming you build on wheezy):

  • /!\ Disable (uninstall) unattended-upgrades if you use it !!! otherwise you risk heaving system demaged perhaps (half-updated to jessie)

  • Make backup and then edit file /etc/apt/sources.list add jessie lines eg:

deb http://ftp.pl.debian.org/debian/  jessie main
deb-src http://ftp.pl.debian.org/debian/  jessie main
deb http://security.ftp.pl.debian.org/debian/  jessie main
  • do aptitude update.

  • login to some user, download sources apt-get source -t jessie dpkg

  • enter dir cd dpkg-1* that was created
  • build dpkg: run debuild -us -uc -B -j2

  • when builded, switch back to root and install dpkg -i *.deb the created packages like dpkg_... and dselect...

  • edit back /etc/apt/sources.list to normal version

  • do aptitude update. reinstall/enable unattended-upgrades is you disabled it

  • do dpkg -l dpkg to see what version you have, we need dpkg >= 1.17.5 though according to other documentation, >= 1.17.1 perhaps can work.

On other vesions od dpkg the script still will work mostly, all the files inside of .deb should be the same, how ever the .deb file itself can have other checksum

Create unix user kernelbuild preferably (or, on any user).

Get and build modified tar:

  • install dependencies: aptitude install byacc bison

  • git clone git@github.com:vyrly/various.git

  • cd various/tar and ./bootstrap ; ./configure ; make

  • run install-faketime-local.sh inside scripts directory

  • copy binary cp src/tar ~/.local/usr/bin/tar

In home directory run:

rm -rf deterministic-kernel/ ; git clone https://github.com/mempo/deterministic-kernel.git && cd deterministic-kernel/  && bash run.sh

press ENTER to confirm (e.g. the download) and then kernel should build :)

Resources: https://github.com/mempo/deterministic-kernel https://github.com/Happuri/deterministic-kernel

If important, then we builded on settings: computer hostname was "workbench", user name was (since 2013-12-09) "kernelbuild", working directory/path was "/home/kernelbuild/deterministic-kernel/" for most tests, if you use same and below instructions then you should get identical result to amount described here.

Trust chain

For ?Mempo-Kernel: obtain the .deb from mempo repository, then check checksum of it with trustworthy people who did build .deb from source and seen it produces same binary as in repository.

  • YOU: check checksum of .deb and look for trusted 3rd party signed message that such .deb is fine.
  • Volunteers: will spend the 2-3 hours needed to build and verify our .deb and then confirm you can trust the .deb with given checksum.

So the full chain trust is:

  • you should install the .deb of Kernel
  • if this is the official Debian Kernel, after Debian will use the script/technique described here, then this .deb is signed by apt-get GPG key so you trust it implicitly - all done. And you are able to repeat the build process to verify if the apt-get GPG key was not compromised.
  • if this is for the ?Mempo-Kernel, then until this flavour is hopefully included in Official Debian as another kernel option, it is not signed by GPG key of Debian official apt-get.

  • in this case, verify if the .deb file you downloaded is signed by security@mempo.org

  • but how do you verify is security@mempo.org is not compromised nor malicious?

  • for this verification, you can build the kernel yourself as described here
  • compare the content of provided and builded .deb with eachother
  • if matching, you can publish that "Kernel .deb file with checksum sha512:........ was unpacked and verified to match results of compilation from source by me" so others can do it easier.

In time, we will upgrade the build script to have the final .deb file identical, then procedure is even faster (just run run.sh and publish sha512 of your .deb).

?Mempo project might release the .deb in own repository for easy installation for people that want this.

Ultimately, Debian.org might one day officially include Mempo-kernel in Debian repository (though, even then checksum based verification will be more secure, in case of ftp master key being compromised).


Tests - please test this script and report any problems to ?Mempo and on IRC #mempo also add here to wiki in /Test

CategoryKernel