paul@11 | 1 | Introduction
|
paul@11 | 2 | ------------
|
paul@11 | 3 |
|
paul@11 | 4 | MoinMessage provides a library for creating, signing, encrypting, decrypting,
|
paul@12 | 5 | and verifying PGP/GPG content in Python along with mechanisms for updating
|
paul@51 | 6 | MoinMoin wiki instances with such content such that contributors can be
|
paul@11 | 7 | identified from their PGP signatures and such details used to authenticate
|
paul@63 | 8 | their contributions. It also permits PGP/GPG content to be stored in dedicated
|
paul@63 | 9 | message stores when received, enabling further processing of received content
|
paul@63 | 10 | and other means of perusal of such content.
|
paul@11 | 11 |
|
paul@11 | 12 | Configuring GPG for a Wiki
|
paul@11 | 13 | --------------------------
|
paul@11 | 14 |
|
paul@37 | 15 | Initialise a homedir for GPG and configure it using filesystem ACL (access
|
paul@37 | 16 | control list) properties:
|
paul@11 | 17 |
|
paul@12 | 18 | ./scripts/init_wiki_keyring.sh WIKI WEBUSER
|
paul@12 | 19 |
|
paul@51 | 20 | Here, WIKI should be replaced by the top-level wiki instance directory, and
|
paul@12 | 21 | WEBUSER should be the name of the user under which the Web server operates.
|
paul@12 | 22 |
|
paul@12 | 23 | Note that this script may need re-running after the homedir has been changed
|
paul@12 | 24 | by gpg operations as gpg likes to remove permissions from various files.
|
paul@11 | 25 |
|
paul@66 | 26 | Configuring GPG: Signing Keys
|
paul@66 | 27 | -----------------------------
|
paul@66 | 28 |
|
paul@67 | 29 | For a wiki to be able to receive content, signing keys must be made available
|
paul@67 | 30 | within the wiki's GPG homedir so that incoming messages can have their senders
|
paul@67 | 31 | verified.
|
paul@11 | 32 |
|
paul@67 | 33 | Consider the need to send content to a wiki yourself. To see the keys
|
paul@67 | 34 | available to you in your own environment:
|
paul@11 | 35 |
|
paul@11 | 36 | gpg --list-keys --with-fingerprint
|
paul@11 | 37 |
|
paul@51 | 38 | The full fingerprints are used when defining a user mapping in the wiki, and
|
paul@11 | 39 | the --with-fingerprint option is used to show them. Otherwise, only the last
|
paul@11 | 40 | eight characters of the fingerprints are shown.
|
paul@11 | 41 |
|
paul@11 | 42 | Export the public key used when signing messages from your own environment:
|
paul@11 | 43 |
|
paul@11 | 44 | gpg --armor --output 1C1AAF83.asc --export 1C1AAF83
|
paul@11 | 45 |
|
paul@51 | 46 | Import the key into the wiki's GPG homedir:
|
paul@11 | 47 |
|
paul@65 | 48 | gpg --homedir WIKI/gnupg --import 1C1AAF83.asc
|
paul@11 | 49 |
|
paul@67 | 50 | Signing keys can also be used in the authoring of messages within a wiki, and
|
paul@67 | 51 | this is discussed in "The Username-to-Signing-Key Mapping" section below.
|
paul@67 | 52 |
|
paul@66 | 53 | Configuring GPG: Encryption Keys
|
paul@66 | 54 | --------------------------------
|
paul@66 | 55 |
|
paul@66 | 56 | For the wiki to receive and decrypt encrypted data, a key for the wiki must be
|
paul@66 | 57 | created:
|
paul@11 | 58 |
|
paul@65 | 59 | gpg --homedir WIKI/gnupg --gen-key
|
paul@11 | 60 |
|
paul@51 | 61 | For the wiki environment to be able to use the key, password access must be
|
paul@12 | 62 | disabled. This can be done by either not specifying a password or by removing
|
paul@59 | 63 | it later using the --edit-key option:
|
paul@59 | 64 |
|
paul@65 | 65 | gpg --homedir WIKI/gnupg --edit-key 0891463A
|
paul@59 | 66 | passwd
|
paul@12 | 67 |
|
paul@51 | 68 | Export the wiki's key for encrypting messages sent to the wiki:
|
paul@11 | 69 |
|
paul@65 | 70 | gpg --homedir WIKI/gnupg --armor --output 0891463A.asc --export 0891463A
|
paul@11 | 71 |
|
paul@11 | 72 | This exported key can now be imported into your own environment:
|
paul@11 | 73 |
|
paul@11 | 74 | gpg --import 0891463A.asc
|
paul@11 | 75 |
|
paul@72 | 76 | This key can also be used to sign relayed messages within the wiki, and this
|
paul@72 | 77 | is described in more detail in "The Username-to-Signing-Key Mapping" section
|
paul@72 | 78 | below.
|
paul@66 | 79 |
|
paul@11 | 80 | Configuring the Wiki
|
paul@11 | 81 | --------------------
|
paul@11 | 82 |
|
paul@51 | 83 | In the wiki configuration, define the following settings:
|
paul@11 | 84 |
|
paul@11 | 85 | moinmessage_gpg_homedir
|
paul@11 | 86 | This sets the path to the homedir initialised above.
|
paul@11 | 87 |
|
paul@11 | 88 | moinmessage_gpg_users_page (optional, default is MoinMessageUserDict)
|
paul@11 | 89 | This provides a mapping from key fingerprints to Moin usernames.
|
paul@11 | 90 |
|
paul@12 | 91 | moinmessage_gpg_signing_users_page (optional, default is MoinMessageSigningUserDict)
|
paul@12 | 92 | This provides a mapping from Moin usernames to key fingerprints.
|
paul@12 | 93 |
|
paul@65 | 94 | moinmessage_gpg_relaying_user (optional)
|
paul@65 | 95 | This specifies the username of a special user who will sign relayed
|
paul@65 | 96 | messages. Partner wikis will need to record the details of this user in
|
paul@65 | 97 | their fingerprint-to-user mapping (see moinmessage_gpg_users_page) to be
|
paul@65 | 98 | able to receive messages from this wiki.
|
paul@65 | 99 |
|
paul@68 | 100 | moinmessage_gpg_relays_page (optional, default is MoinMessageRelayDict)
|
paul@68 | 101 | Where message relaying is specified for a recipient, the relay name will be
|
paul@68 | 102 | looked up in the dictionary provided by this page.
|
paul@68 | 103 |
|
paul@12 | 104 | moinmessage_gpg_recipients_page (optional, default is MoinMessageRecipientsDict)
|
paul@12 | 105 | This provides a mapping from recipients to remote URLs and key fingerprints.
|
paul@37 | 106 | Each user can define the named page as a subpage of their own home page.
|
paul@37 | 107 | If no such personal mapping exists, a common mapping exists relative to the
|
paul@37 | 108 | site root.
|
paul@12 | 109 |
|
paul@20 | 110 | moinmessage_reject_messages_without_dates (optional, default is True)
|
paul@51 | 111 | This causes messages sent to a wiki using the PostMessage action to be
|
paul@20 | 112 | rejected if date information is missing.
|
paul@20 | 113 |
|
paul@40 | 114 | moinmessage_static_files (optional, may refer to the built-in htdocs directory)
|
paul@40 | 115 | This explicitly defines the path to static resources used by Moin, enabling
|
paul@40 | 116 | such resources to be attached to messages. When set, the path must refer to
|
paul@40 | 117 | the htdocs directory (possibly renamed) containing the different theme
|
paul@65 | 118 | resource directories, together with the robots.txt and favicon.ico files.
|
paul@40 | 119 |
|
paul@38 | 120 | For signature verification to function, the following needs to be added:
|
paul@38 | 121 |
|
paul@38 | 122 | from MoinMoin.auth.pgp import PGPAuth
|
paul@38 | 123 |
|
paul@38 | 124 | This should import an authentication handler installed when the MoinMessage
|
paul@38 | 125 | software is installed as an extension package.
|
paul@38 | 126 |
|
paul@38 | 127 | Within the configuration class itself, the auth setting needs to be updated to
|
paul@38 | 128 | include PGPAuth in the list of registered handlers. For example:
|
paul@38 | 129 |
|
paul@38 | 130 | auth = [MoinAuth(), PGPAuth()]
|
paul@38 | 131 |
|
paul@38 | 132 | This would permit the traditional Moin authentication and add signature-based
|
paul@51 | 133 | authentication so that messages can be accepted by the wiki.
|
paul@38 | 134 |
|
paul@12 | 135 | Fingerprints and Keys
|
paul@12 | 136 | ---------------------
|
paul@12 | 137 |
|
paul@12 | 138 | All fingerprints mentioned in the various configuration pages must exclude
|
paul@12 | 139 | space characters - that is, the letters and digits must appear together in a
|
paul@51 | 140 | continuous block of text - and refer to keys available in the wiki homedir.
|
paul@12 | 141 |
|
paul@11 | 142 | The Fingerprint-to-Username Mapping
|
paul@11 | 143 | -----------------------------------
|
paul@11 | 144 |
|
paul@12 | 145 | The mapping from fingerprints to usernames typically defined by the
|
paul@12 | 146 | MoinMessageUserDict page is a WikiDict having the following general format:
|
paul@11 | 147 |
|
paul@11 | 148 | fingerprint:: username
|
paul@11 | 149 |
|
paul@12 | 150 | Each fingerprint corresponds to a key used by a person wanting to send
|
paul@51 | 151 | messages to the wiki to sign such messages.
|
paul@11 | 152 |
|
paul@51 | 153 | Each username must correspond to a registered user in the wiki.
|
paul@11 | 154 |
|
paul@65 | 155 | If a wiki is to perform message relaying, receiving messages from partner
|
paul@65 | 156 | wikis and sending them on, a user is required for this purpose. You could
|
paul@65 | 157 | create such a user as follows:
|
paul@65 | 158 |
|
paul@66 | 159 | moin --config-dir=WIKI account create --name=RelayingUser --email=messagerelay
|
paul@65 | 160 |
|
paul@65 | 161 | (You may need to run this command as the Web server user to be able to change
|
paul@65 | 162 | the wiki installation, as well as indicating the full path to the moin program
|
paul@65 | 163 | either as the program name or by setting the PATH.)
|
paul@65 | 164 |
|
paul@65 | 165 | After doing this, you could define an entry for the relaying user as follows:
|
paul@65 | 166 |
|
paul@66 | 167 | fingerprint:: RelayingUser
|
paul@65 | 168 |
|
paul@65 | 169 | Here, "fingerprint" should be substituted for a key fingerprint used by a
|
paul@65 | 170 | partner wiki to sign messages that it then sends to this wiki. See the next
|
paul@65 | 171 | section for more information on signing keys and identities.
|
paul@65 | 172 |
|
paul@65 | 173 | It may very well be the case that more than one partner wiki will be sending
|
paul@65 | 174 | messages to this wiki: the signing key fingerprint of each partner wiki can be
|
paul@65 | 175 | added to this mapping and specify the same relaying user; there is no
|
paul@65 | 176 | restriction on each fingerprint needing to map to a different user.
|
paul@65 | 177 |
|
paul@85 | 178 | The Username-to-Actions Mapping
|
paul@85 | 179 | -------------------------------
|
paul@85 | 180 |
|
paul@85 | 181 | Each user may have a set of permitted actions defined for them so that they
|
paul@85 | 182 | may perform these actions by sending an incoming message to the wiki. This
|
paul@85 | 183 | mapping is typically defined by the MoinMessageUserActionsDict page as a
|
paul@85 | 184 | WikiDict having the following general format:
|
paul@85 | 185 |
|
paul@85 | 186 | username:: permitted-action ...
|
paul@85 | 187 |
|
paul@85 | 188 | To add content to a page, an entry of the following form would be used:
|
paul@85 | 189 |
|
paul@85 | 190 | username:: Update:SomePage
|
paul@85 | 191 |
|
paul@85 | 192 | Similarly, to allow an incoming message to replace a page's content, the
|
paul@85 | 193 | following would be used:
|
paul@85 | 194 |
|
paul@85 | 195 | username:: Replace:SomePage
|
paul@85 | 196 |
|
paul@85 | 197 | And to be able to add messages to a page's message store, the following would
|
paul@85 | 198 | be used:
|
paul@85 | 199 |
|
paul@85 | 200 | username:: Store:SomePage
|
paul@85 | 201 |
|
paul@85 | 202 | Multiple actions can be given in a space-separated list, with shell-like
|
paul@85 | 203 | quoting used for names containing spaces (and quote characters). For example:
|
paul@85 | 204 |
|
paul@85 | 205 | username:: Store:"Some user's special page"
|
paul@85 | 206 |
|
paul@85 | 207 | Without an entry in this mapping, messages may not perform content
|
paul@85 | 208 | modification or storage actions in the wiki.
|
paul@85 | 209 |
|
paul@67 | 210 | The Username-to-Signing-Key Mapping
|
paul@12 | 211 | -----------------------------------
|
paul@12 | 212 |
|
paul@12 | 213 | The mapping from usernames to fingerprints typically defined by the
|
paul@12 | 214 | MoinMessageSigningUserDict page is a WikiDict having the following general
|
paul@12 | 215 | format:
|
paul@12 | 216 |
|
paul@12 | 217 | username:: fingerprint
|
paul@12 | 218 |
|
paul@51 | 219 | Each fingerprint corresponds to a key available in the wiki's GPG homedir
|
paul@12 | 220 | generated for the purpose of signing the specified user's messages. Such a key
|
paul@51 | 221 | is not the same as one used by a person to send messages to the wiki since
|
paul@51 | 222 | only the public key is available to the wiki when verifying such messages,
|
paul@51 | 223 | whereas the signing of messages requires access to a private key. Thus, the
|
paul@51 | 224 | signing process employs a special private key known to the wiki for a user.
|
paul@12 | 225 |
|
paul@67 | 226 | To create such a key, the following command can be used:
|
paul@67 | 227 |
|
paul@67 | 228 | gpg --homedir WIKI/gnupg --gen-key
|
paul@67 | 229 |
|
paul@67 | 230 | This is just like creating a key for the wiki itself (see "Configuring GPG for
|
paul@67 | 231 | a Wiki" above), but you will label the key appropriately for the user and
|
paul@67 | 232 | associate the key with the user in the mapping described above. Remember to
|
paul@67 | 233 | remove the passphrase so that the wiki can access the key.
|
paul@67 | 234 |
|
paul@65 | 235 | If a wiki is to perform message relaying, the special relaying user must be
|
paul@65 | 236 | defined in this mapping together with an appropriate key fingerprint. You can
|
paul@65 | 237 | use the key generated during the wiki's configuration (see "Configuring GPG
|
paul@65 | 238 | for a Wiki" above) for this purpose. This fingerprint can then be used by
|
paul@65 | 239 | partner wikis in their fingerprint-to-user mapping in order to verify incoming
|
paul@65 | 240 | messages and to process them as relayed messages.
|
paul@65 | 241 |
|
paul@72 | 242 | All signing keys must be made available in their public form to partner and
|
paul@72 | 243 | recipient wikis so that they are able to verify signed content. This can be
|
paul@72 | 244 | done as follows:
|
paul@72 | 245 |
|
paul@72 | 246 | gpg --homedir=WIKI/gnupg --armor --output 3FDDF29E.asc --export 3FDDF29E
|
paul@72 | 247 |
|
paul@72 | 248 | They are imported into partner and recipient wikis as follows:
|
paul@72 | 249 |
|
paul@72 | 250 | gpg --homedir=WIKI/gnupg --import 3FDDF29E.asc
|
paul@72 | 251 |
|
paul@12 | 252 | The Recipients Mapping
|
paul@12 | 253 | ----------------------
|
paul@12 | 254 |
|
paul@12 | 255 | The mapping from recipients to remote URLs and fingerprints typically defined
|
paul@12 | 256 | by the MoinMessageRecipientsDict page is a WikiDict having the following
|
paul@12 | 257 | general format:
|
paul@12 | 258 |
|
paul@43 | 259 | recipient:: type location [ fingerprint ]
|
paul@27 | 260 |
|
paul@43 | 261 | Where the type is "page", the accompanying location must be a page name
|
paul@28 | 262 | indicating a page that provides a message store that will accept messages.
|
paul@63 | 263 | The affected page resides on the same wiki and is thus a bare page name, not
|
paul@63 | 264 | the URL of a page on the same or another wiki.
|
paul@12 | 265 |
|
paul@43 | 266 | Where the type is "url", the accompanying location must be a URL that must
|
paul@43 | 267 | itself refer to a resource that can accept MoinMessage content.
|
paul@12 | 268 |
|
paul@68 | 269 | Where the type is "relay", the accompanying location is an identifier that
|
paul@68 | 270 | must be defined in the relays mapping (see below) and yield a URL that can
|
paul@68 | 271 | accept MoinMessage content.
|
paul@68 | 272 |
|
paul@84 | 273 | Where the type is "none" or omitted completely, the recipient is any user that
|
paul@84 | 274 | is allowed to fetch messages from the wiki.
|
paul@84 | 275 |
|
paul@84 | 276 | Where a type of "url", "relay" or "none" has been given (or if the type is
|
paul@84 | 277 | omitted), a fingerprint must accompany this information in order to encrypt
|
paul@84 | 278 | messages sent to the specified resource.
|
paul@27 | 279 |
|
paul@51 | 280 | Each fingerprint corresponds to a key used by the wiki to encrypt messages and
|
paul@27 | 281 | by the remote site (as identified by the URL) to decrypt messages.
|
paul@12 | 282 |
|
paul@55 | 283 | Each wiki user can have their own recipients mapping by making a page, called
|
paul@55 | 284 | MoinMessageRecipientsDict unless overridden by the configuration, as a subpage
|
paul@55 | 285 | of their own home page.
|
paul@55 | 286 |
|
paul@68 | 287 | The Relays Mapping
|
paul@68 | 288 | ------------------
|
paul@68 | 289 |
|
paul@68 | 290 | The mapping from relay identifiers to remote URLs defined by the
|
paul@68 | 291 | MoinMessageRelayDict page is a WikiDict having the following general format:
|
paul@68 | 292 |
|
paul@68 | 293 | relay:: url
|
paul@68 | 294 |
|
paul@68 | 295 | The URL must be able to accept MoinMessage content, and it will typically be
|
paul@68 | 296 | configured so that the user or entity accepting relayed content on the remote
|
paul@68 | 297 | site can store such content for later propagation or retrieval.
|
paul@68 | 298 |
|
paul@11 | 299 | Quick Start: Signing, Encrypting and Sending Messages
|
paul@11 | 300 | -----------------------------------------------------
|
paul@11 | 301 |
|
paul@11 | 302 | To send a message signed and encrypted to a resource on localhost:
|
paul@11 | 303 |
|
paul@12 | 304 | python tests/test_send.py 1C1AAF83 0891463A http://localhost/wiki/ShareTest \
|
paul@51 | 305 | collection update 'An update to the wiki.' 'Another update.'
|
paul@11 | 306 |
|
paul@11 | 307 | Here, the first identifier is a reference to the signing key (over which you
|
paul@11 | 308 | have complete control), and the second identifier is a reference to the
|
paul@51 | 309 | encryption key (which is a public key published for the wiki).
|
paul@11 | 310 |
|
paul@11 | 311 | This needs password protection to be removed from the secret key in the Web
|
paul@12 | 312 | server environment. It also uses a modified trust model when invoking gpg in
|
paul@12 | 313 | order to avoid complaints about the identity of the sender during encryption.
|
paul@11 | 314 |
|
paul@45 | 315 | To sign the encrypted message for forwarding, the above command is modified:
|
paul@45 | 316 |
|
paul@45 | 317 | python tests/test_send.py 1C1AAF83 0891463A --forward 1C1AAF83 \
|
paul@45 | 318 | http://localhost/wiki/ShareTest \
|
paul@51 | 319 | collection update 'An update to the wiki.' 'Another update.'
|
paul@45 | 320 |
|
paul@83 | 321 | Explicit recipient information can be provided for routing purposes:
|
paul@83 | 322 |
|
paul@83 | 323 | python tests/test_send.py 1C1AAF83 0891463A --to PaulBoddie \
|
paul@83 | 324 | --forward 1C1AAF83 \
|
paul@83 | 325 | http://localhost/wiki/ShareTest \
|
paul@83 | 326 | collection update 'An update to the wiki.' 'Another update.'
|
paul@83 | 327 |
|
paul@11 | 328 | Below, the mechanisms employed are illustrated through the use of the other
|
paul@11 | 329 | test programs.
|
paul@11 | 330 |
|
paul@11 | 331 | Signing
|
paul@11 | 332 | -------
|
paul@11 | 333 |
|
paul@11 | 334 | Prepare a message signed with a "detached signature" (note that this does not
|
paul@11 | 335 | seem to be what gpg calls a detached signature with the --detach-sig option):
|
paul@11 | 336 |
|
paul@51 | 337 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@16 | 338 | 'Another update.' \
|
paul@11 | 339 | | python tests/test_sign.py 1C1AAF83
|
paul@11 | 340 |
|
paul@11 | 341 | The complicated recipe based on the individual operations is as follows:
|
paul@11 | 342 |
|
paul@51 | 343 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@16 | 344 | 'Another update.' \
|
paul@90 | 345 | | python tests/test_message_wrap.py \
|
paul@11 | 346 | > test.txt \
|
paul@11 | 347 | && cat test.txt \
|
paul@11 | 348 | | gpg --armor -u 1C1AAF83 --detach-sig \
|
paul@11 | 349 | | python tests/test_sign_wrap.py test.txt
|
paul@11 | 350 |
|
paul@11 | 351 | Encryption
|
paul@11 | 352 | ----------
|
paul@11 | 353 |
|
paul@11 | 354 | Prepare a message with an encrypted payload using the above key:
|
paul@11 | 355 |
|
paul@51 | 356 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@16 | 357 | 'Another update.' \
|
paul@11 | 358 | | python tests/test_encrypt.py 0891463A
|
paul@11 | 359 |
|
paul@11 | 360 | The complicated recipe based on the individual operations is as follows:
|
paul@11 | 361 |
|
paul@51 | 362 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@16 | 363 | 'Another update.' \
|
paul@11 | 364 | > test.txt \
|
paul@11 | 365 | && cat test.txt \
|
paul@11 | 366 | | gpg --armor -r 0891463A --encrypt --trust-model always \
|
paul@11 | 367 | | python tests/test_encrypt_wrap.py
|
paul@11 | 368 |
|
paul@11 | 369 | Note that "--trust-model always" is used only to avoid prompting issues.
|
paul@11 | 370 |
|
paul@11 | 371 | Signing and Encrypting
|
paul@11 | 372 | ----------------------
|
paul@11 | 373 |
|
paul@12 | 374 | Sign and encrypt a message:
|
paul@11 | 375 |
|
paul@51 | 376 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@16 | 377 | 'Another update.' \
|
paul@11 | 378 | | python tests/test_sign.py 1C1AAF83 \
|
paul@11 | 379 | | python tests/test_encrypt.py 0891463A
|
paul@11 | 380 |
|
paul@11 | 381 | The complicated recipe based on the individual operations is as follows:
|
paul@11 | 382 |
|
paul@51 | 383 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@16 | 384 | 'Another update.' \
|
paul@11 | 385 | > test.txt \
|
paul@11 | 386 | && cat test.txt \
|
paul@11 | 387 | | gpg --armor -u 1C1AAF83 --detach-sig \
|
paul@11 | 388 | | python tests/test_sign_wrap.py test.txt \
|
paul@11 | 389 | | gpg --armor -r 0891463A --encrypt --trust-model always \
|
paul@11 | 390 | | python tests/test_encrypt_wrap.py
|
paul@11 | 391 |
|
paul@45 | 392 | Signing and Encrypting then Signing
|
paul@45 | 393 | -----------------------------------
|
paul@45 | 394 |
|
paul@45 | 395 | Where a message is to be forwarded and not decrypted, it will be signed by the
|
paul@45 | 396 | author, encrypted, but then signed by the forwarder (perhaps initially the
|
paul@45 | 397 | author):
|
paul@45 | 398 |
|
paul@51 | 399 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@45 | 400 | 'Another update.' \
|
paul@45 | 401 | | python tests/test_sign.py 1C1AAF83 \
|
paul@45 | 402 | | python tests/test_encrypt.py 0891463A \
|
paul@45 | 403 | | python tests/test_sign.py 1C1AAF83
|
paul@45 | 404 |
|
paul@45 | 405 | The complicated recipe based on the individual operations is as follows:
|
paul@45 | 406 |
|
paul@51 | 407 | python tests/test_message.py collection update 'An update to the wiki.' \
|
paul@45 | 408 | 'Another update.' \
|
paul@45 | 409 | > test.txt \
|
paul@45 | 410 | && cat test.txt \
|
paul@45 | 411 | | gpg --armor -u 1C1AAF83 --detach-sig \
|
paul@45 | 412 | | python tests/test_sign_wrap.py test.txt \
|
paul@45 | 413 | | gpg --armor -r 0891463A --encrypt --trust-model always \
|
paul@45 | 414 | | python tests/test_encrypt_wrap.py \
|
paul@45 | 415 | > test2.txt \
|
paul@45 | 416 | && cat test2.txt \
|
paul@45 | 417 | | gpg --armor -u 1C1AAF83 --detach-sig \
|
paul@45 | 418 | | python tests/test_sign_wrap.py test2.txt
|
paul@45 | 419 |
|
paul@11 | 420 | Posting a Message
|
paul@11 | 421 | -----------------
|
paul@11 | 422 |
|
paul@11 | 423 | To post a signed and/or encrypted message, output from the above activities
|
paul@11 | 424 | can be piped into the following command:
|
paul@11 | 425 |
|
paul@12 | 426 | python tests/test_post.py http://localhost/wiki/ShareTest
|
paul@11 | 427 |
|
paul@11 | 428 | Here, the resource "/wiki/ShareTest" on localhost is presented with the
|
paul@11 | 429 | message.
|
paul@16 | 430 |
|
paul@32 | 431 | Fetching Messages
|
paul@32 | 432 | -----------------
|
paul@32 | 433 |
|
paul@32 | 434 | To fetch messages from a message store associated with a page, the following
|
paul@32 | 435 | command can be used:
|
paul@32 | 436 |
|
paul@32 | 437 | python tests/test_fetch.py 1C1AAF83 0891463A http://localhost/wiki/ShareTest \
|
paul@32 | 438 | RETR
|
paul@32 | 439 |
|
paul@32 | 440 | This should retrieve all messages from the store associated with the
|
paul@32 | 441 | "/wiki/ShareTest" resource on localhost.
|
paul@32 | 442 |
|
paul@76 | 443 | Exporting and Sending Keys
|
paul@76 | 444 | --------------------------
|
paul@76 | 445 |
|
paul@76 | 446 | To export a public key, the following command can be used:
|
paul@76 | 447 |
|
paul@76 | 448 | python tests/text_export.py 1C1AAF83
|
paul@76 | 449 |
|
paul@76 | 450 | This will output a public key block in a MIME message part suitable for
|
paul@76 | 451 | incorporation into a larger message or signing. Signing a message containing
|
paul@76 | 452 | such a key can be done as follows:
|
paul@76 | 453 |
|
paul@76 | 454 | python tests/text_export.py 1C1AAF83 \
|
paul@76 | 455 | | python tests/test_sign.py 1C1AAF83
|
paul@76 | 456 |
|
paul@76 | 457 | Obviously, this does not provide any additional reassurance about the nature
|
paul@76 | 458 | of the exported key other than the originator was able to sign it with the
|
paul@76 | 459 | same keypair information.
|
paul@76 | 460 |
|
paul@16 | 461 | The Message Format
|
paul@16 | 462 | ------------------
|
paul@16 | 463 |
|
paul@16 | 464 | Messages are MIME-encoded and consist of one or more update fragments. Where
|
paul@16 | 465 | the "Update-Type" header is present and set to a value of "collection", a
|
paul@16 | 466 | multipart message describes as many updates as there are parts. Otherwise,
|
paul@16 | 467 | only a single update is described by the message.
|
paul@16 | 468 |
|
paul@16 | 469 | For each update, the "Update-Action" header indicates the action to be taken
|
paul@16 | 470 | with the update content. Where it is absent, the content is inserted into the
|
paul@51 | 471 | wiki page specified in the request; where it is present and set to "replace",
|
paul@51 | 472 | the content replaces all content on the wiki page; where it is set to "store",
|
paul@51 | 473 | the content is stored in a message store associated with the wiki page.
|
paul@16 | 474 |
|
paul@16 | 475 | Each update may describe multiple representations of some content by employing
|
paul@44 | 476 | a multipart/alternative section containing parts for each of the
|
paul@44 | 477 | representations. Alternatively, a single message part may describe a single
|
paul@44 | 478 | representation.
|
paul@44 | 479 |
|
paul@44 | 480 | HTTP Methods
|
paul@44 | 481 | ------------
|
paul@44 | 482 |
|
paul@44 | 483 | Since MoinMoin seems to reserve POST methods for request/entity bodies that
|
paul@44 | 484 | contain HTML form data, it is necessary to use alternative methods to post
|
paul@44 | 485 | messages to a site served by MoinMoin and to fetch messages from such a site.
|
paul@57 | 486 | Consequently, MoinMessage uses PUT to post and fetch messages. Unfortunately,
|
paul@57 | 487 | MoinMoin 1.9 prevents the use of GET with request/entity bodies, and so the
|
paul@57 | 488 | natural usage of GET to fetch messages cannot be employed.
|
paul@54 | 489 |
|
paul@54 | 490 | Contact, Copyright and Licence Information
|
paul@54 | 491 | ------------------------------------------
|
paul@54 | 492 |
|
paul@54 | 493 | See the following Web page for more information about this work:
|
paul@54 | 494 |
|
paul@54 | 495 | http://moinmo.in/ActionMarket/MoinMessage
|
paul@54 | 496 |
|
paul@54 | 497 | The author can be contacted at the following e-mail address:
|
paul@54 | 498 |
|
paul@54 | 499 | paul@boddie.org.uk
|
paul@54 | 500 |
|
paul@54 | 501 | Copyright and licence information can be found in the docs directory - see
|
paul@54 | 502 | docs/COPYING.txt and docs/LICENCE.txt for more information.
|
paul@54 | 503 |
|
paul@54 | 504 | Dependencies
|
paul@54 | 505 | ------------
|
paul@54 | 506 |
|
paul@54 | 507 | MoinMessage has the following basic dependencies:
|
paul@54 | 508 |
|
paul@54 | 509 | Packages Release Information
|
paul@54 | 510 | -------- -------------------
|
paul@54 | 511 |
|
paul@74 | 512 | MoinSupport Tested with 0.5
|
paul@54 | 513 | Source: http://hgweb.boddie.org.uk/MoinSupport
|