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 |
---|
12 | |
---|
13 | export TEST_GAP ?= 1.5 |
---|
14 | export TEST_QUERY_DELAY ?= 2 |
---|
15 | |
---|
16 | all: setup.done |
---|
17 | ./runtests |
---|
18 | |
---|
19 | t-%: setup.done |
---|
20 | ./runtests $@ |
---|
21 | |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | ### for setting up a little miniature CA + server + client environment: |
---|
27 | identities := server authority client imposter rogueca |
---|
28 | tokens := x509.pem pubring.gpg secret.key |
---|
29 | all_tokens := $(foreach id,$(identities),$(foreach token,$(tokens),$(id)/$(token))) |
---|
30 | |
---|
31 | %.template: %.template.in |
---|
32 | sed s/__HOSTNAME__/$(TEST_HOST)/ < $< > $@ |
---|
33 | |
---|
34 | server.uid: server.uid.in |
---|
35 | sed s/__HOSTNAME__/$(TEST_HOST)/ < $< > $@ |
---|
36 | |
---|
37 | %/secret.key: |
---|
38 | mkdir -p $(dir $@) |
---|
39 | chmod 0700 $(dir $@) |
---|
40 | certtool --generate-privkey > $@ |
---|
41 | |
---|
42 | %/pubring.gpg: %.uid %/secret.key |
---|
43 | rm -f $(dir $@)pubring.gpg $(dir $@)secring.gpg $(dir $@)trustdb.gpg |
---|
44 | PEM2OPENPGP_EXPIRATION=86400 PEM2OPENPGP_USAGE_FLAGS=authenticate,certify pem2openpgp "$$(cat $<)" < $(dir $@)secret.key | GNUPGHOME=$(dir $@) gpg --import |
---|
45 | printf "%s:6:\n" "$$(GNUPGHOME=$(dir $@) gpg --with-colons --list-secret-keys --fingerprint | grep ^fpr: | cut -f 10 -d :)" | GNUPGHOME=$(dir $@) gpg --import-ownertrust |
---|
46 | |
---|
47 | authority/x509.pem: authority.template authority/secret.key |
---|
48 | certtool --generate-self-signed --load-privkey=authority/secret.key --template=authority.template > $@ |
---|
49 | rogueca/x509.pem: rogueca.template rogueca/secret.key |
---|
50 | certtool --generate-self-signed --load-privkey=rogueca/secret.key --template=rogueca.template > $@ |
---|
51 | |
---|
52 | %/cert-request: %.template %/secret.key |
---|
53 | certtool --generate-request --load-privkey=$(dir $@)secret.key --template=$< > $@ |
---|
54 | |
---|
55 | %/x509.pem: %.template %/cert-request authority/secret.key authority/x509.pem |
---|
56 | certtool --generate-certificate --load-ca-certificate=authority/x509.pem --load-ca-privkey=authority/secret.key --load-request=$(dir $@)cert-request --template=$< > $@ |
---|
57 | |
---|
58 | setup.done: $(all_tokens) |
---|
59 | mkdir -p logs cache outputs |
---|
60 | touch setup.done |
---|
61 | |
---|
62 | |
---|
63 | clean: |
---|
64 | rm -rf server client authority logs cache outputs setup.done *.template |
---|
65 | |
---|
66 | .PHONY: all clean |
---|