[4b53371] | 1 | #!/usr/bin/make -f |
---|
| 2 | |
---|
| 3 | # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
---|
| 4 | |
---|
| 5 | # run these tests to ensure that mod_gnutls can handle a range of |
---|
| 6 | # simple configuration choices. |
---|
| 7 | |
---|
| 8 | export TEST_HOST ?= localhost |
---|
| 9 | export TEST_IP ?= ::1 |
---|
| 10 | # chosen at random: |
---|
| 11 | export TEST_PORT ?= 9932 |
---|
[e3cbda4] | 12 | export MSVA_PORT ?= 9933 |
---|
[4b53371] | 13 | |
---|
| 14 | export TEST_GAP ?= 1.5 |
---|
| 15 | export TEST_QUERY_DELAY ?= 2 |
---|
| 16 | |
---|
| 17 | all: setup.done |
---|
| 18 | ./runtests |
---|
| 19 | |
---|
| 20 | t-%: setup.done |
---|
| 21 | ./runtests $@ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | ### for setting up a little miniature CA + server + client environment: |
---|
| 28 | identities := server authority client imposter rogueca |
---|
[3e800f9] | 29 | tokens := x509.pem secring.gpg secret.key cert.pgp secret.pgp |
---|
[4b53371] | 30 | all_tokens := $(foreach id,$(identities),$(foreach token,$(tokens),$(id)/$(token))) |
---|
| 31 | |
---|
| 32 | %.template: %.template.in |
---|
| 33 | sed s/__HOSTNAME__/$(TEST_HOST)/ < $< > $@ |
---|
| 34 | |
---|
| 35 | server.uid: server.uid.in |
---|
| 36 | sed s/__HOSTNAME__/$(TEST_HOST)/ < $< > $@ |
---|
| 37 | |
---|
| 38 | %/secret.key: |
---|
| 39 | mkdir -p $(dir $@) |
---|
| 40 | chmod 0700 $(dir $@) |
---|
| 41 | certtool --generate-privkey > $@ |
---|
| 42 | |
---|
[3e800f9] | 43 | %/secring.gpg: %.uid %/secret.key |
---|
[4b53371] | 44 | rm -f $(dir $@)pubring.gpg $(dir $@)secring.gpg $(dir $@)trustdb.gpg |
---|
[c25fc5d] | 45 | PEM2OPENPGP_EXPIRATION=86400 PEM2OPENPGP_USAGE_FLAGS=authenticate,certify,sign pem2openpgp "$$(cat $<)" < $(dir $@)secret.key | GNUPGHOME=$(dir $@) gpg --import |
---|
[4b53371] | 46 | printf "%s:6:\n" "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust |
---|
| 47 | |
---|
[3e800f9] | 48 | %/gpg.conf: %/secring.gpg |
---|
| 49 | printf "default-key %s\n" "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@ |
---|
| 50 | |
---|
| 51 | %/secret.pgp: %/secring.gpg |
---|
| 52 | GNUPGHOME=$(dir $@) gpg --armor --batch --no-tty --yes --export-secret-key "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@ |
---|
| 53 | |
---|
| 54 | %/minimal.pgp: %/secring.gpg |
---|
| 55 | GNUPGHOME=$(dir $@) gpg --armor --export "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@ |
---|
| 56 | |
---|
| 57 | %/cert.pgp: %/minimal.pgp authority/gpg.conf |
---|
| 58 | GNUPGHOME=authority gpg --import $< |
---|
| 59 | GNUPGHOME=authority gpg --batch --sign-key --no-tty --yes "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" |
---|
| 60 | GNUPGHOME=authority gpg --armor --export "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" > $@ |
---|
| 61 | |
---|
| 62 | # special cases for the authorities' root certs: |
---|
[4b53371] | 63 | authority/x509.pem: authority.template authority/secret.key |
---|
[c32240f] | 64 | certtool --generate-self-signed --load-privkey authority/secret.key --template authority.template > $@ |
---|
[4b53371] | 65 | rogueca/x509.pem: rogueca.template rogueca/secret.key |
---|
[c32240f] | 66 | certtool --generate-self-signed --load-privkey rogueca/secret.key --template rogueca.template > $@ |
---|
[4b53371] | 67 | |
---|
| 68 | %/cert-request: %.template %/secret.key |
---|
[c32240f] | 69 | certtool --generate-request --load-privkey $(dir $@)secret.key --template $< > $@ |
---|
[4b53371] | 70 | |
---|
| 71 | %/x509.pem: %.template %/cert-request authority/secret.key authority/x509.pem |
---|
[c32240f] | 72 | certtool --generate-certificate --load-ca-certificate authority/x509.pem --load-ca-privkey authority/secret.key --load-request $(dir $@)cert-request --template $< > $@ |
---|
[4b53371] | 73 | |
---|
[e3cbda4] | 74 | msva.gnupghome/trustdb.gpg: authority/minimal.pgp client/cert.pgp |
---|
[37b52ea] | 75 | mkdir -p -m 0700 $(dir $@) |
---|
[e3cbda4] | 76 | GNUPGHOME=$(dir $@) gpg --import < $< |
---|
| 77 | printf "%s:6:\n" "$$(GNUPGHOME=authority gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust |
---|
| 78 | GNUPGHOME=$(dir $@) gpg --import < client/cert.pgp |
---|
| 79 | printf "keyserver does-not-exist.example\n" > msva.gnupghome/gpg.conf |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | setup.done: $(all_tokens) msva.gnupghome/trustdb.gpg |
---|
[4b53371] | 83 | mkdir -p logs cache outputs |
---|
| 84 | touch setup.done |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | clean: |
---|
[a8df590] | 88 | rm -rf server client authority logs cache outputs setup.done server.template msva.gnupghome \ |
---|
| 89 | */*.pgp */*.gpg */*.pem */*.key authority.template client.template server.uid |
---|
[4b53371] | 90 | |
---|
| 91 | .PHONY: all clean |
---|