Blame SOURCES/freeradius-bootstrap-create-only.patch

71fb5d
From d38836ca4158b42c27f4d7f474e64f4f10aed16d Mon Sep 17 00:00:00 2001
71fb5d
From: Alexander Scheel <ascheel@redhat.com>
71fb5d
Date: Wed, 8 May 2019 10:29:08 -0400
71fb5d
Subject: [PATCH] Don't clobber existing files on bootstrap
71fb5d
71fb5d
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
71fb5d
---
71fb5d
 raddb/certs/bootstrap | 39 ++++++++++++---------------------------
71fb5d
 1 file changed, 12 insertions(+), 27 deletions(-)
71fb5d
71fb5d
diff --git a/raddb/certs/bootstrap b/raddb/certs/bootstrap
71fb5d
index 0f719aafd4..be81a2d697 100755
71fb5d
--- a/raddb/certs/bootstrap
71fb5d
+++ b/raddb/certs/bootstrap
71fb5d
@@ -13,17 +13,6 @@
71fb5d
 umask 027
71fb5d
 cd `dirname $0`
71fb5d
71fb5d
-make -h > /dev/null 2>&1
71fb5d
-
71fb5d
-#
71fb5d
-#  If we have a working "make", then use it.  Otherwise, run the commands
71fb5d
-#  manually.
71fb5d
-#
71fb5d
-if [ "$?" = "0" ]; then
71fb5d
-  make all
71fb5d
-  exit $?
71fb5d
-fi
71fb5d
-
71fb5d
 #
71fb5d
 #  The following commands were created by running "make -n", and edited
71fb5d
 #  to remove the trailing backslash, and to add "exit 1" after the commands.
71fb5d
@@ -31,52 +20,51 @@ fi
71fb5d
 #  Don't edit the following text.  Instead, edit the Makefile, and
71fb5d
 #  re-generate these commands.
71fb5d
 #
71fb5d
-if [ ! -f dh ]; then
71fb5d
+if [ ! -e dh ]; then
71fb5d
   openssl dhparam -out dh 2048 || exit 1
71fb5d
-  if [ -e /dev/urandom ] ; then
71fb5d
-	ln -sf /dev/urandom random
71fb5d
-  else
71fb5d
-	date > ./random;
71fb5d
-  fi
71fb5d
+  ln -sf /dev/urandom random
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f server.key ]; then
71fb5d
+if [ ! -e server.key ]; then
71fb5d
   openssl req -new  -out server.csr -keyout server.key -config ./server.cnf || exit 1
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f ca.key ]; then
71fb5d
+if [ ! -e ca.key ]; then
71fb5d
   openssl req -new -x509 -keyout ca.key -out ca.pem -days `grep default_days ca.cnf | sed 's/.*=//;s/^ *//'` -config ./ca.cnf || exit 1
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f index.txt ]; then
71fb5d
+if [ ! -e index.txt ]; then
71fb5d
   touch index.txt
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f serial ]; then
71fb5d
+if [ ! -e serial ]; then
71fb5d
   echo '01' > serial
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f server.crt ]; then
71fb5d
+if [ ! -e server.crt ]; then
71fb5d
   openssl ca -batch -keyfile ca.key -cert ca.pem -in server.csr  -key `grep output_password ca.cnf | sed 's/.*=//;s/^ *//'` -out server.crt -extensions xpserver_ext -extfile xpextensions -config ./server.cnf || exit 1
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f server.p12 ]; then
71fb5d
+if [ ! -e server.p12 ]; then
71fb5d
   openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12  -passin pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` -passout pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` || exit 1
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f server.pem ]; then
71fb5d
+if [ ! -e server.pem ]; then
71fb5d
   openssl pkcs12 -in server.p12 -out server.pem -passin pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` -passout pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` || exit 1
71fb5d
   openssl verify -CAfile ca.pem server.pem || exit 1
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f ca.der ]; then
71fb5d
+if [ ! -e ca.der ]; then
71fb5d
   openssl x509 -inform PEM -outform DER -in ca.pem -out ca.der || exit 1
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f client.key ]; then
71fb5d
+if [ ! -e client.key ]; then
71fb5d
   openssl req -new  -out client.csr -keyout client.key -config ./client.cnf
71fb5d
 fi
71fb5d
71fb5d
-if [ ! -f client.crt ]; then
71fb5d
+if [ ! -e client.crt ]; then
71fb5d
   openssl ca -batch -keyfile ca.key -cert ca.pem -in client.csr  -key `grep output_password ca.cnf | sed 's/.*=//;s/^ *//'` -out client.crt -extensions xpclient_ext -extfile xpextensions -config ./client.cnf
71fb5d
 fi
71fb5d
+
71fb5d
+chown root:radiusd dh ca.* client.* server.*
71fb5d
+chmod 644 dh ca.* client.* server.*
71fb5d
--
71fb5d
2.21.0
71fb5d