14
Thursday 2006-12-14:
BackstageUniversally Unique Identifiers (UUID)
The secret of the universe is @*&^^^ NO CARRIER
OpenPKG internally uses so-called ISO/IEC 11578:1996 compliant
Universally Unique Identifiers (UUID) for multiple purposes.
UUIDs are 128 bit numbers which are intended to have a
high likelihood of uniqueness over space and time and are
computationally difficult to guess. They are globally unique
identifiers which can be locally gener- ated without contacting
a global registration authority. UUIDs are intended as unique
identifiers for both mass tagging objects with an extremely short
lifetime and to reliably identifying very persistent objects
across a network. The following classical UUIDs exist:
- Version 1 (time and node based):
These are the classical UUIDs, created out of a 60-bit system time, a 14-bit local clock sequence and 48-bit system MAC address. The MAC address can be either the real one of a physical network inter- face card (NIC) or a random multi-cast MAC address. Version 1 UUIDs are usually used as one-time global unique identifiers. - Version 3 (name based, MD5):
These are UUIDs which are based on the 128-bit MD5 message digest of the concatenation of a 128-bit namespace UUID and a name string of arbitrary length. Version 3 UUIDs are usually used for non- unique but repeatable message digest identifiers. - Version 4 (random data based):
These are UUIDs which are based on just 128-bit of random data. Version 4 UUIDs are usually used as one-time local unique identi- fiers. - Version 5 (name based, SHA-1):
These are UUIDs which are based on the 160-bit SHA-1 message digest of the concatenation of a 128-bit namespace UUID and a name string of arbitrary length. Version 5 UUIDs are usually used for non- unique but repeatable message digest identifiers.
$ uuid -v1
ea809a7a-82c5-11db-99f8-0050C2658000
$ uuid -d ea809a7a-82c5-11db-99f8-0050C2658000
encode: STR: ea809a7a-82c5-11db-99f8-0050c2658000
SIV: 311707098208948855287837949761685913600
decode: variant: DCE 1.1, ISO/IEC 11578:1996
version: 1 (time and node based)
content: time: 2006-12-03 12:00:49.202649.0 UTC
clock: 6648 (usually random)
node: 00:50:c2:65:80:00 (global unicast)
$ uuid -v3 ns:URL http://openpkg.org/
59a93cb2-2d6d-37da-9189-ee2a936667b3
$ uuid -d 59a93cb2-2d6d-37da-9189-ee2a936667b3
encode: STR: 59a93cb2-2d6d-37da-9189-ee2a936667b3
SIV: 119180020855197907315270474376254220211
decode: variant: DCE 1.1, ISO/IEC 11578:1996
version: 3 (name based, MD5)
content: 59:A9:3C:B2:2D:6D:07:DA:11:89:EE:2A:93:66:67:B3
(not decipherable: MD5 message digest only)
$ uuid -v4
72d58797-ddab-4742-b6b4-22c842547306
$ uuid -d 72d58797-ddab-4742-b6b4-22c842547306
encode: STR: 72d58797-ddab-4742-b6b4-22c842547306
SIV: 152640700907700610429675150335047660294
decode: variant: DCE 1.1, ISO/IEC 11578:1996
version: 4 (random data based)
content: 72:D5:87:97:DD:AB:07:42:36:B4:22:C8:42:54:73:06
(no semantics: random data only)
As you can see, version 1 UUIDs are time, random data and network node
(MAC address) based, version 3 UUIDs are name based (via MD5 hashing)
and version 4 UUIDs are just random data based. This means version
1 UUIDs can be used for the classical globally unique identifiers,
version 3 UUIDs can be used for deterministic identifiers (e.g. for
identifying URLs as in the example above) and version 5 UUIDs are
nothing more than 128 bit of randomness.
Now let's see what OpenPKG does with UUIDs:
$ openpkg uuid info
OpenPKG Summary of Identification Information
=============================================
OpenPKG Registry
System Time: 2004-09-17 06:43:14.257097.0 UTC
System Clock Sequence: 14582 (usually random)
System Node Address: 00:02:a5:48:9f:14 (global unicast)
UUID_REGISTRY: d98267da-0874-11d9-b8f6-0002a5489f14
OpenPKG Instance
Release: OpenPKG-CURRENT
Prefix: /usr/opkg
Super Account: root(0):wheel(0)
Management Account: opkg(1000):opkg(1000)
Restricted Account: opkg-r(1001):opkg-r(1001)
Nonprivileged Account: opkg-n(1002):opkg-n(1002)
UUID_INSTANCE: 1169823e-22db-3547-9f72-20c2ef18619f
OpenPKG Platform
Platform Id: ix86-freebsd6.2
Host Name: host.example.com
Host IP Address #1 10.0.0.1
Host IP Address #2 127.0.0.1
UUID_PLATFORM: 252dea7f-b840-3410-8a23-52a24f7afaf0
As you can see, OpenPKG uses three particular UUIDs in each OpenPKG instance:
- OpenPKG Registry (UUID_REGISTRY)
This is a version 1 UUID which uniquely identifiers the OpenPKG instance for global registration purposes. It is generated just once in the lifetime of the OpenPKG instance. The value of this UUID can- not be recalculated deterministically. - OpenPKG Instance (UUID_INSTANCE)
This is a version 3 UUID which summarizes the OpenPKG instance parameters. Currently the values of the following particular OpenPKG RPM macros are uses as input:%{l_openpkg_release} %{l_prefix} %{l_susr} %{l_suid} %{l_sgrp} %{l_sgid} %{l_musr} %{l_muid} %{l_mgrp} %{l_mgid} %{l_rusr} %{l_ruid} %{l_rgrp} %{l_rgid} %{l_nusr} %{l_nuid} %{l_ngrp} %{l_ngid}The value of this UUID can be recalculated deterministically and will not chance as long as none of the values of the above macro do not change. This UUID can be used for detecting OpenPKG release upgrades, accidentally changed UIDs or GIDs, etc. Notice that ver- sion 3 UUIDs are message digests (actually MD5 based) and so are one-way functions which do not allow one to recalculate the input values from the UUID. - OpenPKG Platform (UUID_PLATFORM)
This is a version 3 UUID which summarizes the OpenPKG platform parameters. Currently the OpenPKG RPM platform id plus the FQDN and IP address of the underlying host are used as input. This UUID can be used for detecting operating system and host changes. Notice that version 3 UUIDs are message digests (actually MD5 based) and so are one-way functions which do not allow one to recalculate the input values from the UUID.
$ cat `openpkg rpm --eval '%{l_prefix}/etc/openpkg/uuid'`
UUID_REGISTRY="d98267da-0874-11d9-b8f6-0002a5489f14"
UUID_INSTANCE="1169823e-22db-3547-9f72-20c2ef18619f"
UUID_PLATFORM="252dea7f-b840-3410-8a23-52a24f7afaf0"