Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automating Trust Store Update #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ keytool -import -noprompt \
-storepass annotation-tools
```

### Updating an existing trust store

If an existing trust store is already available, the `update_truststore.sh` script can be used to update it with the latest certificate. The script requires `openssl` and `keytool` be installed on the machine; it will pull the latest certificate from `https://genie.genomenexus.org` and update it in the trust store.

The script can be run as follows:
```
sh update_truststore.sh <path to truststore> <truststore password>
```

### Install Python packages

You need to have python3 installed.
Expand Down
37 changes: 37 additions & 0 deletions update_truststore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

GENIE_GENOMENEXUS_SITE="genie.genomenexus.org"
GENOMENEXUS_SERVERNAME="www.genomenexus.org"

truststore=$1
truststore_password=$2

if [ -z $truststore ] ; then
echo "Missing truststore, exiting..."
exit 1
fi

if [ -z $truststore_password ] ; then
echo "Missing truststore password, exiting..."
exit 1
fi

which openssl
if [ $? -ne 0 ] ; then
echo "openssl needs to be installed. Exiting..."
exit 1
fi

which keytool
if [ $? -ne 0 ] ; then
echo "keytool needs to be installed. Exiting..."
exit 1
fi

true | openssl s_client -connect $GENIE_GENOMENEXUS_SITE:443 -servername $GENOMENEXUS_SERVERNAME 2>/dev/null | openssl x509 > tmp.cert

keytool -delete -noprompt -alias $GENIE_GENOMENEXUS_SITE -keystore $truststore -storepass $truststore_password
keytool -import -noprompt -alias $GENIE_GENOMENEXUS_SITE -file tmp.cert -keystore $truststore -storepass $truststore_password
rm tmp.cert

echo "$truststore updated with newest cert from $GENOMENEXUS_SITE"