1 Return-Path: <jrollins@servo.finestructure.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id B87EA431FB6
\r
6 for <notmuch@notmuchmail.org>; Wed, 25 May 2011 18:01:41 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5
\r
12 tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id IINXHzid94ai for <notmuch@notmuchmail.org>;
\r
17 Wed, 25 May 2011 18:01:37 -0700 (PDT)
\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
20 by olra.theworths.org (Postfix) with ESMTP id 79A69429E3A
\r
21 for <notmuch@notmuchmail.org>; Wed, 25 May 2011 18:01:34 -0700 (PDT)
\r
22 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
23 by fire-doxen-postvirus (Postfix) with ESMTP id 787CB2E50E75;
\r
24 Wed, 25 May 2011 17:55:19 -0700 (PDT)
\r
25 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
26 Received: from servo.finestructure.net (gwave-104.ligo.caltech.edu
\r
27 [131.215.114.104]) (Authenticated sender: jrollins)
\r
28 by fire-doxen-submit (Postfix) with ESMTP id 0AAA43282CD;
\r
29 Wed, 25 May 2011 17:55:14 -0700 (PDT)
\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)
\r
31 id 7DD747C8; Wed, 25 May 2011 18:01:26 -0700 (PDT)
\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
33 To: notmuch@notmuchmail.org
\r
34 Subject: [PATCH 07/11] test: add crypto tests for signature verification and
\r
36 Date: Wed, 25 May 2011 18:01:16 -0700
\r
37 Message-Id: <1306371680-19441-8-git-send-email-jrollins@finestructure.net>
\r
38 X-Mailer: git-send-email 1.7.4.4
\r
39 In-Reply-To: <1306371680-19441-1-git-send-email-jrollins@finestructure.net>
\r
40 References: <1306371680-19441-1-git-send-email-jrollins@finestructure.net>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Thu, 26 May 2011 01:01:42 -0000
\r
55 This adds a new "crypto" test script to the test suite to test
\r
56 PGP/MIME signature verification and message decryption. Included here
\r
57 is a test GNUPGHOME with a test secret key (passwordless), and test
\r
60 * signing/verification
\r
61 * signing/verification with full owner trust
\r
62 * verification with signer key unavailable
\r
63 * encryption/decryption
\r
64 * decryption failure with missing key
\r
65 * encryption/decryption + signing/verfifying
\r
66 * reply to encrypted message
\r
67 * verification of signature from revoked key
\r
69 These tests are not expected to pass now, but will as crypto
\r
70 functionality is included.
\r
73 test/crypto | 330 ++++++++++++++++++++++++++++++++++++++++++++
\r
74 test/gnupg-secret-key.NOTE | 9 ++
\r
75 test/gnupg-secret-key.asc | 34 +++++
\r
76 test/notmuch-test | 1 +
\r
77 test/test-lib.sh | 29 ++++
\r
78 6 files changed, 407 insertions(+), 1 deletions(-)
\r
79 create mode 100755 test/crypto
\r
80 create mode 100644 test/gnupg-secret-key.NOTE
\r
81 create mode 100644 test/gnupg-secret-key.asc
\r
83 diff --git a/test/basic b/test/basic
\r
84 index 3b43ad9..d6c0d00 100755
\r
87 @@ -57,7 +57,10 @@ available=$(ls -1 ../ | \
\r
88 sed -r -e "/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d" \
\r
89 -e "/^(README|test-lib.sh|test-results|tmp.*|valgrind|corpus*)/d" \
\r
90 -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose)/d" \
\r
91 - -e "/^(test.expected-output|.*~)/d" | sort)
\r
92 + -e "/^(test.expected-output|.*~)/d" \
\r
93 + -e "/^(gnupg-secret-key.asc)/d" \
\r
94 + -e "/^(gnupg-secret-key.NOTE)/d" \
\r
96 test_expect_equal "$tests_in_suite" "$available"
\r
98 EXPECTED=../test.expected-output
\r
99 diff --git a/test/crypto b/test/crypto
\r
100 new file mode 100755
\r
101 index 0000000..3b0f381
\r
108 +# - decryption/verification with signer key not available
\r
109 +# - verification of signatures from expired/revoked keys
\r
111 +test_description='PGP/MIME signature verification and decryption'
\r
117 + [ -d ${GNUPGHOME} ] && return
\r
118 + mkdir -m 0700 "$GNUPGHOME"
\r
119 + gpg --no-tty --import <../gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1
\r
120 + test_debug "cat $GNUPGHOME/import.log"
\r
121 + if (gpg --quick-random --version >/dev/null 2>&1) ; then
\r
122 + echo quick-random >> "$GNUPGHOME"/gpg.conf
\r
123 + elif (gpg --debug-quick-random --version >/dev/null 2>&1) ; then
\r
124 + echo debug-quick-random >> "$GNUPGHOME"/gpg.conf
\r
128 +##################################################
\r
131 +# get key fingerprint
\r
132 +FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)
\r
134 +# for some reason this is needed for emacs_deliver_message to work,
\r
135 +# although I can't figure out why
\r
138 +test_expect_success 'emacs delivery of signed message' \
\r
139 +'emacs_deliver_message \
\r
140 + "test signed message 001" \
\r
141 + "This is a test signed message." \
\r
142 + "(mml-secure-message-sign)"'
\r
144 +test_begin_subtest "signature verification"
\r
145 +output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
146 + | notmuch_json_show_sanitize \
\r
147 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
148 +expected='[[[{"id": "XXXXX",
\r
150 + "filename": "YYYYY",
\r
151 + "timestamp": 946728000,
\r
152 + "date_relative": "2000-01-01",
\r
153 + "tags": ["inbox"],
\r
154 + "headers": {"Subject": "test signed message 001",
\r
155 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
156 + "To": "test_suite@notmuchmail.org",
\r
159 + "Date": "01 Jan 2000 12:00:00 -0000"},
\r
160 + "body": [{"id": 1,
\r
161 + "sigstatus": [{"status": "good",
\r
162 + "fingerprint": "'$FINGERPRINT'",
\r
163 + "created": 946728000}],
\r
164 + "content-type": "text/plain",
\r
165 + "content": "This is a test signed message.\n"}]},
\r
167 +test_expect_equal \
\r
171 +test_begin_subtest "signature verification with full owner trust"
\r
172 +# give the key full owner trust
\r
173 +echo "${FINGERPRINT}:6:" | gpg --no-tty --import-ownertrust >>"$GNUPGHOME"/trust.log 2>&1
\r
174 +gpg --no-tty --check-trustdb >>"$GNUPGHOME"/trust.log 2>&1
\r
175 +output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
176 + | notmuch_json_show_sanitize \
\r
177 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
178 +expected='[[[{"id": "XXXXX",
\r
180 + "filename": "YYYYY",
\r
181 + "timestamp": 946728000,
\r
182 + "date_relative": "2000-01-01",
\r
183 + "tags": ["inbox"],
\r
184 + "headers": {"Subject": "test signed message 001",
\r
185 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
186 + "To": "test_suite@notmuchmail.org",
\r
189 + "Date": "01 Jan 2000 12:00:00 -0000"},
\r
190 + "body": [{"id": 1,
\r
191 + "sigstatus": [{"status": "good",
\r
192 + "fingerprint": "'$FINGERPRINT'",
\r
193 + "created": 946728000,
\r
194 + "userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}],
\r
195 + "content-type": "text/plain",
\r
196 + "content": "This is a test signed message.\n"}]},
\r
198 +test_expect_equal \
\r
202 +test_begin_subtest "signature verification with signer key unavailable"
\r
203 +# move the gnupghome temporarily out of the way
\r
204 +mv "${GNUPGHOME}"{,.bak}
\r
205 +output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
206 + | notmuch_json_show_sanitize \
\r
207 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
208 +expected='[[[{"id": "XXXXX",
\r
210 + "filename": "YYYYY",
\r
211 + "timestamp": 946728000,
\r
212 + "date_relative": "2000-01-01",
\r
213 + "tags": ["inbox"],
\r
214 + "headers": {"Subject": "test signed message 001",
\r
215 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
216 + "To": "test_suite@notmuchmail.org",
\r
219 + "Date": "01 Jan 2000 12:00:00 -0000"},
\r
220 + "body": [{"id": 1,
\r
221 + "sigstatus": [{"status": "error",
\r
222 + "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'",
\r
224 + "content-type": "text/plain",
\r
225 + "content": "This is a test signed message.\n"}]},
\r
227 +test_expect_equal \
\r
230 +mv "${GNUPGHOME}"{.bak,}
\r
232 +# create a test encrypted message with attachment
\r
233 +cat <<EOF >TESTATTACHMENT
\r
234 +This is a test file.
\r
236 +test_expect_success 'emacs delivery of encrypted message with attachment' \
\r
237 +'emacs_deliver_message \
\r
238 + "test encrypted message 001" \
\r
239 + "This is a test encrypted message.\n" \
\r
240 + "(mml-attach-file \"TESTATTACHMENT\") (mml-secure-message-encrypt)"'
\r
242 +test_begin_subtest "decryption, --format=text"
\r
243 +output=$(notmuch show --format=text --decrypt subject:"test encrypted message 001" \
\r
244 + | notmuch_show_sanitize_all \
\r
245 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
247 message{ id:XXXXX depth:0 match:1 filename:XXXXX
\r
250 +Notmuch Test Suite <test_suite@notmuchmail.org> (2000-01-01) (inbox)
\r
251 +Subject: test encrypted message 001
\r
252 +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
253 +To: test_suite@notmuchmail.org
\r
254 +Date: 01 Jan 2000 12:00:00 -0000
\r
260 part{ ID: 1, Content-type: multipart/mixed
\r
262 part{ ID: 2, Content-type: text/plain
\r
263 +This is a test encrypted message.
\r
267 attachment{ ID: 3, Content-type: application/octet-stream
\r
268 +Attachment: TESTATTACHMENT (application/octet-stream)
\r
269 +Non-text part: application/octet-stream
\r
278 +test_expect_equal \
\r
282 +test_begin_subtest "decryption, --format=json"
\r
283 +output=$(notmuch show --format=json --decrypt subject:"test encrypted message 001" \
\r
284 + | notmuch_json_show_sanitize \
\r
285 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
286 +expected='[[[{"id": "XXXXX",
\r
288 + "filename": "YYYYY",
\r
289 + "timestamp": 946728000,
\r
290 + "date_relative": "2000-01-01",
\r
291 + "tags": ["inbox"],
\r
292 + "headers": {"Subject": "test encrypted message 001",
\r
293 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
294 + "To": "test_suite@notmuchmail.org",
\r
297 + "Date": "01 Jan 2000 12:00:00 -0000"},
\r
298 + "body": [{"id": 1,
\r
299 + "encstatus": [{"status": "good"}],
\r
301 + "content-type": "multipart/mixed",
\r
302 + "content": [{"id": 2,
\r
303 + "content-type": "text/plain",
\r
304 + "content": "This is a test encrypted message.\n"},
\r
306 + "content-type": "application/octet-stream",
\r
307 + "filename": "TESTATTACHMENT"}]}]},
\r
309 +test_expect_equal \
\r
313 +test_begin_subtest "decryption, --format=json, --part=2"
\r
314 +output=$(notmuch show --format=json --part=2 --decrypt subject:"test encrypted message 001" \
\r
315 + | notmuch_json_show_sanitize \
\r
316 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
317 +expected='{"id": 2,
\r
318 + "content-type": "text/plain",
\r
319 + "content": "This is a test encrypted message.\n"}'
\r
320 +test_expect_equal \
\r
324 +test_begin_subtest "decrypt attachment (--part=3 --format=raw)"
\r
329 + subject:"test encrypted message 001" >OUTPUT
\r
330 +test_expect_equal_file OUTPUT TESTATTACHMENT
\r
332 +test_begin_subtest "decryption failure with missing key"
\r
333 +mv "${GNUPGHOME}"{,.bak}
\r
334 +output=$(notmuch show --format=json --decrypt subject:"test encrypted message 001" \
\r
335 + | notmuch_json_show_sanitize \
\r
336 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
337 +expected='[[[{"id": "XXXXX",
\r
339 + "filename": "YYYYY",
\r
340 + "timestamp": 946728000,
\r
341 + "date_relative": "2000-01-01",
\r
342 + "tags": ["inbox"],
\r
343 + "headers": {"Subject": "test encrypted message 001",
\r
344 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
345 + "To": "test_suite@notmuchmail.org",
\r
348 + "Date": "01 Jan 2000 12:00:00 -0000"},
\r
349 + "body": [{"id": 1,
\r
350 + "encstatus": [{"status": "bad"}],
\r
351 + "content-type": "multipart/encrypted",
\r
352 + "content": [{"id": 2,
\r
353 + "content-type": "application/pgp-encrypted"},
\r
355 + "content-type": "application/octet-stream"}]}]},
\r
357 +test_expect_equal \
\r
360 +mv "${GNUPGHOME}"{.bak,}
\r
362 +test_expect_success 'emacs delivery of encrypted + signed message' \
\r
363 +'emacs_deliver_message \
\r
364 + "test encrypted message 002" \
\r
365 + "This is another test encrypted message.\n" \
\r
366 + "(mml-secure-message-sign-encrypt)"'
\r
368 +test_begin_subtest "decryption + signature verification"
\r
369 +output=$(notmuch show --format=json --decrypt subject:"test encrypted message 002" \
\r
370 + | notmuch_json_show_sanitize \
\r
371 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
372 +expected='[[[{"id": "XXXXX",
\r
374 + "filename": "YYYYY",
\r
375 + "timestamp": 946728000,
\r
376 + "date_relative": "2000-01-01",
\r
377 + "tags": ["inbox"],
\r
378 + "headers": {"Subject": "test encrypted message 002",
\r
379 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
380 + "To": "test_suite@notmuchmail.org",
\r
383 + "Date": "01 Jan 2000 12:00:00 -0000"},
\r
384 + "body": [{"id": 1,
\r
385 + "encstatus": [{"status": "good"}],
\r
386 + "sigstatus": [{"status": "good",
\r
387 + "fingerprint": "'$FINGERPRINT'",
\r
388 + "created": 946728000,
\r
389 + "userid": " Notmuch Test Suite <test_suite@notmuchmail.org> (INSECURE!)"}],
\r
390 + "content-type": "text/plain",
\r
391 + "content": "This is another test encrypted message.\n"}]},
\r
393 +test_expect_equal \
\r
397 +test_begin_subtest "reply to encrypted message"
\r
398 +output=$(notmuch reply --decrypt subject:"test encrypted message 002" \
\r
399 + | grep -v -e '^In-Reply-To:' -e '^References:')
\r
400 +expected='From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
401 +Subject: Re: test encrypted message 002
\r
403 +On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
\r
404 +> This is another test encrypted message.'
\r
405 +test_expect_equal \
\r
409 +test_begin_subtest "signature verification with revoked key"
\r
410 +# generate revokation certificate and load it to revoke key
\r
413 +Notmuch Test Suite key revocation (automated) $(date '+%F_%T%z')
\r
418 + | gpg --no-tty --quiet --command-fd 0 --armor --gen-revoke "0x${FINGERPRINT}!" 2>/dev/null \
\r
419 + | gpg --no-tty --quiet --import
\r
420 +output=$(notmuch show --format=json --verify subject:"test signed message 001" \
\r
421 + | notmuch_json_show_sanitize \
\r
422 + | sed -e 's|"created": [1234567890]*|"created": 946728000|')
\r
423 +expected='[[[{"id": "XXXXX",
\r
425 + "filename": "YYYYY",
\r
426 + "timestamp": 946728000,
\r
427 + "date_relative": "2000-01-01",
\r
428 + "tags": ["inbox"],
\r
429 + "headers": {"Subject": "test signed message 001",
\r
430 + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
431 + "To": "test_suite@notmuchmail.org",
\r
434 + "Date": "01 Jan 2000 12:00:00 -0000"},
\r
435 + "body": [{"id": 1,
\r
436 + "sigstatus": [{"status": "error",
\r
437 + "keyid": "6D92612D94E46381",
\r
439 + "content-type": "text/plain",
\r
440 + "content": "This is a test signed message.\n"}]},
\r
442 +test_expect_equal \
\r
447 diff --git a/test/gnupg-secret-key.NOTE b/test/gnupg-secret-key.NOTE
\r
448 new file mode 100644
\r
449 index 0000000..604496c
\r
451 +++ b/test/gnupg-secret-key.NOTE
\r
453 +How the crypto test gnupg secret was generated:
\r
455 +GNUPGHOME=gnupghome gpg --quick-random --gen-key
\r
459 +name: Notmuch Test Suite
\r
460 +email: test_suite@notmuchmail.org
\r
462 diff --git a/test/gnupg-secret-key.asc b/test/gnupg-secret-key.asc
\r
463 new file mode 100644
\r
464 index 0000000..6431b56
\r
466 +++ b/test/gnupg-secret-key.asc
\r
468 +-----BEGIN PGP PRIVATE KEY BLOCK-----
\r
469 +Version: GnuPG v1.4.10 (GNU/Linux)
\r
471 +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
\r
499 +SWXT1JrwPoKh9xe++90=
\r
501 +-----END PGP PRIVATE KEY BLOCK-----
\r
502 diff --git a/test/notmuch-test b/test/notmuch-test
\r
503 index 0ea4f4f..37db920 100755
\r
504 --- a/test/notmuch-test
\r
505 +++ b/test/notmuch-test
\r
506 @@ -39,6 +39,7 @@ TESTS="
\r
508 emacs-large-search-buffer
\r
512 TESTS=${NOTMUCH_TESTS:=$TESTS}
\r
514 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
515 index ae25635..428ac7b 100755
\r
516 --- a/test/test-lib.sh
\r
517 +++ b/test/test-lib.sh
\r
518 @@ -379,6 +379,26 @@ add_message ()
\r
519 notmuch new > /dev/null
\r
522 +# Deliver a message with emacs and add it to the database
\r
524 +# Uses emacs to generate and deliver a message to the mail store.
\r
525 +# Accepts arbitrary extra emacs/elisp functions to modify the message
\r
526 +# before sending, which is useful to doing things like attaching files
\r
527 +# to the message and encrypting/signing.
\r
528 +emacs_deliver_message ()
\r
530 + local subject="$1"
\r
533 + # before we can send a message, we have to prepare the FCC maildir
\r
534 + mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
\r
535 + ../smtp-dummy sent_message &
\r
536 + smtp_dummy_pid=$!
\r
537 + test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") (notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\") (message-goto-subject) (insert \"${subject}\") (message-goto-body) (insert \"${body}\") $@ (message-send-and-exit)" >/dev/null 2>&1
\r
538 + wait ${smtp_dummy_pid}
\r
539 + notmuch new >/dev/null
\r
542 # Generate a corpus of email and add it to the database.
\r
544 # This corpus is fixed, (it happens to be 50 messages from early in
\r
545 @@ -509,6 +529,14 @@ notmuch_show_sanitize_all ()
\r
546 -e 's| id:[^ ]* | id:XXXXX |'
\r
549 +notmuch_json_show_sanitize ()
\r
551 + sed -e 's|, |,\n |g' | \
\r
553 + -e 's|"id": "[^"]*",|"id": "XXXXX",|' \
\r
554 + -e 's|"filename": "[^"]*",|"filename": "YYYYY",|'
\r
557 # End of notmuch helper functions
\r
559 # Use test_set_prereq to tell that a particular prerequisite is available.
\r
560 @@ -945,6 +973,7 @@ rm -fr "$test" || {
\r
563 MAIL_DIR="${TMP_DIRECTORY}/mail"
\r
564 +export GNUPGHOME="${TMP_DIRECTORY}/gnupg"
\r
565 export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
\r