[hloeung] Fixed error when SSL chain certificate file is missing.
Rewrite logic so it may be easier to follow instead of splitting up using cert/key from file shipped with charm and then further down writing out cert/key from provided config options.
Fixed so that code for SSL chain certificates won't execute when using self-signed SSL certificates.
Fixed bug with chmod and chown, $KEYFILE is not $KEY_FILE. The charm itself already enforces tighter permissions on the private key file.
Minor indentation fix.
Merged changes from upstream.
Replace shipping out and running script
Fixed to use environment variable, OpenSSL config(5) states that it needs to be ENV::name.
[hloeung,r=mthaddon] Fix error below when SSL chain certificate file is missing, and create cert from template for self-signed cert