openshift : unable to write 'random state'
Solution 1:
This error occurs because you are not allowed to create files in your home directory on Openshift. This command attempts to create a file at $HOME/.rnd
and you see the error because the file cannot be created.
You must tell openssl
which file to use for writing random state and you do so by exporting the $RANDFILE
environment variable. On Openshift you can write in $OPENSHIFT_DATA_DIR
directory so create the command as follows:
export RANDFILE=$OPENSHIFT_DATA_DIR/.rnd
openssl genrsa -des3 -out $OPENSHIFT_DATA_DIR/myApp.key 2048
Solution 2:
Similar solution, but a savvy for me I found here.
So I made next:
mkdir ~/"directory where certificates will be generated"
cd ~/"directory where certificates will be generated"
touch .rnd
export RANDFILE="~/"directory where certificates will be generated"/.rnd"
Now openssl genrsa -des3 -out server.key 2048
command working properly for me.