aboutsummaryrefslogtreecommitdiffstats
path: root/dcae-controller-service-docker/dcae-controller-service-docker-host/dcae-controller-service-docker-host-manager/src/main/server/bin/get-ecomp-nexus-cert.sh
blob: dbf49e0f98c92e34a2b4581e26b1d5c6e6d7796d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash

# assumes 10.208.197.75 ecomp-nexus is in /etc/hosts and 
# we have a route to it
#
# run as root

_die() {
	printf "$(date):FATAL:$1\n"
	exit 2;
}

_print() {
	printf "$(date):INFO:$1\n";
}


DOCKER_ETC_DIR="/opt/app/docker/etc"
NEXUS_CERT=${DOCKER_ETC_DIR}/nexus.crt

_print "Getting ecomp-nexus certificate ..."

keytool -printcert -rfc -sslserver ecomp-nexus:8443 > ${NEXUS_CERT}

grep "BEGIN CERTIFICATE" ${NEXUS_CERT} || 
	_die "Could not retrieve certificated"

_print "Adding certificate ..."
cp -p ${NEXUS_CERT} /usr/local/share/ca-certificates || 
	_die "Could not copy certficate into place"

_print "Updating CA certificates ..."
update-ca-certficates

#
# restart docker 
#

_print "Restarting docker ..."
service docker restart