2 # This shell script will generate an X509 certificate for your gnunet-gns-proxy
3 # and install it (for both GNUnet and your browser).
8 while getopts "c:" opt; do
14 echo "Invalid option: -$OPTARG" >&2
18 echo "Option -$OPTARG requires an argument." >&2
24 GNSCERT=`mktemp /tmp/gnscertXXXXXX.pem`
25 GNSCAKY=`mktemp /tmp/gnscakeyXXXXXX.pem`
26 GNSCANO=`mktemp /tmp/gnscakeynoencXXXXXX.pem`
27 GNS_CA_CERT_PEM=`gnunet-config -s gns-proxy -o PROXY_CACERT -f $options`
28 mkdir -p `dirname $GNS_CA_CERT_PEM`
30 openssl req -new -x509 -days 3650 -extensions v3_ca -keyout $GNSCAKY -out $GNSCERT -subj "/C=ZZ/L=World/O=GNU/OU=GNUnet/CN=GNS CA/emailAddress=bounce@gnunet.org" -passout pass:"GNU Name System"
32 echo "Removing passphrase from key"
33 openssl rsa -passin pass:"GNU Name System" -in $GNSCAKY -out $GNSCANO
35 cat $GNSCERT $GNSCANO > $GNS_CA_CERT_PEM
37 echo "Importing CA into browsers"
38 for f in ~/.mozilla/firefox/*.default
41 echo "Importing CA info Firefox $f"
42 certutil -D -n "GNS Proxy CA" -d ~/.mozilla/firefox/*.default >/dev/null 2&>1
43 certutil -A -n "GNS Proxy CA" -t CT,, -d ~/.mozilla/firefox/*.default < $GNSCERT
47 if [ -d ~/.pki/nssdb ]; then
48 echo "Importing CA into Chrome"
49 certutil -D -n "GNS Proxy CA" -d ~/.pki/nssdb >/dev/null 2&>1
50 certutil -A -n "GNS Proxy CA" -t CT,, -d ~/.pki/nssdb < $GNSCERT
54 rm $GNSCAKY $GNSCANO $GNSCERT
56 echo "You can now start gnunet-gns-proxy and configure your browser to use a SOCKS proxy on port 7777"