diff options
Diffstat (limited to 'tests/gpgsign.at')
-rw-r--r-- | tests/gpgsign.at | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/tests/gpgsign.at b/tests/gpgsign.at new file mode 100644 index 0000000..ea5ac45 --- /dev/null +++ b/tests/gpgsign.at | |||
@@ -0,0 +1,106 @@ | |||
1 | ># This file is part of GNU Anubis testsuite. -*- autotest -*- | ||
2 | # Copyright (C) 2003-2024 The Anubis Team. | ||
3 | # | ||
4 | # GNU Anubis is free software; you can redistribute it and/or modify it | ||
5 | # under the terms of the GNU General Public License as published by the Free | ||
6 | # Software Foundation; either version 3 of the License, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # GNU Anubis is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License along | ||
15 | # with GNU Anubis. If not, see <http://www.gnu.org/licenses/>. | ||
16 | AT_SETUP([GPG Sign]) | ||
17 | AT_KEYWORDS([gpg sign]) | ||
18 | |||
19 | AT_CHECK([ | ||
20 | ANUBIS_PREREQ_GPG | ||
21 | mkdir gpg | ||
22 | |||
23 | if ! $GPG --homedir gpg --quiet --no-permission-warning --batch --gen-key | ||
24 | then | ||
25 | AT_SKIP_TEST | ||
26 | fi <<EOT | ||
27 | Key-Type: RSA | ||
28 | Key-Length: 2048 | ||
29 | Subkey-Type: ELG-E | ||
30 | Subkey-Length: 2048 | ||
31 | Name-Real: GNU Anubis Team | ||
32 | Name-Comment: (anubis) | ||
33 | Name-Email: anubis-dev@gnu.org | ||
34 | Expire-Date: 0 | ||
35 | %no-protection | ||
36 | %transient-key | ||
37 | %commit | ||
38 | EOT | ||
39 | |||
40 | AT_ANUBIS_CONFIG([anubis.rc], | ||
41 | [BEGIN CONTROL | ||
42 | logfile $PWD/etc/anubis.log | ||
43 | local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log | ||
44 | use-pam no | ||
45 | END | ||
46 | |||
47 | BEGIN RULE | ||
48 | gpg-home $PWD/gpg | ||
49 | trigger "sign:(.*)" | ||
50 | gpg-sign "default" | ||
51 | add [[X-GPG-Comment]] "Signed by \1" | ||
52 | done | ||
53 | END | ||
54 | ]) | ||
55 | |||
56 | AT_DATA([input], | ||
57 | [HELO localhost | ||
58 | MAIL FROM:<gray@gnu.org> | ||
59 | RCPT TO:<polak@gnu.org> | ||
60 | DATA | ||
61 | From: <gray@gnu.org> | ||
62 | To: <polak@gnu.org> | ||
63 | Subject: Signing messages@@sign:anubis-dev | ||
64 | |||
65 | If you can read this, then it is working. | ||
66 | . | ||
67 | QUIT | ||
68 | ]) | ||
69 | ], | ||
70 | [0], | ||
71 | [ignore], | ||
72 | [ignore]) | ||
73 | |||
74 | AT_CHECK([ | ||
75 | anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r' | ||
76 | ], | ||
77 | [0], | ||
78 | [ignore], | ||
79 | [ignore]) | ||
80 | AT_CHECK([ | ||
81 | sed -e '/-----BEGIN PGP SIGNATURE-----/,/-----END PGP SIGNATURE-----/d'\ | ||
82 | -e 's/^Hash:.*/Hash: ???/' etc/mta.log], | ||
83 | [0], | ||
84 | [HELO localhost | ||
85 | MAIL FROM:<gray@gnu.org> | ||
86 | RCPT TO:<polak@gnu.org> | ||
87 | DATA | ||
88 | From: <gray@gnu.org> | ||
89 | To: <polak@gnu.org> | ||
90 | Subject: Signing messages | ||
91 | X-GPG-Comment: Signed by anubis-dev | ||
92 | |||
93 | -----BEGIN PGP SIGNED MESSAGE----- | ||
94 | Hash: ??? | ||
95 | |||
96 | If you can read this, then it is working. | ||
97 | . | ||
98 | QUIT | ||
99 | ]) | ||
100 | AT_CHECK([ | ||
101 | $GPG --homedir gpg --verify < etc/mta.log | ||
102 | ], | ||
103 | [0], | ||
104 | [], | ||
105 | [ignore]) | ||
106 | AT_CLEANUP | ||