aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-gns-proxy-setup-ca.in
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-02-19 12:40:36 +0000
committerng0 <ng0@n0.is>2019-02-19 12:40:36 +0000
commit2f9e78d0db73fa953f4f542f3fbc9ddf2c9e260f (patch)
treef700ff67202a249d5c121a9f78f64531e6e0406c /src/gns/gnunet-gns-proxy-setup-ca.in
parentb9e95f034c7d2e059340c5d282933c102e834c71 (diff)
downloadgnunet-2f9e78d0db73fa953f4f542f3fbc9ddf2c9e260f.tar.gz
gnunet-2f9e78d0db73fa953f4f542f3fbc9ddf2c9e260f.zip
gnunet-gns-proxy-setup-ca: conditionally sed openssl and certutil location,
use variable for locations, check for openssl and certutil in configure phase.
Diffstat (limited to 'src/gns/gnunet-gns-proxy-setup-ca.in')
-rw-r--r--src/gns/gnunet-gns-proxy-setup-ca.in17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gns/gnunet-gns-proxy-setup-ca.in b/src/gns/gnunet-gns-proxy-setup-ca.in
index d3753b074..cd3be5cea 100644
--- a/src/gns/gnunet-gns-proxy-setup-ca.in
+++ b/src/gns/gnunet-gns-proxy-setup-ca.in
@@ -11,6 +11,8 @@ then
11 exit 1 11 exit 1
12fi 12fi
13 13
14OPENSSLBIN=@OPENSSL@
15CERTUTILBIN=@CERTUTIL@
14 16
15echo "Generating CA" 17echo "Generating CA"
16options='' 18options=''
@@ -36,17 +38,18 @@ GNSCANO=`mktemp /tmp/gnscakeynoencXXXXXX.pem`
36GNS_CA_CERT_PEM=`gnunet-config -s gns-proxy -o PROXY_CACERT -f $options` 38GNS_CA_CERT_PEM=`gnunet-config -s gns-proxy -o PROXY_CACERT -f $options`
37mkdir -p `dirname $GNS_CA_CERT_PEM` 39mkdir -p `dirname $GNS_CA_CERT_PEM`
38 40
39openssl req -config $OPENSSLCFG -new -x509 -days 3650 -extensions v3_ca -keyout $GNSCAKY -out $GNSCERT -subj "/C=ZZ/L=World/O=GNU/OU=GNUnet/CN=GNS Proxy CA/emailAddress=bounce@gnunet.org" -passout pass:"GNU Name System" 41OPENSSLBIN req -config $OPENSSLCFG -new -x509 -days 3650 -extensions v3_ca -keyout $GNSCAKY -out $GNSCERT -subj "/C=ZZ/L=World/O=GNU/OU=GNUnet/CN=GNS Proxy CA/emailAddress=bounce@gnunet.org" -passout pass:"GNU Name System"
40 42
41echo "Removing passphrase from key" 43echo "Removing passphrase from key"
42openssl rsa -passin pass:"GNU Name System" -in $GNSCAKY -out $GNSCANO 44OPENSSLBIN rsa -passin pass:"GNU Name System" -in $GNSCAKY -out $GNSCANO
43 45
44echo "Making private key available to gnunet-gns-proxy" 46echo "Making private key available to gnunet-gns-proxy"
45cat $GNSCERT $GNSCANO > $GNS_CA_CERT_PEM 47cat $GNSCERT $GNSCANO > $GNS_CA_CERT_PEM
46 48
47if ! which certutil > /dev/null 49if ! which certutil > /dev/null
48then 50then
49 echo "'certutil' command not found. Not importing into browsers." 51 echo "The 'certutil' command was not found. Not importing into browsers."
52 echo "For 'certutil' install nss."
50else 53else
51 echo "Importing CA into browsers" 54 echo "Importing CA into browsers"
52 for f in ~/.mozilla/firefox/*.*/ 55 for f in ~/.mozilla/firefox/*.*/
@@ -54,18 +57,18 @@ else
54 if [ -d $f ]; then 57 if [ -d $f ]; then
55 echo "Importing CA info Firefox at $f" 58 echo "Importing CA info Firefox at $f"
56 # delete old certificate (if any) 59 # delete old certificate (if any)
57 certutil -D -n "GNS Proxy CA" -d "$f" >/dev/null 2>/dev/null 60 @CERTUTILBIN@ -D -n "GNS Proxy CA" -d "$f" >/dev/null 2>/dev/null
58 # add new certificate 61 # add new certificate
59 certutil -A -n "GNS Proxy CA" -t CT,, -d "$f" < $GNSCERT 62 @CERTUTILBIN@ -A -n "GNS Proxy CA" -t CT,, -d "$f" < $GNSCERT
60 fi 63 fi
61 done 64 done
62 65
63 if [ -d ~/.pki/nssdb/ ]; then 66 if [ -d ~/.pki/nssdb/ ]; then
64 echo "Importing CA into Chrome at ~/.pki/nssdb/" 67 echo "Importing CA into Chrome at ~/.pki/nssdb/"
65 # delete old certificate (if any) 68 # delete old certificate (if any)
66 certutil -D -n "GNS Proxy CA" -d ~/.pki/nssdb/ >/dev/null 2>/dev/null 69 @CERTUTILBIN@ -D -n "GNS Proxy CA" -d ~/.pki/nssdb/ >/dev/null 2>/dev/null
67 # add new certificate 70 # add new certificate
68 certutil -A -n "GNS Proxy CA" -t CT,, -d ~/.pki/nssdb/ < $GNSCERT 71 @CERTUTILBIN@ -A -n "GNS Proxy CA" -t CT,, -d ~/.pki/nssdb/ < $GNSCERT
69 fi 72 fi
70fi 73fi
71 74