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

c52eca
From acaf4be8e301a01041acba189194d9502994611d Mon Sep 17 00:00:00 2001
c52eca
From: Alexander Scheel <ascheel@redhat.com>
c52eca
Date: Wed, 13 May 2020 10:01:47 -0400
c52eca
Subject: [PATCH] Don't clobber existing files on bootstrap
c52eca
c52eca
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
c52eca
---
c52eca
 raddb/certs/bootstrap | 31 +++++++++++++++----------------
c52eca
 1 file changed, 15 insertions(+), 16 deletions(-)
c52eca
c52eca
diff --git a/raddb/certs/bootstrap b/raddb/certs/bootstrap
c52eca
index ede09bc..e555491 100755
c52eca
--- a/raddb/certs/bootstrap
c52eca
+++ b/raddb/certs/bootstrap
c52eca
@@ -20,56 +20,55 @@ cd `dirname $0`
c52eca
 #  Don't edit the following text.  Instead, edit the Makefile, and
c52eca
 #  re-generate these commands.
c52eca
 #
c52eca
-if [ ! -f dh ]; then
c52eca
+if [ ! -e dh ]; then
c52eca
   openssl dhparam -out dh 2048 || exit 1
c52eca
-  if [ -e /dev/urandom ] ; then
c52eca
-	ln -sf /dev/urandom random
c52eca
-  else
c52eca
-	date > ./random;
c52eca
-  fi
c52eca
+  ln -sf /dev/urandom random
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f server.key ]; then
c52eca
+if [ ! -e server.key ]; then
c52eca
   openssl req -new  -out server.csr -keyout server.key -config ./server.cnf || exit 1
c52eca
   chmod g+r server.key
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f ca.key ]; then
c52eca
+if [ ! -e ca.key ]; then
c52eca
   openssl req -new -x509 -keyout ca.key -out ca.pem -days `grep default_days ca.cnf | sed 's/.*=//;s/^ *//'` -config ./ca.cnf || exit 1
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f index.txt ]; then
c52eca
+if [ ! -e index.txt ]; then
c52eca
   touch index.txt
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f serial ]; then
c52eca
+if [ ! -e serial ]; then
c52eca
   echo '01' > serial
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f server.crt ]; then
c52eca
+if [ ! -e server.crt ]; then
c52eca
   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
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f server.p12 ]; then
c52eca
+if [ ! -e server.p12 ]; then
c52eca
   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
c52eca
   chmod g+r server.p12
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f server.pem ]; then
c52eca
+if [ ! -e server.pem ]; then
c52eca
   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
c52eca
   openssl verify -CAfile ca.pem server.pem || exit 1
c52eca
   chmod g+r server.pem
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f ca.der ]; then
c52eca
+if [ ! -e ca.der ]; then
c52eca
   openssl x509 -inform PEM -outform DER -in ca.pem -out ca.der || exit 1
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f client.key ]; then
c52eca
+if [ ! -e client.key ]; then
c52eca
   openssl req -new  -out client.csr -keyout client.key -config ./client.cnf
c52eca
   chmod g+r client.key
c52eca
 fi
c52eca
 
c52eca
-if [ ! -f client.crt ]; then
c52eca
+if [ ! -e client.crt ]; then
c52eca
   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
c52eca
 fi
c52eca
+
c52eca
+chown root:radiusd dh ca.* client.* server.*
c52eca
+chmod 640 dh ca.* client.* server.*
c52eca
-- 
c52eca
2.26.2
c52eca