-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
139 lines (97 loc) · 3.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#optionally FakeTimeCmd can changed to faketime
FakeTimeCmd ?= datefudge "-180days"
include tools/tools.mk
#########################################################################
## general targets
#########################################################################
.PHONY: all clean
.DEFAULT: all
all: valid revoked expired selfsigned unknown
clean:
$(call clean_all)
#########################################################################
## valid certificates
#########################################################################
ValidCerts = root_ca \
intermediate_ca \
server \
client
.PHONY: valid clean_valid
valid: | $(ValidCerts)
clean_valid:
$(call clean,$(ValidCerts))
root_ca:
$(call create_selfsigned_cert,$@,ca)
$(call create_ocsp_cert,$@,localhost:8001)
intermediate_ca: | root_ca
$(call create_ca_signed_cert,$@,ca,$|,ca)
$(call create_ocsp_cert,$@,localhost:8002)
client server: | intermediate_ca
$(call create_ca_signed_cert,$@,user,$|,$@)
#########################################################################
## revoked certificates
#########################################################################
RevokedCerts = revoked_intermediate_ca \
revoked_client \
revoked_ca_client
.PHONY: revoked clean_revoked
revoked: | $(RevokedCerts)
clean_revoked:
$(call clean,$(RevokedCerts))
revoked_intermediate_ca: | root_ca
$(call create_ca_signed_cert,$@,ca,$|,ca)
$(call revoke_cert,$@,$|)
revoked_client: | intermediate_ca
$(call create_ca_signed_cert,$@,user,$|,client)
$(call revoke_cert,$@,$|)
revoked_ca_client: | revoked_intermediate_ca
$(call create_ca_signed_cert,$@,user,$|,client)
#########################################################################
## expired certificates
#########################################################################
ExpiredCerts = expired_intermediate_ca \
expired_client \
expired_ca_client
ExipedDates = -days 90
.PHONY: expired
expired: | $(ExpiredCerts)
clean_expired:
$(call clean,$(ExpiredCerts))
expired_intermediate_ca: | root_ca
$(call create_ca_signed_cert,$@,ca,$|,ca,$(ExipedDates))
$(call add_description,$@,\\n[expired])
expired_client: | intermediate_ca
$(call create_ca_signed_cert,$@,user,$|,client,$(ExipedDates))
$(call add_description,$@,\\n[expired])
expired_ca_client: | expired_intermediate_ca
$(call create_ca_signed_cert,$@,user,$|,client)
#########################################################################
## selfsigned certificates
#########################################################################
SelfsignedCerts = selfsigned_server \
selfsigned_client \
selfsigned_expired_client
.PHONY: selfsigned
selfsigned: | $(SelfsignedCerts)
clean_selfsigned:
$(call clean,$(SelfsignedCerts))
selfsigned_server:
$(call create_selfsigned_cert,$@,user,--ext server)
selfsigned_client:
$(call create_selfsigned_cert,$@,user,--ext client)
selfsigned_expired_client:
$(call create_selfsigned_cert,$@,user,--days 90 --ext client)
$(call add_description,$@,\\n[expired])
#########################################################################
## unknown CA certificates
#########################################################################
UnknownCaCerts = unknown_ca \
unknown_ca_client
.PHONY: unknown
unknown: | $(UnknownCaCerts)
clean_unknown:
$(call clean,$(UnknownCaCerts))
unknown_ca:
$(call create_selfsigned_cert,$@,ca)
unknown_ca_client: | unknown_ca
$(call create_ca_signed_cert,$@,user,$|,client)