Guys
I am getting the following message on an Ubuntu server
Couldn’t connect to www.textmarketer.biz/162.13.37.75:443, please make sure that the ssl certificates of that site are added to the java keystore.Download the keystore in the browser and update the java cacerts file in jre/lib/security: keytool -import -file downloaded.crt -keystore cacerts
I am trying to call the textmarketer.biz server using an http request. This works fine on my developer which incidentally is a Max but on the production server this error is thrown.
Many thanks
Gordon
Well found my own answer here but for the benefit of anyone else who runs into this there is a very sweet fix:
Create a bash script with this
#!/bin/bash
host=$1
port=$2
# Make sure we got the host name
if (( ${#host} == 0 )); then
echo "usage: $0 <hostname> [port]"
exit 1
elif (( ${#port} == 0 )); then
# Set default port if it wasn't passed
port=443
fi
# Check for root/sudo access
if ( ! sudo -n echo -n ''); then
echo "This script requires root access to run. please run:"
echo " sudo $0 $host $port"
fi
# Make sure ca-certificates-java is installed
if (dpkg -s ca-certificates-java 2> /dev/null > /dev/null); then
sudo apt-get install -y ca-certificates-java
fi
# check for local ca-certificates folder
if [ ! -d /usr/share/ca-certificates/local ]; then
sudo mkdir /usr/share/ca-certificates/local/
fi
# Get the certificate, and write it to a file
echo "" | openssl s_client -showcerts -host ${host} -port ${port} 2> /dev/null \
| openssl x509 | sudo tee /usr/share/ca-certificates/local/$host.crt
# add the new file to the configuration
echo "local/$host.crt" | sudo tee -a /etc/ca-certificates.conf
# run update-ca-certificates
sudo update-ca-certificates
change its permissions to all it to run with
chmod u+x yourfile.sh
run it with
sudo ./yourfile.sh URL PORT
so in my case sudo ./keystore.sh www.textmarketer.biz 443
and it does the rest ![Smile :)]()