TBD (This translation is still imcomplete / 現在翻訳中です)
フリーソフトウェアでは誰もがソースコードを検査し、故意に埋め込まれた欠陥がないか確認できます。しかしDebianではバイナリパッケージをユーザーに提供しています。「決定論的な」「再現可能な」ビルドとは、ビルドプロセスがソースコードからバイト単位で必ず同一のバイナリを再生成できるようにすることで、誰もがこの欠陥がないことを確認できるようにするものです。
ビルド再現性についての全般的な情報は reproducible-builds.org をご覧下さい。
Contents
なぜビルド再現性が求められるのか?
- あるバイナリが特定のソースから改変なく生成されていることを客観的に検証するため
- まず、ビルド再現性が必須になれば、攻撃者から見てアップロード権限を持つ開発者のシステムを攻撃する動機が低まります。攻撃に成功しても、アップロードされているソースコードに対応しないバイナリをアップロードすることは不可能だからです。
- さらに、攻撃を成功させるにはアップロード済ソースのビルド再現性をチェックするすべてのマシンを乗っ取れなくてはなりません。このことは更に動機を失わせるでしょう。
- 最後に、もし十分な数のサーバーが地理・運営元が分散して稼働するならば、このビルド再現性の確認を通して乗っ取られたシステムを検知することもできるでしょう。
Multi-Arch: sameなパッケージを同時に複数インストールする上でも有用です(すべてのファイルがバイトレベルで一致する必要があるためです - 訳注:ここの意味がよくわかりません)。
- デバッグパッケージが作られていないパッケージに対するデバッグシンボルを独立して再生成できます。
- パッケージがソースからビルドできることの保証にもなります。ビルド再現性のあるパッケージのみをアーカイブにアップロード許可する、としましょう。すると、メンテナは.debのアップロードではなく(手元でのビルドが成功したら).changesのみを更新します。するとbuilddが(独立して)ソースからビルドするという訳です。そしてハッシュが一致すればアップロードが行われます。
- Debianミラーやsnapshots.d.oなどでの.debファイル単位の重複除去にも役立ちます。バージョン間でソースパッケージに変更がなければ同じファイルしか生成されないからです。
- (同じ理由で違うバージョン間の).debファイル間の差分もより小さくなります
build profilesを使うパッケージはプロファイルによらず同じ結果を生まなくてはなりません(訳注:crossビルドプロファイルはそのアーキテクチャのネイティブビルドと同じ結果でなくてはならない、といったこと)。そしてビルド再現性はその検証法として利用できます。
Architecture:allなパッケージが本当にすべての異種アーキテクチャの上で同一のビルドを生成するかを確認できます
クロスビルドがネイティブビルドと同一の結果になるかの検証ができます
- 埋め込みバイナリのコピーが検出できます (ツールチェイン側が修正されビルドが再現するはずであるのに、(パッケージ側で重複して持っている?)バイナリの(ビルド再現性を壊すような?)コピーがある場合) 訳注:ここの意味は要再検討
- ビルドプロセスのQAや分析目的でシステムコールやファイル・ネットワークアクセスのトレースを取る上でも有用です。ビルド再現性があればそれらがビルド結果に影響を及ぼしていないことが確認できるからです。
コンパイラ動作の完全性チェックに多様構成での二段ビルド法が使えるようになります。gccをgccやclang(やその他のDebianにあるgccをビルド可能なあらゆるコンパイラ)でビルドし、そのgccでgcc自身を再コンパイルします。この二段目で生成されたgccパッケージも最初の結果と同一ならば完全と言えます。(訳注:これはgccのstage buildと違い、別の環境、別のタイミングで独立してこの検証が行えることを言っている)
- Debianの派生ディストリビューションを作る際、ベースシステムを二段ビルドする形でブートストラップすれば、coreutilsやlibcにKen Thompson問題(訳注:始祖となるバイナリに仕掛けが入っている場合、ソース監査で発見できない方法で脆弱性を仕込め続けるという問題)が仕掛けられていないことを検証できます。さらに、クロスコンパイルする形でこれを行えば、ハードウェアレベルで同種の仕掛けがないことも検証できます。
- プロプリエタリなバイナリブロブが(訳注:意図通りの)無改変のフリーソフトウェアに組み込まれていることを検証できます。例えばFirefox Encrypted Media Extensionsは無改変のFirefoxが動作に必須となっています。
Reproducing builds(ビルドの再現方法)
これを行う上でのポイントは2つあります:初回ビルド時にビルド環境の記録が取られている必要があること、そして、その環境を以後のビルド時に再現させることです。
Recording the environment(ビルド環境の記録方法)
ビルド時の環境情報は 新たに規定された`.buildinfo`という拡張子のコントロールファイルに記録されます.
Reproduce the build environment(ビルド環境の再現方法)
これにはsrebuildというsbuildのラッパーが用意されています。 これは.buildinfoに記録されているパッケージのバージョンをすべて含むsnapshot.debian.org上の日時を特定し、それら正しいバージョン構成の元でビルドするものです。
詳しくはこちら:srebuild
References(リファレンス)
(訳注:原題を残した上で、補足を付けています)
Gitian: a secure software distribution method(安全なソフトウェア配布手法)
Bazel: build tool that specifies all direct build dependencies(直接のビルド依存性を完全指定するビルドツール)
http://rbm.boklm.eu/: the Reproducible Build Manager
- Deterministic virtual machines(決定論的仮想マシン):
ReVirt: Enabling Intrusion Analysis through Virtual-Machine Logging and Replay (仮想マシンのログ採取と再生による侵入検知)
Debugging operating systems with time-traveling virtual machines (仮想マシンのタイムトラベル処理を用いたOSデバッグ技法の提案)
A Particular Bug Trap: Execution Replay Using Virtual Machines (アプリケーションバグを再現可能な仮想マシン上の再実行フレームワーク)
ReTrace: Collecting Execution Trace with Virtual Machine Deterministic Replay (仮想マシン上での決定論的再実行のための実行トレース採取手法の提案)
Execution Replay for Multiprocessor Virtual Machines(マルチプロセッサ構成の仮想マシンにおける再実行方式の提案)
Reflections on Trusting Trust, by Ken Thompson (配布バイナリをどこまで信頼できるか、ソースレベルで発見不能なトラップドアが存在し得ることを指摘して提起した発表)
Fully Countering Trusting Trust through Diverse Double-Compiling (DDC) - a PhD dissertation on how to use reproducible builds to counter the "trusting trust" attack on compilers (ビルド再現性を用いてKen Thompsonによるコンパイラへの「trusting trust」攻撃を検出できることを示した博士論文)
Is that really the source code for this software? by Jos van den Oever on blogs.kde.org (2013-06-19). Compare reproducing tar from the Debian, Fedora and OpenSUSE packages. (あるバイナリがソースパッケージから生成されているかどの程度まで確認できるかを検証した記事)
Deterministic Builds Part Two: Technical Details by Mike Perry (Tor Browser Bundleでどのようにビルド再現性を保証しているかのレポート)
Verifying the source code for binaries by Jake Edge in Linux Weekly News.
Colin Watson's answer on ubuntu-devel to “Will Ubuntu use "reproducible builds" as debian is planning to do?”(Ubuntuでもビルド再現性が保証されるようになるかについてのMLでの回答)
guardianproject wiki:
Why and How of Reproducible Builds: Distrusting Our Own Infrastructure for Safer Software Releases, Seth Schoen and Mike Perry at Mozilla San Francisco, 2014-11-05
Challenges and implications of verifiable builds for security-critical open-source software by Xavier de Carné de Carnavalet and Mohammad Mannan, in ACSAC '14
The CIA Campaign to Steal Apple’s Secrets by Jeremy Scahill and Josh Begley, in The Intercept. Specifically (S//NF) Strawhorse: Attacking the MacOS and iOS Software Development Kit
Spy agencies target mobile phones, app stores to implant spyware by Amber Hildebrandt and Dave Seglins
Dave Cheney on Reproducible Builds in Go at GDG Berlin Golang, 20 April 2015
Triangle of Secure Code Delivery, Taylor Hornby, July 24, 2014
- Misc. upstream discussions:
Octave: bug report and mailing list thread
groff: mailing list thread
GHC (Glasgow Haskell Compiler): #4012
Groovy: GROOVY-6308
coreboot: mailing list thread and patches
libreboot: Feature #16: Reproducible Builds
mono and dotnet: https://github.com/dotnet/roslyn/commit/04462c44e30dfa91267581abdb029f3102796486, https://github.com/mono/ikvm-fork/commit/cd4bed9dd6540c380177c5b9c72f4d020f1b138f and https://github.com/mono/mono/commit/a803d17038c0fcc8b40b12744801a87ceddb15ba
Mozilla projects: Firefox/Iceweasel Thunderbird/Icedove
- Misc. distribution discussions:
OpenWrt: mailing list thread
NetBSD has a MKREPRO build switch (if you have more infos about this, please add it here, eg link to documentation about it). Also see http://gnats.netbsd.org/50116, http://gnats.netbsd.org/50120 and http://gnats.netbsd.org/50121.
Guix has set up a challange where every user can verify that the binaries from the server correctly correspont to the sources.
openSUSE are discussing reproducible builds too but are used to a different meaning of the term. mail 1, mail 2
More in the publicity and presentations sections.
Presentations
Reproducible Builds for Debian, Distributions devroom, FOSDEM’14, Video, Slides (Sources)
Reproducible Builds, a year later, DebConf14, Video, Slides (Sources)
Reproducible Builds, Moving Beyond Single Points of Failure for Software Distribution, 31st Chaos Communication Congress (31C3), Video, Slides
Stretching out for trustworthy reproducible builds, FOSDEM’15, Slides (Sources), Interview
Stretching out for trustworthy reproducible builds, Datengarten 52, CCC Berlin, Recordings, Slides (Sources)
Stretching out for trustworthy reproducible builds, Gulaschprogrammiernacht 15, Karlsruhe, Germany, Recordings, Slides (Sources)
Compilations reproductibles : permettre le lien entre un binaire et sa source, Pas Sage en Seine 2015, Paris, France, Video, Slides (Sources)
Reproducible builds in Debian and everywhere, Libre Software Meeting 2015, Beauvais, France, Video, Slides (Sources)
How to make your software build reproducibly, Chaos Communication Camp 2015, Mildenberg, Germany, Recordings, Slides, Notes for PDF Presenter Console, Slides+Script, Sources
Stretching out for trustworthy reproducible builds, DebConf15, Heidelberg, Germany, Video, Slide Sources
Reproducible builds roundtable, DebConf15, Heidelberg, Germany, Video
The long road to reproducible builds, FrOSCon 2015, St. Augustin, Germany, Recordings, Sources for the slides
Beyond reproducible builds, MiniDebConf Cambridge, England, 2015-11-08, Video, Slides (Sources)
Upcoming presentations
Reproducible builds in FreeBSD packages at FOSDEM 16
Publicity
This section lists URLs, people, and dates for when other people have publicly expressed interest, or shared information about, the project.
Mike Perry, 2013-08-20: Deterministic Builds Part One: Cyberwar and Global Compromise
Jake Edge, 2013-08-21: Security software verifiability
Holger Levsen, 2014-09-26: Reproducible builds? I never did any - manually
Lunar, 2014-12-29: Reproducible builds against RC bugs
Lunar, 2015-01-15: 80%
Jake Edge, 2015-01-21: Lots of progress for Debian's reproducible builds (discussion on LWN, HN, reddit)
Kristian Kißling, 2015-01-27: Debian bringt Reproducible Builds voran in linux-magazin.de (Note: the article contains several misunderstandings.)
Hanno Böck, 2015-02-02: "Vertrauen durch reproduzierbare Build-Prozesse" pages 1, 2 in Golem.de (German)
Hans-Joachim Baader, 2015-02-16: Reproduzierbare Builds in Debian nähern sich in pro-linux.de (German)
2015-02-16: Debian Project Reaches 83% Reproducible Builds for Source Packages in softpedia.com.
Tannhausser, 2015-02-17: Debian mejora su seguridad con los reproducible builds in La Mirada del Replicante (Spanish)
Darren Pauli, 2015-02-23: Debian on track to prove binaries' origins in The Register
Arun, 2015-02-24: Debian working on reproducible builds in ?TuxDiary
2015-02-24: Debian está trabajando en compilaciones reproducibles in Detrás del pingüino (Spanish)
2015-02-27: Debian security initiative for reproducible builds reaches milestone in ?TechRepublic by James Sanders
2015-05-03: Reproducible builds: first week in Stretch cycle by Lunar
2015-05-06: http://www.linux-magazin.de/Ausgaben/2015/06/Reproducible-Builds in Linux-Magazin 06/2015 by Daniel Stender (in German)
2015-05-10: Reproducible builds on Debian for GSoC 2015 by dhole
2015-05-11: Reproducible builds: week 2 in Stretch cycle by Lunar
2015-05-17: Reproducible builds: week 3 in Stretch cycle by Lunar
2015-05-25: Reproducible builds: week 4 in Stretch cycle by Lunar
2015-06-01: Reproducible builds: week 5 in Stretch cycle by Lunar
2015-06-07: GSoC 2015 Week 2: Move forward reproducible builds by akira
2015-06-07: GSoC 2015 Week 2: Move forward reproducible builds by dhole
2015-06-08: Reproducible builds: week 6 in Stretch cycle by Lunar
2015-06-14: GSoC 2015 Week 3: Move forward reproducible builds by dhole
2015-06-15: GSoC 2015 Week 3: Move forward reproducible builds by akira
2015-06-15: Reproducible builds: week 7 in Stretch cycle by Lunar
2015-06-21: GSoC 2015 Week 4: Move forward reproducible builds by dhole
2015-06-21: GSoC 2015 Week 4: Move forward reproducible builds by akira
2015-06-22: Reproducible builds: week 8 in Stretch cycle by Lunar
2015-06-28: GSoC 2015 Week 5: Move forward reproducible builds by dhole
2015-06-29: GSoC 2015 Week 5: Move forward reproducible builds by akira
2015-06-29: Reproducible builds: week 9 in Stretch cycle by Lunar
2015-07-06: GSoC 2015 Week 6: Move forward reproducible builds by dhole
2015-07-06: GSoC 2015 Week 6: Move forward reproducible builds by akira
2015-07-07: Reproducible builds: week 10 in Stretch cycle by Lunar
2015-07-12: Reproducible builds: week 11 in Stretch cycle by Lunar
2015-07-13: GSoC 2015 Week 7: Move forward reproducible builds by dhole
2015-07-13: GSoC 2015 Week 7: Move forward reproducible builds by akira
2015-07-20: Reproducible builds: week 12 in Stretch cycle by Lunar
2015-07-20: GSoC 2015 Week 8: Move forward reproducible builds by dhole
2015-07-20: GSoC 2015 Week 8: Move forward reproducible builds by akira
2015-07-25: GSoC 2015 Week 9: Move forward reproducible builds by dhole
2015-07-26: Reproducible builds: week 13 in Stretch cycle by Lunar
2015-07-27: GSoC 2015 Week 9: Move forward reproducible builds by akira
2015-07-31: GSoC 2015 Week 10: Move forward reproducible builds by dhole
2015-08-03: GSoC 2015 Week 10: Move forward reproducible builds by akira
2015-08-03: Reproducible builds: week 14 in Stretch cycle by Lunar
2015-08-07: GSoC 2015 Week 11: Move forward reproducible builds by dhole
2015-08-03: GSoC 2015 Week 11: Move forward reproducible builds by akira
2015-08-10: Reproducible builds: week 15 in Stretch cycle by Lunar
2015-08-16: GSoC 2015 Week 12: Move forward reproducible builds by dhole
2015-08-16: Reproducible builds: week 16 in Stretch cycle by Lunar
2015-08-19: GSoC 2015 Week 12: Move forward reproducible builds by akira
2015-08-25: Reproducible builds: week 17 in Stretch cycle by Lunar
2015-09-01: Reproducible builds: week 18 in Stretch cycle by Lunar.
2015-09-06: Reproducible builds: week 19 in Stretch cycle by Lunar.
2015-09-06: How Debian Is Trying to Shut Down the CIA and Make Software Trustworthy Again, J.M. Porup, Motherboard
2015-09-10: How Debian and other open-source projects are making software more trustworthy, Chris Hoffman, PCWorld.
2015-09-14: Reproducible builds: week 20 in Stretch cycle by Lunar.
2015-09-21: Reproducible builds: week 21 in Stretch cycle by Lunar.
2015-09-27: Reproducible builds: week 22 in Stretch cycle by Lunar.
2015-10-04: Reproducible builds: week 23 in Stretch cycle by Lunar.
2015-10-14: Reproducible builds: week 24 in Stretch cycle by Lunar.
2015-10-18: Reproducible builds: week 25 in Stretch cycle by Lunar.
2015-10-26: Reproducible builds: week 26 in Stretch cycle by Lunar.
2015-11-02: Reproducible builds: week 27 in Stretch cycle by Lunar.
2015-11-09: Reproducible builds: week 28 in Stretch cycle by Lunar.
2015-11-15: Reproducible builds: week 29 in Stretch cycle by Lunar.
2015-11-23: Reproducible builds: week 30 in Stretch cycle by Lunar.
2015-12-01: Reproducible builds: week 31 in Stretch cycle by Lunar.
2015-12-11: Reproducible builds: week 32 in Stretch cycle by Lunar.
2015-12-14: Reproducible builds: week 33 in Stretch cycle by Lunar.
関連プロジェクト
CARE コマンド実行をモニタそ、それを同一の環境で再実行する上で必要なファイルを含むアーカイブを生成する仕組み
将来の展望
以下が容易となり、バイナリパッケージへの信頼性が向上すると見込まれます:
- どこに設置するか、法的にどの管轄下に入るかといった点でbuilddサーバの多様性が向上します。そしてパッケージを開発者のサーバも含む、複数箇所でビルドできるようになります。
- builddサーバの構成を多様にし、ハードウェアバグ、ハードウェアレベルの脆弱性への抵抗力を高めます - VM環境と実機の併用、異なるプロセッサベンダの利用、異なる製造日や供給元を選ぶことができます
- ビルド実施者が多様化し、.changesファイルへの複数人が署名するような形とできます(訳注:改竄への抵抗力が上がる)
- 様々なカーネルビルドが可能になります(後述)
カーネルや関連パッケージへの影響について
カーネル関係の様々なパッケージ(ブートローダやハイパーバイザも含む)に関連: GRUB2, Xen, linux, kfreebsdなど
- これらは非常に高い信頼性が要求されます - ユーザーランドから完全に隠れることができるカーネルは各種rootkitの究極の攻撃対象だからです
- amd64用カーネルを例にします。もしビルドシステムに移植性とビルド再現性があるならば、linux-amd64とkfreebsd-amd64のいずれの環境でビルドしても同じイメージとなります
- カーネルバージョンが異なる環境を使うこともできます。例えばwheezyホスト内のjessieビルド用のchrootなど
多様なビルド環境を担保すると同時に複数環境に影響する攻撃への耐性が向上します。カーネル脆弱性や大規模なrootkitへの感染を起こすためには、複数(OS、バージョン)のカーネルをまたいで攻撃できなくてはならなくなるためです。
