Failed to create certificate when I want to run source ./vars and ./clean-all

Orionpax picture Orionpax · Dec 1, 2014 · Viewed 14k times · Source

I found a similar thread, but it still doesn't fix my issue.(OpenVPN Source vars not working on debian)

I was setting up OpenVPN according to https://help.ubuntu.com/14.04/serverguide/openvpn.html

and there was a problem when I tried to create my certificate according to the following guide:

cd /etc/openvpn/easy-rsa/ ## move to the easy-rsa directory
sudo chown -R root:admin . ## make this directory writable by the system administrators
source ./vars ## execute your new vars file
./clean-all ## Setup the easy-rsa directory (Deletes all keys)
./build-dh ## takes a while consider backgrounding
./pkitool --initca ## creates ca cert and key
./pkitool --server server ## creates a server cert and key
cd keys
openvpn --genkey --secret ta.key ## Build a TLS key
cp server.crt server.key ca.crt dh1024.pem ta.key ../../

when I try:

source ./vars

the shell gives me back:

NOTE: If you run ./clean-all, I will be doing a rm -r on /etc/openvpv/easy-rsa/keys

I ignored it and tried the next line:

sudo ./clean-all

it then says:

Please source the vars script first (i.e. "source ./vars")
Make sure you have edited it to reflect your configuration

I searched in google and stackoverflow, failed to resolve the problem.

Thanks for your help

Could anyone help me?

Answer

Frankenmint picture Frankenmint · Dec 1, 2014
  1. Restart the PC
  2. Open the terminal and type sudo su to log in as root
  3. move to the easy-rsa directory (on mine, the files are in easy-rsa/2.0/)
  4. type mkdir keys
  5. type source ./vars
  6. type ./clean-all
  7. type ./build-ca

    all the same commands as before but having created the keys directory and actually being logged in as root, instead of running it with sudo seemed to do the trick

Taken from here: http://ubuntuforums.org/showthread.php?t=801135