aboutsummaryrefslogtreecommitdiff
path: root/src/gns
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
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')
-rw-r--r--src/gns/Makefile.am23
-rw-r--r--src/gns/gnunet-gns-proxy-setup-ca.in17
2 files changed, 29 insertions, 11 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 13f6a6e52..7d343e7ff 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -88,21 +88,36 @@ bin_PROGRAMS += gnunet-bcd
88endif 88endif
89endif 89endif
90 90
91bin_SCRIPTS = gnunet-gns-proxy-setup-ca
92
93plugin_LTLIBRARIES = \ 91plugin_LTLIBRARIES = \
94 libgnunet_plugin_block_gns.la \ 92 libgnunet_plugin_block_gns.la \
95 libgnunet_plugin_gnsrecord_gns.la 93 libgnunet_plugin_gnsrecord_gns.la
96 94
97xPFX=$(pkgdatadir)/openssl.cnf
98 95
96if HAVE_OPENSSL
97xOPENSSL=$(shell which openssl)
98do_subst_openssl = $(SED) -e 's,[@]OPENSSLBIN[@],${xOPENSSL},g'
99endif
100
101if HAVE_NSS
102xCERTUTIL=$(shell which certutil)
103do_subst_certutil = $(SED) -e 's,[@]CERTUTILBIN[@],${xCERTUTIL},g'
104endif
105
106xPFX=$(pkgdatadir)/openssl.cnf
99do_subst = $(SED) -e 's,[@]PREFIX[@],${xPFX},g' 107do_subst = $(SED) -e 's,[@]PREFIX[@],${xPFX},g'
100 108
101gnunet-gns-proxy-setup-ca: gnunet-gns-proxy-setup-ca.in 109gnunet-gns-proxy-setup-ca: gnunet-gns-proxy-setup-ca.in
102 $(do_subst) < $(top_srcdir)/src/gns/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca 110 $(do_subst) < $(top_srcdir)/src/gns/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca
111 ifeq ($(HAVE_OPENSSL), 1)
112 $(do_subst_openssl) < $(top_srcdir)/src/gns/gnunet-gns-proxy-setup-ca
113 endif
114 ifeq ($(HAVE_OPENSSL), 1)
115 $(do_subst_certutil) < $(top_srcdir)/src/gns/gnunet-gns-proxy-setup-ca
116 endif
103 chmod +x gnunet-gns-proxy-setup-ca 117 chmod +x gnunet-gns-proxy-setup-ca
118else:
104 119
105 120bin_SCRIPTS = gnunet-gns-proxy-setup-ca
106 121
107libgnunet_plugin_gnsrecord_gns_la_SOURCES = \ 122libgnunet_plugin_gnsrecord_gns_la_SOURCES = \
108 plugin_gnsrecord_gns.c 123 plugin_gnsrecord_gns.c
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