Problem in starting openvpn

This forum is for all inquiries relating to the installation of OpenVPN from source and with binaries.

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

Forum rules
Please visit (and READ) the OpenVPN HowTo http://openvpn.net/howto prior to asking any questions in here!
Post Reply
etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Problem in starting openvpn

Post by etrader » Sun Jun 05, 2011 3:21 am

I just installed OpenVPN according to the instruction give at http://directspace.net/eportal/knowledg ... icle&id=10

But when I try to start openvpn, it fails with this error

Code: Select all

 ~]# service openvpn start
Starting openvpn: /etc/init.d/openvpn: line 169: script_security---script-security 2: command not found
/etc/init.d/openvpn: line 169: script_security---script-security 2: command not found

martian111
OpenVpn Newbie
Posts: 2
Joined: Sun Jun 05, 2011 11:08 am

Re: Problem in starting openvpn

Post by martian111 » Sun Jun 05, 2011 11:10 am

Hi,

I just ran into this problem when installing the newest version of OpenVPN using RPMForge:
openvpn x86_64 2.2.0-2.el5.rf rpmforge 469 k

The issue is a typo in the /etc/init.d/openvpn file. The following patch fixed this issue for me:

Code: Select all

[root@server openvpn]# diff -u /etc/init.d/openvpn.orig /etc/init.d/openvpn
--- /etc/init.d/openvpn.orig	2011-05-23 15:01:04.000000000 -0600
+++ /etc/init.d/openvpn	2011-06-05 05:04:15.000000000 -0600
@@ -166,7 +166,7 @@
         # Handle backward compatibility, see Red Hat Bugzilla ID #458594
         script_security=''
         if [ -z "$( grep '^[[:space:]]*script-security[[:space:]]' $c )" ]; then
-            script_security-"--script-security 2"
+            script_security="--script-security 2"
         fi
 	    $openvpn --daemon --writepid $piddir/$bn.pid --config $c --cd $work $script_security
 	    if [ $? = 0 ]; then
I'm not sure yet where to post a bug on this... but it's a simple fix at this point...

Hope this helps...
Martin

martian111
OpenVpn Newbie
Posts: 2
Joined: Sun Jun 05, 2011 11:08 am

Re: Problem in starting openvpn

Post by martian111 » Sun Jun 05, 2011 11:26 am

Actually, found the RPMforge committer and left him a comment/message:
https://github.com/repoforge/rpms/commi ... ript.patch

Also opened a new bug/issue:
https://github.com/repoforge/rpms/issues/11


Martin

etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Re: Problem in starting openvpn

Post by etrader » Sun Jun 05, 2011 2:52 pm

I edited /etc/init.d/openvpn file by changing the line to

Code: Select all

script_security="--script-security 2"
The error is gone, but still when starting openvpn, it fails.

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Problem in starting openvpn

Post by maikcat » Mon Jun 06, 2011 9:47 am

hi there,

please post openvpn server log if you want someone to help you..


Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Re: Problem in starting openvpn

Post by etrader » Mon Jun 06, 2011 10:24 pm

Sorry for my failure. Where can I find openvpn server log?

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Problem in starting openvpn

Post by maikcat » Tue Jun 07, 2011 6:38 am

add log statement inside server config f.e

log /etc/openvpn/server.log

and restart the server

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Re: Problem in starting openvpn

Post by etrader » Wed Jun 08, 2011 6:16 am

Thanks Michael. This is what written into the server log after trying to start openvpn (which is FAILED in ssh)

Code: Select all

Wed Jun  8 10:12:05 2011 OpenVPN 2.2.0 i686-redhat-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] built on May 23 2011
Wed Jun  8 10:12:05 2011 IMPORTANT: OpenVPN's default port number is now 1194, based on an official port number assignment by IANA.  OpenVPN 2.0-beta16 and earlier used 5000 as the default port.
Wed Jun  8 10:12:05 2011 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Wed Jun  8 10:12:05 2011 Cannot open dh1024.pem for DH parameters: error:02001002:system library:fopen:No such file or directory: error:2006D080:BIO routines:BIO_new_file:no such file
Wed Jun  8 10:12:05 2011 Exiting

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Problem in starting openvpn

Post by maikcat » Wed Jun 08, 2011 6:58 am

hi there,

>Cannot open dh1024.pem for DH parameters: error:02001002:system library:fopen:No such file or directory: error:2006D080:BIO routines:BIO_new_file:no such file

your dh1024.pem file is missing or it is located elsewhere...

when you generated certs , you issued build-dh command
this command creates the above file.

it would help alot if you posted the server config file though.

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Re: Problem in starting openvpn

Post by etrader » Wed Jun 08, 2011 8:01 am

Actually I did not created certs manually, as I followed the procedure instructed at http://directspace.net/eportal/knowledg ... icle&id=10

The openvpn.conf is

Code: Select all

dev tun
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
push "route 10.8.0.0 255.255.255.0"
push "redirect-gateway"
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
group nobody
daemon
log /etc/openvpn/server.log

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Problem in starting openvpn

Post by maikcat » Wed Jun 08, 2011 8:11 am

hi there,

anyway the dh1024.pem file is missing...

i suggest you read the docs and build keys by yourself.

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Re: Problem in starting openvpn

Post by etrader » Wed Jun 08, 2011 7:02 pm

Thanks Michael. I created it according to the OpenVPN How-To, and now the openvpn is successfully starting on the server. But I cannot connect to it by OpenVPN GUI from my Windows machine. The icon remains yellow without any error message.

I do not know whether it is still a problem associated with the server, or bad configuration of Open VPN GUI. How I cannot verify (test) that OpenVPN on the server is working correctly?

Thank you in advance.

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Problem in starting openvpn

Post by maikcat » Thu Jun 09, 2011 7:28 am

hi there,

for start you should post your configs here...
and server logs.

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Re: Problem in starting openvpn

Post by etrader » Thu Jun 09, 2011 6:04 pm

Thanks for your kind attention. The server config is

Code: Select all

dev tun
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
ca ca.crt
cert etrader.crt
key etrader.key
dh dh1024.pem
push "route 10.8.0.0 255.255.255.0"
push "redirect-gateway"
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
group nobody
daemon
log /etc/openvpn/server.log
The config file in C:\Program Files\OpenVPN\config

Code: Select all

remote 69.163.33.111
tls-client
dev tap
ca ca.crt
cert etrader.crt
key etrader.key
ping 10
verb 1
mute 10
comp-lzo

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Problem in starting openvpn

Post by maikcat » Fri Jun 10, 2011 9:14 am

hi there,

remove this
>push "route 10.8.0.0 255.255.255.0"

also change this

>push "redirect-gateway"

to this

push "redirect-gateway def1"

also to your client config

change this
>dev tap
to this
dev tun

ps: i noticed that you are using the SAME certificate to both server/client...
can you post exactly how did you build your keys?

Michael
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

etrader
OpenVpn Newbie
Posts: 8
Joined: Sun Jun 05, 2011 3:19 am

Re: Problem in starting openvpn

Post by etrader » Fri Jun 10, 2011 4:36 pm

Thanks for your patience. It seems I have done something wrong. I copied the crt and key files from the server to my local Windows machine. Should I create cert in my local machin? I just created static key file.

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Problem in starting openvpn

Post by maikcat » Mon Jun 13, 2011 8:21 am

hi there,

to create your keys follow the above sequence..

first edit vars file
source it
then do the following

build-ca
build-key-server server <--builds a key named server for use on your openvpn server
build-dh
build-key user01 <--build a key named user for use on your client

to generate static.key file cd into keys dir and type
openvpn --genkey --secret ta.key

replace the names into your configs and try again to connect...

ps: there is a detailed howto into doc section to the openvpn.net site

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

Post Reply