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`
29 openssl req -new -x509 -days 3650 -extensions v3_ca -keyout $GNSCAKY -out $GNSCERT -subj "/C=TNR/L=World/O=GNU/OU=GNUnet/CN=GNS Proxy CA/emailAddress=bounce@gnunet.org" -passout pass:"GNU Name System"
31 echo "Removing passphrase from key"
32 openssl rsa -passin pass:"GNU Name System" -in $GNSCAKY -out $GNSCANO
34 cat $GNSCERT $GNSCANO > $GNS_CA_CERT_PEM
36 echo "Importing CA into browsers"
37 for f in ~/.mozilla/firefox/*.default
40 echo "Importing CA info Firefox $f"
41 certutil -D -n "GNS Proxy CA" -d ~/.mozilla/firefox/*.default >/dev/null 2&>1
42 certutil -A -n "GNS Proxy CA" -t CT,, -d ~/.mozilla/firefox/*.default < $GNSCERT
46 if [ -d ~/.pki/nssdb ]; then
47 echo "Importing CA into Chrome"
48 certutil -D -n "GNS Proxy CA" -d ~/.pki/nssdb >/dev/null 2&>1
49 certutil -A -n "GNS Proxy CA" -t CT,, -d ~/.pki/nssdb < $GNSCERT
53 rm $GNSCAKY $GNSCANO $GNSCERT
55 echo "You can now start gnunet-gns-proxy and configure your browser to use a SOCKS proxy on port 7777"