aboutsummaryrefslogtreecommitdiff
path: root/tests/gpgsign.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gpgsign.at')
-rw-r--r--tests/gpgsign.at106
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/>.
16AT_SETUP([GPG Sign])
17AT_KEYWORDS([gpg sign])
18
19AT_CHECK([
20ANUBIS_PREREQ_GPG
21mkdir gpg
22
23if ! $GPG --homedir gpg --quiet --no-permission-warning --batch --gen-key
24then
25 AT_SKIP_TEST
26fi <<EOT
27Key-Type: RSA
28Key-Length: 2048
29Subkey-Type: ELG-E
30Subkey-Length: 2048
31Name-Real: GNU Anubis Team
32Name-Comment: (anubis)
33Name-Email: anubis-dev@gnu.org
34Expire-Date: 0
35%no-protection
36%transient-key
37%commit
38EOT
39
40AT_ANUBIS_CONFIG([anubis.rc],
41[BEGIN CONTROL
42logfile $PWD/etc/anubis.log
43local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
44use-pam no
45END
46
47BEGIN RULE
48gpg-home $PWD/gpg
49trigger "sign:(.*)"
50 gpg-sign "default"
51 add [[X-GPG-Comment]] "Signed by \1"
52done
53END
54])
55
56AT_DATA([input],
57[HELO localhost
58MAIL FROM:<gray@gnu.org>
59RCPT TO:<polak@gnu.org>
60DATA
61From: <gray@gnu.org>
62To: <polak@gnu.org>
63Subject: Signing messages@@sign:anubis-dev
64
65If you can read this, then it is working.
66.
67QUIT
68])
69],
70[0],
71[ignore],
72[ignore])
73
74AT_CHECK([
75anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
76],
77[0],
78[ignore],
79[ignore])
80AT_CHECK([
81 sed -e '/-----BEGIN PGP SIGNATURE-----/,/-----END PGP SIGNATURE-----/d'\
82 -e 's/^Hash:.*/Hash: ???/' etc/mta.log],
83[0],
84[HELO localhost
85MAIL FROM:<gray@gnu.org>
86RCPT TO:<polak@gnu.org>
87DATA
88From: <gray@gnu.org>
89To: <polak@gnu.org>
90Subject: Signing messages
91X-GPG-Comment: Signed by anubis-dev
92
93-----BEGIN PGP SIGNED MESSAGE-----
94Hash: ???
95
96If you can read this, then it is working.
97.
98QUIT
99])
100AT_CHECK([
101$GPG --homedir gpg --verify < etc/mta.log
102],
103[0],
104[],
105[ignore])
106AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.