1*4882a593SmuzhiyunFrom 084f5467672f2ae37003b77e8f8706772f3da3ec Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Mingli Yu <mingli.yu@windriver.com>
3*4882a593SmuzhiyunDate: Mon, 13 Jul 2020 07:01:45 +0000
4*4882a593SmuzhiyunSubject: [PATCH] raddb/certs/Makefile: fix the existed certificate error
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunFixes:
7*4882a593Smuzhiyun # ./bootstrap
8*4882a593Smuzhiyun [snip]
9*4882a593Smuzhiyunopenssl ca -batch -keyfile ca.key -cert ca.pem -in client.csr  -key 'whatever' -out client.crt -extensions xpclient_ext -extfile xpextensions -config ./client.cnf
10*4882a593SmuzhiyunUsing configuration from ./client.cnf
11*4882a593SmuzhiyunCheck that the request matches the signature
12*4882a593SmuzhiyunSignature ok
13*4882a593SmuzhiyunERROR:There is already a certificate for /C=FR/ST=Radius/O=Example Inc./CN=user@example.org/emailAddress=user@example.org
14*4882a593SmuzhiyunThe matching entry has the following details
15*4882a593SmuzhiyunType          :Valid
16*4882a593SmuzhiyunExpires on    :200908024833Z
17*4882a593SmuzhiyunSerial Number :02
18*4882a593SmuzhiyunFile name     :unknown
19*4882a593SmuzhiyunSubject Name  :/C=FR/ST=Radius/O=Example Inc./CN=user@example.org/emailAddress=user@example.org
20*4882a593Smuzhiyunmake: *** [Makefile:128: client.crt] Error 1
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunAdd the check to fix the above error and it does the same for server.crt.
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunUpstream-Status: Pending
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunSigned-off-by: Mingli Yu <mingli.yu@windriver.com>
27*4882a593Smuzhiyun---
28*4882a593Smuzhiyun raddb/certs/Makefile | 4 ++--
29*4882a593Smuzhiyun 1 file changed, 2 insertions(+), 2 deletions(-)
30*4882a593Smuzhiyun
31*4882a593Smuzhiyundiff --git a/raddb/certs/Makefile b/raddb/certs/Makefile
32*4882a593Smuzhiyunindex 5cbfd467ce..77eec9baa1 100644
33*4882a593Smuzhiyun--- a/raddb/certs/Makefile
34*4882a593Smuzhiyun+++ b/raddb/certs/Makefile
35*4882a593Smuzhiyun@@ -92,7 +92,7 @@ server.csr server.key: server.cnf
36*4882a593Smuzhiyun 	chmod g+r server.key
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun server.crt: server.csr ca.key ca.pem
39*4882a593Smuzhiyun-	$(OPENSSL) ca -batch -keyfile ca.key -cert ca.pem -in server.csr  -key $(PASSWORD_CA) -out server.crt -extensions xpserver_ext -extfile xpextensions -config ./server.cnf
40*4882a593Smuzhiyun+	@[ -f server.crt ] || $(OPENSSL) ca -batch -keyfile ca.key -cert ca.pem -in server.csr  -key $(PASSWORD_CA) -out server.crt -extensions xpserver_ext -extfile xpextensions -config ./server.cnf
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun server.p12: server.crt
43*4882a593Smuzhiyun 	$(OPENSSL) pkcs12 -export -in server.crt -inkey server.key -out server.p12  -passin pass:$(PASSWORD_SERVER) -passout pass:$(PASSWORD_SERVER)
44*4882a593Smuzhiyun@@ -117,7 +117,7 @@ client.csr client.key: client.cnf
45*4882a593Smuzhiyun 	chmod g+r client.key
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun client.crt: client.csr ca.pem ca.key
48*4882a593Smuzhiyun-	$(OPENSSL) ca -batch -keyfile ca.key -cert ca.pem -in client.csr  -key $(PASSWORD_CA) -out client.crt -extensions xpclient_ext -extfile xpextensions -config ./client.cnf
49*4882a593Smuzhiyun+	@[ -f client.crt ] || $(OPENSSL) ca -batch -keyfile ca.key -cert ca.pem -in client.csr  -key $(PASSWORD_CA) -out client.crt -extensions xpclient_ext -extfile xpextensions -config ./client.cnf
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun client.p12: client.crt
52*4882a593Smuzhiyun 	$(OPENSSL) pkcs12 -export -in client.crt -inkey client.key -out client.p12  -passin pass:$(PASSWORD_CLIENT) -passout pass:$(PASSWORD_CLIENT)
53*4882a593Smuzhiyun--
54*4882a593Smuzhiyun2.26.2
55*4882a593Smuzhiyun
56