Page 1 of 1

Error opening configuration file:

Posted: Wed Apr 27, 2011 3:36 am
by pinguim007
helo I had to remake my server and I am using a different interface on my client. I would like to known why I am receiving this error on my logs?

What sould I do, the openvpn I am using is the last one from yum installer and I am using the same Ip address on the new interface.

Re: Error opening configuration file:

Posted: Wed Apr 27, 2011 6:21 am
by janjust
we need a little more information if you want us to help you.
Which configuration file is openvpn trying to open? using which command/script? what happens if you run

Code: Select all

openvpn --config </full/path/to/config/file>
where "</full/path/to/config/file>" is the path to your config file (a good place to start looking is /etc/openvpn.

which Linux distro are you using?

Re: Error opening configuration file:

Posted: Wed Apr 27, 2011 6:44 am
by pinguim007
thanks my friend, I found the problem using openvpn --config it is a route problem.

rRe: Eror opening configuration file:

Posted: Wed Apr 27, 2011 8:25 am
by pinguim007
sorry, but when I give --config parameter it works!!!, but When I command service openvpn start; gives me this error at /var/log/messages
openvpn[3230]: Options error: In [CMD-LINE]:1:Eror opening configuration file:

I am using a centos.

On debian .conf works well should I have another .conf like .cfg or something on centos?
Why is it not reading my .conf?

what kind of permission should I set for the configuration file on centos and what Owner?

can somebody help me?

Re: Error opening configuration file:

Posted: Wed Apr 27, 2011 10:46 am
by janjust
to start openvpn on the command line you always need to specify '--config'. this is true for Debian also. What might happen on Debian is that a wrapper script is present which does this for you.

When you install OpenVPN on CentOS (which I use regularly) you can use the /etc/init.d/openvpn script to start openvpn as a service; this script picks up all configuration files from /etc/openvpn/*.conf

Re: Error opening configuration file:

Posted: Wed Apr 27, 2011 7:48 pm
by pinguim007
I was believing on that too, but When I restart the service gives me this error.

I have on my configuration the parameter cd /etc/openvpn/ is that correct?

It works on debian.

do you known why is not getting up the .conf?

Re: Error opening configuration file:

Posted: Wed Apr 27, 2011 9:29 pm
by janjust
how do you restart the server? on centos you'd normally use

Code: Select all

service openvpn restart
or

Code: Select all

/etc/init.d/openvpn restart
if openvpn works from the commandline but not as a service then there's something wrong with your /etc/openvpn files ; there's no need to use 'cd /etc/openvpn' inside an openvpn config file, as long as you use absolute paths to the certificate and key files.

If the openvpn service does not work then check the /var/log/messages file for any warnings/errors (other than 'cannot open config file').

As a final debugging trick you can run

Code: Select all

bash -vx /etc/init.d/openvpn restart
and post the output here - it should give a good clue as to what is going wrong here.

Re: Error opening configuration file:

Posted: Thu Apr 28, 2011 12:20 am
by pinguim007
I will change the verbose to 9 and later I will recreate the .conf and I give you more information.

Re: Error opening configuration file:

Posted: Thu Apr 28, 2011 2:04 am
by pinguim007
it is not giving me any more logs and even reading the parameters log, log-append and staus. it is only giving me when I execute openvpn --config parameter.
I will reinstall the operational system and later try again, if I have the same problem I will post more questions.

thank you very much

Re: Error opening configuration file:

Posted: Fri Apr 29, 2011 1:28 am
by pinguim007
hello thanks again, I have reinstalled the os and its comeback reading the .conf.

Re: Error opening configuration file:

Posted: Fri Apr 29, 2011 8:13 am
by janjust
can you post the configuration file that it is trying to read? or all /etc/openvpn/*.conf files, for that matter?

Re: Error opening configuration file:

Posted: Fri Jul 27, 2012 4:11 am
by scott.tanner
Sorry for reopening an old thread, but I just had a similar issue and found this post while searching for an answer.

For me, it seems selinux (in enforcing mode) was blocking the init script from running, but allowing root to start the process from command line. Once I changed /etc/sysconfig/selinux to passive mode and rebooted, the init script started working.

[vpn]# /etc/init.d/openvpn start
/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/vpnserv.pid --config /etc/openvpn/vpnserv.conf --cd /etc/openvpn --script-security 2
Options error: In [CMD-LINE]:1: Error opening configuration file: /etc/openvpn/vpnserv.conf

[vpn]# /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/vpnserv.pid --config /etc/openvpn/vpnserv.conf --cd /etc/openvpn --script-security 2
[vpn]# ps -eaf |grep openvpn
root 1790 1 0 Jul26 ? 00:00:00 /usr/sbin/openvpn ......

Regards,
Scott