{% extends "global/layout.html" %} {% block title %}{% trans %}I2P Software Update Specification{% endtrans %}{% endblock %} {% block lastupdated %}{% trans %}July 2013{% endtrans %}{% endblock %} {% block accuratefor %}0.9.7{% endblock %} {% block content %}

{% trans %}Overview{% endtrans %}

{% trans -%} I2P uses a simple, yet secure, system for automated software update. The router console periodically pulls a news file from a configurable I2P URL. There is a hardcoded backup URL pointing to the project website, in case the default project news host goes down. {%- endtrans %}

{% trans -%} The contents of the news file are displayed on the home page of the router console. In addition, the news file contains the most recent version number of the software. If the version is higher than the router's version number, it will display an indication to the user that an update is available. {%- endtrans %}

{% trans -%} The router may optionally download, or download and install, the new version if configured to do so. {%- endtrans %}

{% trans %}News File Specification{% endtrans %}

{% trans -%} The news.xml file may contain the following elements: {%- endtrans %}

<i2p.news date="$Date: 2010-01-22 00:00:00 $" />
<i2p.release version="0.7.14" date="2010/01/22" minVersion="0.6" />

{% trans -%} The elements may be included inside XML comments to prevent interpretation by browsers. The i2p.release element and version are required. All others are optional and are currently unused. {%- endtrans %}

{% trans -%} The news source is trusted only to indicate that a new version is available. It does not specify the URL of the update, the checksum, or any other information. {%- endtrans %}

{% trans %}Update File Specification{% endtrans %}

{% trans -%} The signed update file, traditionally named i2pupdate.sud, is simply a zip file with a prepended 56 byte header. The header contains: {%- endtrans %}

{% trans commonstructures=site_url('docs/spec/common-structures') -%} The signature covers only the zip archive - not the prepended version. The signature must match one of the DSA public keys configured into the router, which has a hardcoded default list of keys of the current project release managers. {%- endtrans %}

{% trans -%} For version comparison purposes, version fields contain [0-9]*, field separators are '-', '_', and '.', and all other characters are ignored. {%- endtrans %}

{% trans -%} As of version 0.8.8, the version must also be specified as a zip file comment in UTF-8, without the trailing zeroes. The updating router verifes that the version in the header (not covered by the signature) matches the version in the zip file comment, which is covered by the signature. This prevents spoofing of the version number in the header. {%- endtrans %}

{% trans %}Download and Installation{% endtrans %}

{% trans -%} The router first downloads the header of the update file from one in a configurable list of I2P URLs, using the built-in HTTP client and proxy, and checks that the version is newer. This prevents the problem of update hosts that do not have the latest file. The router then downloads the full update file. The router verifies that the update file version is newer before installation. It also, of course, verifies the signature, and verifes that the zip file comment matches the header version, as explained above. {%- endtrans %}

{% trans -%} The zip file is extracted in the base $I2P installation directory. {%- endtrans %}

{% trans -%} As of release 0.7.12, the router supports Pack200 decompression. Files inside the zip archive with a .jar.pack or .war.pack suffix are transparently decompressed to a .jar or .war file. Update files containing .pack files are traditionally named with a '.su2' suffix. Pack200 shrinks the update files by about 60%. {%- endtrans %}

{% trans -%} As of release 0.8.7, the router will delete the libjbigi.so and libjcpuid.so files if the zip archive contains a lib/jbigi.jar file, so that the new files will be extracted from jbigi.jar. {%- endtrans %}

{% trans -%} As of release 0.8.12, if the zip archive contains a file deletelist.txt, the router will delete the files listed there. The format is: {%- endtrans %}

{% trans -%} The router will then delete the deletelist.txt file. {%- endtrans %}

{% trans %}New "su3" Update File Specification{% endtrans %}

{% trans -%} This specification is preliminary and is not yet implemented. {%- endtrans %}

{% trans %}Issues with existing .sud/.su2 format:{% endtrans %}

{% trans %}Goals:{% endtrans %}

{% trans %}Specification:{% endtrans %}

BytesContents
0-5 Magic number "I2Psu3"
6 unused = 0
7 su3 file format version = 0
8 unused
9 Signature type 0x00 = DSA-160, 0x01 = new algo
10-11 Signature length 40 (0x0028) = DSA-160
12 unused
13 Version length (in bytes not chars, including padding) must be at least 16 (0x10) for compatibility
14 unused
15 Signer ID length (in bytes not chars)
16-23 Compressed content length (not including header or sig)
24 unused
25 Compressed type 0x00 = zip
26 unused
27 Content type 0x00 = router w/o pack200, 0x01 = router w/ pack200, 0x02 = plugin
28-39 unused
40-55+ Version, UTF-8 padded with trailing 0x00, 16 bytes min.
xx+ ID of signer, (e.g. "zzz@mail.i2p") UTF-8, not padded
xx+ Compressed content, length and format specified in header No requirement on the zip file comment since the sig covers the version.
xx+ Signature, length specified in header, covers everything starting at byte 0

{% trans -%} All unused fields must be set to 0 for compatibility with future versions. {%- endtrans %}

{% trans %}Future Work{% endtrans %}

{% endblock %}