Uwe Ohse homepage



         upgprules - compile rules for upgpverify


upgpverify CDB TMP [INPUT]


upgpverify verifies, if told to do so, whether the signing key matches the rules in CDB.

upgprules compiles the rules in INPUT (or stdin) into CDB, a binary format suited for quick access by upgpverify.

upgprules can be used while upgpverify is running. It ensures that cdb is updated atomically. It does this by first writing the rules to tmp and then moving tmp on top of cdb. If tmp already exists, it is destroyed. The directories containing cdb and tmp must be writable to tcprules; they must also be on the same filesystem.

If there is a problem with the input or with tmp, upgprules complains and leaves cdb alone.

The binary cdb format is portable across machines.


INPUT lines starting with a hash (#) are ignored, as are empty lines. All other lines are rules.

Each rule consists of an identification, a colon, an instruction and a list of environment variable assignments.


An identification is a tag character followed by a star (*) symbol and a free-form string. The later must not contain a colon (:).

The tag character is used to distinguish the five different kinds of identifications, which are listed in order of preference:

A fingerprint, only available if GNU privacy guard (gpg) is used.

A long key id, only available if GNU privacy guard (gpg) is used.

A short key id.

A User ID: A free-form string. Note that the User ID may be choosen freely by an attacker (so watch out what you are doing).

An email address. upgpverify parses the user id of the signing key and looks up every email address found in it against the database.

The preference mentioned above is my personal preference. While the email address may be quite handy it's important not to forget that strange things might happen if you accept a public key which contains the email address of someone else - who might have more rights than the owner of the key (this also applies, to a lesser degree, to the user ID).


There are two:


Environment Variable Assignments

An environment variable assignment contains a comma (,), a variable name, an equal sign (=), a quote character, a value and another quote character. The quote character may be choosen freely. Another assignment may follow.

The general form of an assignment is ,var=``value'', where `` may be any character not found in value.


    upgprules etc/rules.cdb etc/rules.t <<EOF
    s*71EC423D:allow,why="short key id"
    s*5B86ABE571EC423D:allow,why="long key id"
    u*Uwe Ohse (RSA) <uwe@ohse.de>:allow,why=%uid%


Uwe Ohse