source: mod_gnutls/t/setup @ 5342265

asynciodebian/masterdebian/stretch-backportsjessie-backportsmainproxy-ticketupstream
Last change on this file since 5342265 was c32240f, checked in by Daniel Kahn Gillmor <dkg@…>, 9 years ago

switch from --long-arg=foo to --long-arg foo for certtool in test suite

it looks like certtool from gnutls 2.x doesn't support the
--long-arg=foo convention, and both newer and older versions support
the --long-arg foo convention, so be more compatible.

Thanks to Ramkumar Chinchani for pointing this out.

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/bin/bash
2
3# Set up the ability to do test suites.  This should only be run from the current working directory!
4
5# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
6
7set -e
8
9if [ -z "$TEST_HOST" ]; then
10    printf "You need to set the TEST_HOST environment variable\n" >&2
11    exit 1
12fi
13
14if [ . != "$(dirname "$0")" ]; then
15    printf "You should only run this mod-gnutls test suite from the t/ directory of the mod_gnutls source.\n" >&2
16    exit 1
17fi
18
19genkey() {
20    dir="$1"
21    uid="$2"
22
23    mkdir -p "$dir"
24    chmod 0700 "$dir"
25
26    certtool --generate-privkey > "$dir"/secret.key
27    PEM2OPENPGP_EXPIRATION=86400 PEM2OPENPGP_USAGE_FLAGS=authenticate,certify pem2openpgp "$uid" < "$dir"/secret.key | GNUPGHOME="$dir" gpg --import
28    fpr="$(GNUPGHOME="$dir" gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)"
29
30    # set ultimate ownertrust on my own secret key:
31    printf "%s:6:\n"  "$fpr" | GNUPGHOME="$dir" gpg --import-ownertrust
32
33    GNUPGHOME="$dir" ~/src/monkeysphere/msva-perl/openpgp2x509 "$uid" > "$dir"/x509.pem
34}
35
36genkey "$PWD/authority" "Testing Authority"
37genkey "$PWD/server" "https://${TEST_HOST}"
38genkey "$PWD/client" "Test User <test0@modgnutls.test>"
39
40certtool -q --load-privkey server/secret.key  --template server.template > server/server.req
41
42
43mkdir -p logs cache outputs
44touch setup.done
Note: See TracBrowser for help on using the repository browser.