Page 1 of 1

Can't start OpenVPN as a service using init script

Posted: Thu Mar 10, 2011 4:18 pm
by chrisedes
OK, so I browsed everything in this forum under Server Administration, and viewed any thread which appeared remotely relevant. I've also done extensive Google searches and gone through the documentation online, both on openvpn.net and elsewhere. So I can only assume I am missing something incredibly obvious :)

I have configured OpenVPN and it works great. It is super awesome... with one little problem. I can run OpenVPN from a shell as "openvpn <config file>" and it does not prompt me for a username and password. I can run OpenVPN from a shell as "openvpn --daemon --writepid /var/run/openvpn/this.pid --config server.conf --cd /etc/openvpn" and it does not prompt me for a username and password. I copied this from the init script.

However, when I type "service openvpn start" I am asked for an "Auth Username" and "Auth Password" and OpenVPN will not start unless I provide appropriate credentials. If I do provide them, it works. This is a problem because I would like OpenVPN to come up automatically if the server is restarted, and I will not always be there at a console to enter the username and password.

(I suppose for some reason it may work when run as part of the normal startup process, and only because I am manually typing "service openvpn start" does it ask for credentials. However I can't test this now, and it would make no sense to me anyway.)

I am not using client certificates, but rather the PAM module "/usr/share/openvpn/plugin/lib/openvpn-auth-pam.so" . Perhaps this has something to do with it, but again I don't understand why I can run it as a daemon from a shell with no problem, and only experience undesired behavior when using the init script.

Clients can connect just fine with usernames and passwords. I am also using the tls-auth key. None of the private keys require passwords to access them. I have administered several certificate authorities using OpenSSL and I am confident this is not the problem.

So..... what's the deal? I am usually one of those "never ask for directions" guys but this has me stumped. Thanks for any help you can provide.

Re: Can't start OpenVPN as a service using init script

Posted: Fri Mar 11, 2011 3:34 am
by Bebop
How many .conf files reside in your OpenVPN directory? (/etc/openvpn/ or whatever your default is)

Server.conf doesn't need a password, so to me it sounds like your problem is that you also have a client.conf in your directory.

I can almost guarantee that your answer will be that you have more than 1 .conf file in your openvpn dir, and that 1 of the .conf files is a client.conf.

FYI: 'service openvpn start' will execute every .conf file as a daemon. You should move any unwanted .conf to another dir (sub dir is ok).

Re: Can't start OpenVPN as a service using init script

Posted: Fri Mar 11, 2011 6:56 am
by chrisedes
You are 100% correct! I knew it was something obvious. I looked right at the part in the init script where it cycled through the .conf files, and it never occurred to me that it was trying to execute as a client. It makes perfect sense now. Thanks!

This thread can be marked as resolved.

Re: Can't start OpenVPN as a service using init script

Posted: Fri Mar 11, 2011 9:26 am
by maikcat
ok then

i am closing topic


michael