8

I am attempting to connect to a service using OpenVPN.

There are a number of configuration files (.OVPN) that share a single certificate (ca.crt); all are located in the same directory. Canada.ovpn, for example:

client
dev tun
proto udp
remote ca.#########.com 443
resolv-retry 5
nobind
fast-io
float
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
route-delay 5 30
script-security 3 system
ping-restart 0
mute-replay-warnings
verb 3

When I attempt to connect:

sudo openvpn --config ./configs/canada.ovpn --auth-user-pass ./credentials.txt

I get an error that reads:

Options error: --ca fails with 'ca.crt': No such file or directory Options error: Please correct these errors. Use --help for more information.

It seems that openvpn is having difficultly with the relative path. I changed the relevant line to ca ./ca.crt, but that resulted in the same error.

Configuration files that have an in-line certificate work as expected.

What is the correct way to use a relative path to a certificate in an .OVPN file?

3
  • Where is the file ca.crt located? One directory up from where canada.ovpn is, as the config and command line suggests? Nov 9, 2014 at 19:39
  • It is also located in the configs directory (i.e. with the *.ovpn files).
    – craibuc
    Nov 9, 2014 at 19:47
  • Ok, good to have that confirmed. Then I believe my answer should have you covered both in terms of what is the current problem and how --cd is likely the road to sanity. Nov 9, 2014 at 19:59

1 Answer 1

15

It appears that the referenced file does not exist in the current working directory.

Is your intention to reference a file that is also in the same directory as the config (.ovpn) file? If so, based on your command line, it does not appear that these files are actually in ./ but rather in configs/.

As a better approach, I believe you may want to use the --cd option to have openvpn change working directories before opening any files.

1
  • 1
    That worked. Needed to move the credentials file (cred.txt) to the same directory. Working command: sudo openvpn --cd /etc/certificates/configs --config canada.ovpn --auth-user-pass ./cred.txt
    – craibuc
    Nov 10, 2014 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.