Error opening configuration file:

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
pinguim007
OpenVPN User
Posts: 48
Joined: Sun Oct 03, 2010 4:55 pm

Error opening configuration file:

Post by pinguim007 » Wed Apr 27, 2011 3:36 am

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.

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Error opening configuration file:

Post by janjust » Wed Apr 27, 2011 6:21 am

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?

pinguim007
OpenVPN User
Posts: 48
Joined: Sun Oct 03, 2010 4:55 pm

Re: Error opening configuration file:

Post by pinguim007 » Wed Apr 27, 2011 6:44 am

thanks my friend, I found the problem using openvpn --config it is a route problem.

pinguim007
OpenVPN User
Posts: 48
Joined: Sun Oct 03, 2010 4:55 pm

rRe: Eror opening configuration file:

Post by pinguim007 » Wed Apr 27, 2011 8:25 am

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?

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Error opening configuration file:

Post by janjust » Wed Apr 27, 2011 10:46 am

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

pinguim007
OpenVPN User
Posts: 48
Joined: Sun Oct 03, 2010 4:55 pm

Re: Error opening configuration file:

Post by pinguim007 » Wed Apr 27, 2011 7:48 pm

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?

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Error opening configuration file:

Post by janjust » Wed Apr 27, 2011 9:29 pm

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.

pinguim007
OpenVPN User
Posts: 48
Joined: Sun Oct 03, 2010 4:55 pm

Re: Error opening configuration file:

Post by pinguim007 » Thu Apr 28, 2011 12:20 am

I will change the verbose to 9 and later I will recreate the .conf and I give you more information.

pinguim007
OpenVPN User
Posts: 48
Joined: Sun Oct 03, 2010 4:55 pm

Re: Error opening configuration file:

Post by pinguim007 » Thu Apr 28, 2011 2:04 am

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

pinguim007
OpenVPN User
Posts: 48
Joined: Sun Oct 03, 2010 4:55 pm

Re: Error opening configuration file:

Post by pinguim007 » Fri Apr 29, 2011 1:28 am

hello thanks again, I have reinstalled the os and its comeback reading the .conf.

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Error opening configuration file:

Post by janjust » Fri Apr 29, 2011 8:13 am

can you post the configuration file that it is trying to read? or all /etc/openvpn/*.conf files, for that matter?

scott.tanner
OpenVpn Newbie
Posts: 1
Joined: Fri Jul 27, 2012 3:48 am

Re: Error opening configuration file:

Post by scott.tanner » Fri Jul 27, 2012 4:11 am

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

Post Reply