GPG

Differences between revisions 18 and 23 (spanning 5 versions)
Revision 18 as of 2013-06-13 19:32:48
Size: 13371
Editor: stgraber
Comment:
Revision 23 as of 2013-06-21 14:41:31
Size: 13984
Editor: stgraber
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
 * Update client (validate channels.json, index.json and all files)  * Client (validate channels.json, index.json and all files)
Line 10: Line 10:
 * MASTER: 3F272F5B 2007-11-09 Ubuntu Archive Master Signing Key <ftpmaster@ubuntu.com> (never expires)
 * SYSTEM IMAGE MASTER: Ubuntu System Image Master Signing Key <system-image@ubuntu.com> (never expires)
 * SYSTEM IMAGE SIGNING: Ubuntu System Image Signing Key (2013) <system-image@ubuntu.com> (expires after 2 years)
 * ARCHIVE MASTER: 3F272F5B 2007-11-09 Ubuntu Archive Master Signing Key <ftpmaster@ubuntu.com> (never expires)
 * IMAGE MASTER: Ubuntu System Image Master Signing Key <system-image@ubuntu.com> (never expires)
 * IMAGE SIGNING: Ubuntu System Image Signing Key (2013) <system-image@ubuntu.com> (expires after 2 years)
Line 15: Line 15:
 * master - mandatory, persistent, contains the MASTER key, unsigned (never changes, never expires)
 * system-image - mandatory, persistent, contains the SYSTEM IMAGE MASTER key, signed by the MASTER key (hopefully never changes, never expires)
 * signing - mandatory, persistent, contains the SYSTEM IMAGE SIGNING key, signed by the SYSTEM IMAGE MASTER key (updated regularly, expires after 2 years)
 * device - optional, temporary, contains the keys valid for the index.json and update files for the device, signed by the SYSTEM IMAGE SIGNING key (updated regularly, expires after a month)
 * blacklist - optional, persistent, contains any key that should no longer be trusted, signed by the SYSTEM IMAGE MASTER key
 * archive-master - mandatory, persistent, contains the ARCHIVE MASTER key, unsigned (never changes, never expires)
 * image-master - mandatory, persistent, contains the IMAGE MASTER key, signed by the ARCHIVE MASTER key (hopefully never changes, never expires)
 * image-signing - mandatory, persistent, contains the IMAGE SIGNING key, signed by the IMAGE MASTER key (updated regularly, expires after 2 years)
 * device-signing - optional, temporary, contains the keys valid for the index.json and update files for the device, signed by the IMAGE SIGNING key (updated regularly, expires after a month)
 * blacklist - optional, persistent, contains any key that should no longer be trusted, signed by the IMAGE MASTER key
Line 21: Line 21:
The client will ship with the master, system-image and signing keyrings on disk. Those will be updated as needed by the downloader.
The upgrader will ship with just the master keyring.
The client will ship with the archive master keyring on disk. If the client is shipped with the image-master and image-signing keyrings, the associated .tar.xz and .tar.xz.asc files will also be provided (see below). Those will be updated as needed by the client. The upgrader will ship with just the archive master keyring.
Line 24: Line 23:
The client pushes the system-image, signing and device (if present) keyrings to the cache partition for the upgrader to use. The client pushes the image-master, image-signing, and device-signing (if present) keyring tar.xz and .tar.xz.asc (signature) files to the cache partition for the upgrader to use.
Line 29: Line 28:
In the descriptions below, when a file's signature is checked for validity, it must be DIRECTLY signed by the specified key. Specifically, indirect signature chains are NOT supported. For example, if a file is said to be DIRECTLY signed by the image signing key, only the image signing key (inside the associated keyring) is acceptable. Even though the imaging signing keyring must be signed by the system image master key, the file itself cannot be signed by the system image master key or the archive master key. In the descriptions below, when a file's signature is checked for validity, it must be DIRECTLY signed by the specified key. Specifically, indirect signature chains are NOT supported. For example, if a file is said to be DIRECTLY signed by the image-signing key, only the image-signing key (inside the associated keyring) is acceptable. The file cannot be signed by the image-master key or the archive-master key, even though the image-signing key is signed by the image-master.
Line 31: Line 30:
Another point to clarify. Some files may be signed by either the image signing key, or the device/vendor signing key if there is one. When the device key is specified (i.e. in the index.json file), then files signed by either key are accepted. Another point to clarify. Some files may be signed by either the image-signing key, or the device-signing key if there is one. When the device-signing key is specified (i.e. in the index.json file), then files signed by either key are accepted.
Line 34: Line 33:
The blacklist keyring is a bit special, it differs from the others as being well, a blacklist instead of a whitelist.
Any key in that keyring, valid, revoked or expired will be considered as invalid during any signature validation process.

The blacklist keyring is a bit special. It differs from the others in that any key in that keyring is considered invalid during any signature validation process, regardless of whether the key is valid, revoked, or expired. Think of it as a set operation; we take the set of keys that signed a file and difference it with all the keys in the blacklist. The remaining keys are the valid signatures of the file.
Line 39: Line 38:
The reason behind this is that we need to always use an up to date blacklist keyring coming from a user inacessible location. Otherwise, a user flashing using eMMC could simply skip that keyring (as it's optional) and provide files signed from a compromised key (before the matching keyring expires) which would then be considered valid.
Similarly, we can't make the blacklist keyring mandatory as the user could then simply provide an older version of it when updating from eMMC. We can't make the keyring expire every month either as that keyring is signed from the system image key and so signature can't be automated.
The reason behind this is that we need to always use an up-to-date blacklist keyring coming from a user inaccessible location. Otherwise, a user flashing using eMMC could simply skip that keyring (as it's optional) and provide files signed from a compromised key (before the matching keyring expires) which would then be considered valid.
Similarly, we can't make the blacklist keyring mandatory as the user could then simply provide an older version of it when updating from eMMC. We can't make the keyring expire every month either as that keyring is signed by image-master key and so signature can't be automated.
Line 46: Line 45:
 * `https://server/gpg/system-image.tar.xz` is a GPG keyring tarball
 * `https://server/gpg/system-image.tar.xz.asc` is the signature for the system-image keyring. This is DIRECTLY signed by the MASTER key.
 * `https://server/gpg/signing.tar.xz` is a GPG keyring tarball
 * `https://server/gpg/signing.tar.xz.asc` is the signature for the system-image keyring. This is DIRECTLY signed by the SYSTEM IMAGE MASTER key.
 * `https://server/<channel>/<device>/device.tar.xz` is a GPG keyring tarball
 * `https://server/<channel>/<device>/device.tar.xz.asc` is the signature for the device keyring. This is DIRECTLY signed by the current SYSTEM IMAGE SIGNING key.
 * `https://server/gpg/image-master.tar.xz` is a GPG keyring tarball
 * `https://server/gpg/image-master.tar.xz.asc` is the signature for the image-master keyring. This is DIRECTLY signed by the ARCHIVE MASTER key.
 * `https://server/gpg/image-signing.tar.xz` is a GPG keyring tarball
 * `https://server/gpg/image-signing.tar.xz.asc` is the signature for the image-signing keyring. This is DIRECTLY signed by the IMAGE MASTER key.
 * `https://server/<channel>/<device>/device-signing.tar.xz` is a GPG keyring tarball
 * `https://server/<channel>/<device>/device-signing.tar.xz.asc` is the signature for the device-signing keyring. This is DIRECTLY signed by the current IMAGE SIGNING key.
Line 53: Line 52:
 * `https://server/gpg/blacklist.tar.xz.asc` is the signature for the blacklist keyring. This is DIRECTLY signed by the SYSTEM IMAGE MASTER key.  * `https://server/gpg/blacklist.tar.xz.asc` is the signature for the blacklist keyring. This is DIRECTLY signed by the IMAGE MASTER key.
Line 56: Line 55:
 * `https://server/channels.json` is ALWAYS DIRECTLY signed by the current SYSTEM IMAGE SIGNING key.
 * `https://server/<channel>/<device>/index.json` is ALWAYS DIRECTLY signed by a key contained in the keyring linked from channels.json or if no keyring linked, by the current SYSTEM IMAGE SIGNING key.
 * `https://server/channels.json` is ALWAYS DIRECTLY signed by the current IMAGE SIGNING key.
 * `https://server/<channel>/<device>/index.json` is ALWAYS DIRECTLY signed by the IMAGE SIGNING key, or a key contained in the keyring linked from channels.json (if present).
Line 66: Line 65:
  * type is one of "master", "system-image", "signing", "device" or "blacklist"   * type is one of "archive-master", "image-master", "image-signing", "device-signing" or "blacklist"
Line 78: Line 77:
 * The client has the MASTER key, the current SYSTEM IMAGE MASTER key and the current SYSTEM IMAGE SIGNING key in its keyring.  * The client has the ARCHIVE MASTER key, the current IMAGE MASTER key, and the current IMAGE SIGNING key in its keyring.
Line 80: Line 79:
 * The client attempts to grab https://server/channels.json, and validates its signature against the image signing key.
 * The client looks for the entry for the channel and device in use, if present it looks for and downloads a device keyring, and validates its signature against the image signing key.
 * The client then downloads and validates https://server/<channel>/<device>/index.json against the device keyring (if present) or the image signing keyring.
 * The update is then resolved, all files downloaded and validated against the device keyring (if present) or the signing keyring and copied to android:/cache/.
 * The client then exports system-image keyring as android:/cache/system-image.gpg
 * The client then exports signing keyring as android:/cache/signing.gpg
 * The client then exports the device keyring as android:/cache/device.gpg (if present)
 * The client attempts to grab https://server/channels.json, and validates its signature against the image-signing key.
 * The client looks for the entry for the channel and device in use, if present it looks for and downloads a device-signing keyring, and validates its signature against the image-signing key.
 * The client then downloads and validates https://server/<channel>/<device>/index.json against the image-signing keyring or the device-signing keyring (if present).
 * The update is then resolved, all files downloaded and validated against the image-signing keyring, or the device-signing keyring (if present), and copied to android:/cache/.
 * The client then exports image-master keyring as android:/cache/image-master.tar.xz and android:/cache/image-master.tar.xz.asc
 * The client then exports image-signing keyring as android:/cache/image-signing.tar.xz and android:/cache/image-signing.tar.xz.asc
 * The client then exports the device-signing keyring as android:/cache/device-signing.tar.xz and android:/cache/device-signing.tar.xz.asc (if present)
Line 91: Line 90:
   * The upgrader checks that the file is DIRECTLY signed by a key stored in either device.gpg (if present) or signing.gpg
   * If device.gpg is present, and the file is signed by a device key, the upgrader checks that the device key is DIRECTLY signed by a key stored in signing.gpg
   * The upgrader checks that the signing key is DIRECTLY signed by a key stored in system-image.gpg
   * The upgrader checks that the system-image key is DIRECTLY signed by the MASTER key which it has locally.
   * The upgrader checks that the file is DIRECTLY signed by a key stored in either the image-signing.tar.xz or device-signing.tar.xz (if present)
   * If device-signing.tar.xz is present, and the file is signed by a device-signing key, the upgrader checks that the device-signing key is DIRECTLY signed by a key stored in image-signing.tar.xz
   * The upgrader checks that the image-signing key is DIRECTLY signed by a key stored in image-master.tar.xz
   * The upgrader checks that the image-master key is DIRECTLY signed by the ARCHIVE MASTER key which it has locally.
Line 101: Line 100:
 1. Add the key to the blacklist keyring, have the keyring signed by the SYSTEM IMAGE MASTER key
 1. Issue a new device key (or keys depending on vendor)
 1. Generate a new device keyring with the new key
 1. Sign the new device keyring with the SYSTEM IMAGE SIGNING key
 1. Get new signed versions of any index.json and tarball signed by the old key
 1. Add the key to the blacklist keyring, have the keyring signed by the IMAGE MASTER key
 1. Issue a new device-signing key (or keys depending on vendor)
 1. Generate a new device-signing keyring with the new key
 1. Sign the new device keyring with the IMAGE SIGNING key
 1. Re-sign any index.json and tarball that were signed by the old key
Line 107: Line 106:
==== effect on the downloader ====
 * On the next check, the downloader will download a refreshed blacklist keyring
 * The new device keyring will be downloaded with the next update
==== effect on the client ====
 * On the next check, the client will download a refreshed blacklist keyring
 * The new device-signing keyring will be downloaded with the next update
Line 113: Line 112:
 * The upgrader will read the blacklist keyring from the system partition, so as soon as the donwloader runs once after revocation, the user won't be able to use something signed by the invalidated key.
 * If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user can have their system update to something signed by a key from the device keyring (using sdcard based flash) until the keyring expires (a month).
 * The upgrader will read the blacklist keyring from the system partition, so as soon as the client runs once after revocation, the user won't be able to use something signed by the invalidated key.
 * If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user can have their system update to something signed by a key from the device-signing keyring (using sdcard based flash) until the keyring expires (a month).
Line 117: Line 116:
=== compromised SYSTEM IMAGE SIGNING key === === compromised IMAGE SIGNING key ===
Line 120: Line 119:
 1. Add the key to the blacklist keyring, have the keyring signed by the SYSTEM IMAGE MASTER key
 1. Issue a new SYSTEM IMAGE SIGNING key
 1. Generate a new signing keyring with the new key
 1. Sign the new signing keyring with the SYSTEM IMAGE MASTER key
 1. Re-sign channels.json, all the index.json, all the device keyrings and any tarball signed by the old SYSTEM IMAGE SIGNING key
 1. Add the key to the blacklist keyring, have the keyring signed by the IMAGE MASTER key
 1. Issue a new IMAGE SIGNING key
 1. Generate a new image-signing keyring with the new key
 1. Sign the new image-signing keyring with the IMAGE MASTER key
 1. Re-sign channels.json, all the index.json, all the device-signing keyrings and any tarball that were signed by the old IMAGE SIGNING key
Line 126: Line 125:
==== effect on the downloader ====
 * On the next check, the download will download a refreshed blacklist keyring
 * Validation of channels.json will fail, causing a download of the signing keyring and its validation against the system-image keyring
==== effect on the client ====
 * On the next check, the client will download a refreshed blacklist keyring
 * Validation of channels.json will fail, causing a download of the image-signing keyring and its validation against the image-master keyring
Line 132: Line 131:
 * The upgrader will read the blacklist keyring from the system partition, so as soon as the donwloader runs once after revocation, the user won't be able to use something signed by the invalidated key.
 * If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user can have their system update to something signed by a key from the signing keyring (using sdcard based flash) until the keyring expires (2 years). It's to be noted that even though the device keyring will expire after a month (if used for the particular device), a new one can be generated from the compromised signing key.
 * The upgrader will read the blacklist keyring from the system partition, so as soon as the client runs once after revocation, the user won't be able to use something signed by the invalidated key.
 * If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user can have their system update to something signed by a key from the image-signing keyring (using sdcard based flash) until the keyring expires (2 years). It's to be noted that even though the device-signing keyring will expire after a month (if used for the particular device), a new one can be generated from the compromised image-signing key.
Line 137: Line 136:
=== compromised SYSTEM IMAGE MASTER key === === compromised IMAGE MASTER key ===
Line 140: Line 139:
 1. Issue a new SYSTEM IMAGE MASTER key
 1. Add the key to the blacklist keyring, have the keyring signed by the new SYSTEM IMAGE MASTER key
 1. Generate a new system-update keyring with the new key
 1. Sign the new system-update keyring with the MASTER key
 1. Re-sign the signing keyring with the new SYSTEM IMAGE MASTER key
 1. Issue a new IMAGE MASTER key
 1. Add the key to the blacklist keyring, have the keyring signed by the new IMAGE MASTER key
 1. Generate a new image-master keyring with the new key
 1. Sign the new image-master keyring with the ARCHIVE MASTER key
 1. Re-sign the image-signing keyring with the new IMAGE MASTER key
Line 146: Line 145:
==== effect on the downloader ==== ==== effect on the client ====
Line 148: Line 147:
 * Validation of the blacklist keyring will fail, causing a download of the system-image keyring and its validation against the master keyring
 * Validation of the signing keyring will fail, causing a download of the signing keyring and its validation against the system-image keyring
 * Validation of the blacklist keyring will fail, causing a download of the image-master keyring and its validation against the archive-master keyring
 * Validation of the image-signing keyring will fail, causing a download of the image-signing keyring and its validation against the image-master keyring
Line 151: Line 150:
 * MITM attacks are prevented by the use of the https certificate so an old version of the keyring can't be pushed to the client. If for some reason https could be intercepted and the client somehow would never be able to grab the new blacklist keyring, then the attacker would be able to fake the update server as the system-image keyring doesn't expire.  * MITM attacks are prevented by the use of the https certificate so an old version of the keyring can't be pushed to the client. If for some reason https could be intercepted and the client somehow would never be able to grab the new blacklist keyring, then the attacker would be able to fake the update server as the image-master keyring doesn't expire.
Line 154: Line 153:
 * The upgrader will read the blacklist keyring from the system partition, so as soon as the donwloader runs once after revocation, the user won't be able to use something signed by the invalidated key.
 * If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user could create a fake signing keyring and sign their images with that, the system-update keyring doesn't expire so there's nothing that'd make this stop after a while.
 * The upgrader will read the blacklist keyring from the system partition, so as soon as the client runs once after revocation, the user won't be able to use something signed by the invalidated key.
 * If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user could create a fake image-signing keyring and sign their images with that, the image-master keyring doesn't expire so there's nothing that'd make this stop after a while.

GPG key management

Introduction

To ensure all updates are signed, yet allow us to allow external entities to sign updates and handle the case where our key is compromised, the following GPG setup will be implemented.

Two different bits need to do GPG verification:

  • Client (validate channels.json, index.json and all files)
  • Upgrader (validate all files)

The following GPG key chain will be used:

The client has 4 keyrings:

  • archive-master - mandatory, persistent, contains the ARCHIVE MASTER key, unsigned (never changes, never expires)
  • image-master - mandatory, persistent, contains the IMAGE MASTER key, signed by the ARCHIVE MASTER key (hopefully never changes, never expires)
  • image-signing - mandatory, persistent, contains the IMAGE SIGNING key, signed by the IMAGE MASTER key (updated regularly, expires after 2 years)
  • device-signing - optional, temporary, contains the keys valid for the index.json and update files for the device, signed by the IMAGE SIGNING key (updated regularly, expires after a month)
  • blacklist - optional, persistent, contains any key that should no longer be trusted, signed by the IMAGE MASTER key

The client will ship with the archive master keyring on disk. If the client is shipped with the image-master and image-signing keyrings, the associated .tar.xz and .tar.xz.asc files will also be provided (see below). Those will be updated as needed by the client. The upgrader will ship with just the archive master keyring.

The client pushes the image-master, image-signing, and device-signing (if present) keyring tar.xz and .tar.xz.asc (signature) files to the cache partition for the upgrader to use. The upgrader will attempt to read the blacklist from the system partition, should it fail to do so, it'll continue without blacklist.

Signing and Validation

In the descriptions below, when a file's signature is checked for validity, it must be DIRECTLY signed by the specified key. Specifically, indirect signature chains are NOT supported. For example, if a file is said to be DIRECTLY signed by the image-signing key, only the image-signing key (inside the associated keyring) is acceptable. The file cannot be signed by the image-master key or the archive-master key, even though the image-signing key is signed by the image-master.

Another point to clarify. Some files may be signed by either the image-signing key, or the device-signing key if there is one. When the device-signing key is specified (i.e. in the index.json file), then files signed by either key are accepted.

Blacklist keyring

The blacklist keyring is a bit special. It differs from the others in that any key in that keyring is considered invalid during any signature validation process, regardless of whether the key is valid, revoked, or expired. Think of it as a set operation; we take the set of keys that signed a file and difference it with all the keys in the blacklist. The remaining keys are the valid signatures of the file.

This keyring is downloaded by the client, stored alongside the others in the data partition (but not in a user writable location) and ISN'T passed to the upgrader. Instead the upgrader accesses it directly from the data partition. If it can find it, it uses it, if it can't, it doesn't. A missing blacklist keyring won't lead to upgrade failure.

The reason behind this is that we need to always use an up-to-date blacklist keyring coming from a user inaccessible location. Otherwise, a user flashing using eMMC could simply skip that keyring (as it's optional) and provide files signed from a compromised key (before the matching keyring expires) which would then be considered valid. Similarly, we can't make the blacklist keyring mandatory as the user could then simply provide an older version of it when updating from eMMC. We can't make the keyring expire every month either as that keyring is signed by image-master key and so signature can't be automated.

Therefore the current design is the only reliable way of rapidly revoking keys and ensuring that no revoked key may be used for both over-the-air and over-the-wire updates.

Files

Keyrings

  • https://server/gpg/image-master.tar.xz is a GPG keyring tarball

  • https://server/gpg/image-master.tar.xz.asc is the signature for the image-master keyring. This is DIRECTLY signed by the ARCHIVE MASTER key.

  • https://server/gpg/image-signing.tar.xz is a GPG keyring tarball

  • https://server/gpg/image-signing.tar.xz.asc is the signature for the image-signing keyring. This is DIRECTLY signed by the IMAGE MASTER key.

  • https://server/<channel>/<device>/device-signing.tar.xz is a GPG keyring tarball

  • https://server/<channel>/<device>/device-signing.tar.xz.asc is the signature for the device-signing keyring. This is DIRECTLY signed by the current IMAGE SIGNING key.

  • https://server/gpg/blacklist.tar.xz is a GPG keyring tarball

  • https://server/gpg/blacklist.tar.xz.asc is the signature for the blacklist keyring. This is DIRECTLY signed by the IMAGE MASTER key.

Other files

  • https://server/channels.json is ALWAYS DIRECTLY signed by the current IMAGE SIGNING key.

  • https://server/<channel>/<device>/index.json is ALWAYS DIRECTLY signed by the IMAGE SIGNING key, or a key contained in the keyring linked from channels.json (if present).

GPG keyring tarball format

The GPG keyrings will be distributed as .tar.xz tarballs with a detached (.asc) GPG signature.

The content of those tarballs will be made of two files:

  • keyring.gpg - a standard GPG keyring
  • keyring.json - a JSON file with the following syntax
    • expiry is a UTC UNIX EPOCH at which the keyring should be considered invalid (optional, defaults to no-expiry)
    • type is one of "archive-master", "image-master", "image-signing", "device-signing" or "blacklist"
    • model is the name of the model this keyring applies to (optional, defaults to any model)

{
    'expiry': 123456,
    'type': 'blacklist',
    'model': nexus7
}

Use cases

Standard update

  • The client has the ARCHIVE MASTER key, the current IMAGE MASTER key, and the current IMAGE SIGNING key in its keyring.
  • The client downloads the blacklist from https://server/gpg/blacklist.tar.xz (and .asc) and loads all the invalid fingerprints

  • The client attempts to grab https://server/channels.json, and validates its signature against the image-signing key.

  • The client looks for the entry for the channel and device in use, if present it looks for and downloads a device-signing keyring, and validates its signature against the image-signing key.
  • The client then downloads and validates https://server/<channel>/<device>/index.json against the image-signing keyring or the device-signing keyring (if present).

  • The update is then resolved, all files downloaded and validated against the image-signing keyring, or the device-signing keyring (if present), and copied to android:/cache/.
  • The client then exports image-master keyring as android:/cache/image-master.tar.xz and android:/cache/image-master.tar.xz.asc
  • The client then exports image-signing keyring as android:/cache/image-signing.tar.xz and android:/cache/image-signing.tar.xz.asc
  • The client then exports the device-signing keyring as android:/cache/device-signing.tar.xz and android:/cache/device-signing.tar.xz.asc (if present)
  • The upgrader loads the blacklist keyring from the system partition (if possible)
  • Any key contained in the blacklist will be removed from the keyrings before any validation will be done.
  • {for every file}
    • The upgrader checks that the file is DIRECTLY signed by a key stored in either the image-signing.tar.xz or device-signing.tar.xz (if present)
    • If device-signing.tar.xz is present, and the file is signed by a device-signing key, the upgrader checks that the device-signing key is DIRECTLY signed by a key stored in image-signing.tar.xz
    • The upgrader checks that the image-signing key is DIRECTLY signed by a key stored in image-master.tar.xz
    • The upgrader checks that the image-master key is DIRECTLY signed by the ARCHIVE MASTER key which it has locally.
    • Once all checks pass, the file is unpacked and applied

compromised device key

procedure

  1. Revoke the key if possible and publish to the GPG network
  2. Add the key to the blacklist keyring, have the keyring signed by the IMAGE MASTER key
  3. Issue a new device-signing key (or keys depending on vendor)
  4. Generate a new device-signing keyring with the new key
  5. Sign the new device keyring with the IMAGE SIGNING key
  6. Re-sign any index.json and tarball that were signed by the old key

effect on the client

  • On the next check, the client will download a refreshed blacklist keyring
  • The new device-signing keyring will be downloaded with the next update
  • MITM attacks are prevented by the use of the https certificate so an old version of the keyring can't be pushed to the client. If for some reason https could be intercepted and the client somehow would never be able to grab the new blacklist keyring, then the expiry set on the keyring would make it invalid after a month.

effect on the upgrader

  • The upgrader will read the blacklist keyring from the system partition, so as soon as the client runs once after revocation, the user won't be able to use something signed by the invalidated key.
  • If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user can have their system update to something signed by a key from the device-signing keyring (using sdcard based flash) until the keyring expires (a month).

compromised IMAGE SIGNING key

procedure

  1. Revoke the key and publish to the GPG network
  2. Add the key to the blacklist keyring, have the keyring signed by the IMAGE MASTER key
  3. Issue a new IMAGE SIGNING key
  4. Generate a new image-signing keyring with the new key
  5. Sign the new image-signing keyring with the IMAGE MASTER key
  6. Re-sign channels.json, all the index.json, all the device-signing keyrings and any tarball that were signed by the old IMAGE SIGNING key

effect on the client

  • On the next check, the client will download a refreshed blacklist keyring
  • Validation of channels.json will fail, causing a download of the image-signing keyring and its validation against the image-master keyring
  • MITM attacks are prevented by the use of the https certificate so an old version of the keyring can't be pushed to the client. If for some reason https could be intercepted and the client somehow would never be able to grab the new blacklist keyring, then the expiry set on the keyring and the key would make it invalid after two years.

effect on the upgrader

  • The upgrader will read the blacklist keyring from the system partition, so as soon as the client runs once after revocation, the user won't be able to use something signed by the invalidated key.
  • If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user can have their system update to something signed by a key from the image-signing keyring (using sdcard based flash) until the keyring expires (2 years). It's to be noted that even though the device-signing keyring will expire after a month (if used for the particular device), a new one can be generated from the compromised image-signing key.

compromised IMAGE MASTER key

procedure

  1. Revoke the key and publish to the GPG network
  2. Issue a new IMAGE MASTER key
  3. Add the key to the blacklist keyring, have the keyring signed by the new IMAGE MASTER key
  4. Generate a new image-master keyring with the new key
  5. Sign the new image-master keyring with the ARCHIVE MASTER key
  6. Re-sign the image-signing keyring with the new IMAGE MASTER key

effect on the client

  • On the next check, the download will try to download a refreshed blacklist keyring
  • Validation of the blacklist keyring will fail, causing a download of the image-master keyring and its validation against the archive-master keyring
  • Validation of the image-signing keyring will fail, causing a download of the image-signing keyring and its validation against the image-master keyring
  • The rest continues as normal
  • MITM attacks are prevented by the use of the https certificate so an old version of the keyring can't be pushed to the client. If for some reason https could be intercepted and the client somehow would never be able to grab the new blacklist keyring, then the attacker would be able to fake the update server as the image-master keyring doesn't expire.

effect on the upgrader

  • The upgrader will read the blacklist keyring from the system partition, so as soon as the client runs once after revocation, the user won't be able to use something signed by the invalidated key.
  • If the system partition doesn't contain the revoked entry or the blacklist can't be read for some reason then a user could create a fake image-signing keyring and sign their images with that, the image-master keyring doesn't expire so there's nothing that'd make this stop after a while.

compromised archive master key

That should never happen as there's nothing we can do if that happens short of re-generating all the keys and hoping we can get the users to update to a fixed system before anyone abuses the compromised key.

ImageBasedUpgrades/GPG (last edited 2013-06-21 14:41:31 by stgraber)