maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Openvpn Applet (https://talk.maemo.org/showthread.php?t=20921)

mikkov 2008-06-12 20:49

Openvpn Applet
 
1 Attachment(s)
I have made a small desktop applet for controlling openvpn connections. Get it from maemo Extras repository


Features:
- Import openvpn settings through gui
- Needs only standard openvpn configuration files, no extra configuration
- Supports multiple connections
- Supports username and password authentication

maillaxa 2008-06-12 21:22

Re: Openvpn Applet
 
How does it compare to vpnc-gui ?

mikkov 2008-06-12 21:29

Re: Openvpn Applet
 
Well as far as I know vpnc-gui doesn't do openvpn. And openvpn-applet is implemented as desktop plugin.

mikkov 2008-06-14 14:25

Re: Openvpn Applet
 
I made minor changes to openvpn-applet. New release is available from garage.

changes:
'sudo kill' is not required any more. /etc/init.d/openvpn is automatically added to sudoers file.
bug related to zombie processes is fixed.

gochito 2008-08-18 19:52

Re: Openvpn Applet
 
Great addition... OpenVPN is my VPN of choice, and so far manually running the script was gettig boring... However, when I use the applet, I am able to define and import my vpn files, but when I go to Test or connect, there are no VPNs on the list...

Now if we can get rtcomm to see the VPNs :-)

mikkov 2008-08-18 20:06

Re: Openvpn Applet
 
Just released 0.3.2 with better import.

what is your configuration file name? It has to be .conf. Also .ovpn should work in theory, but I haven't tested so it is very likely that doesn't work.

gochito 2008-08-18 20:51

Re: Openvpn Applet
 
Aha! I was trying with the .ovpn file... let me try with the .conf file...

Works, but I can't enter the password for the certificate... Let me see how to get around that...

mikkov 2008-08-18 20:54

Re: Openvpn Applet
 
OK, password thing is also not so much tested. Does you config contain auth-user-pass, askpass or something else authentication related?

edit:
openvpn-applet asks passwors only if condig contains askpass, and username and password only if config contains auth-user-pass

gochito 2008-08-18 21:02

Re: Openvpn Applet
 
Done! ... Created the password file in the /etc/openvpn directory...

included askpass /etc/openvpn/password

in my .conf file and Voila! Working as a charm!

Thanks a lot!

gochito 2008-08-18 21:06

Re: Openvpn Applet
 
Now checking if the sofia-sip (or Telepathy or mission control or ...) can see the tun device for the SIP stack :-)

gochito 2008-08-18 22:31

Re: Openvpn Applet
 
Nope, still have to manually set the good ol' mc-account with the tun0 address ....

mikkov 2008-08-18 22:49

Re: Openvpn Applet
 
Are you trying to get built-in SIP client to talk through tun0?

I have done something like that with
Code:

redirect-gateway def1
up /etc/openvpn/domain.up
down /etc/openvpn/domain.down

redirect-gateway def1 directs all traffic though tun interface so up and down scritps are used to set nameservers.

gochito 2008-08-18 22:59

Re: Openvpn Applet
 
I tried the redirect gateway a while ago and could not get the built-in client to connect to my Asterisk server when the openvpn was up... The only way that I could get it to work is with the mc-account set sip0 string:local-ip-address= $tun0_ip....

mikkov 2008-08-18 23:06

Re: Openvpn Applet
 
I was using only google talk, so there could be a difference. If you didn't set nameserver, that could also block sip?

With up script you can anyway run anything when openvpn connection starts

gochito 2008-08-19 14:04

Re: Openvpn Applet
 
A while ago I reported bug 1860 in bugzilla... some of the nokia guys commented that the SIP stack is not currently aware of the tun0 interface going up/down, so the workaround that I found (here in the forums) was to manually assign the openvpn address to just the SIP account... Basically what I do is connect to the Openvpn server @ my office and log into my asterisk account with the N810 when out of the office... When I am @ the office i just log into the wlan and connect directly to Asterisk (192.168.x.x)... So I don't need to set the nameservers from the VPN connection...

gochito 2008-08-19 14:16

Re: Openvpn Applet
 
Mikkov:

Now, do the if-up and if-down scripts execute when the tun0 goes up/down? I did some testing yesterday but did not get very far... A nice addition to your applet would be a pre/post-start and pre/post-stop scripts , since I am sure that many users need to do stuff before and after the vpn is up/down just related to the VPN tunnel :-)

Anyways, your applet removed a bunch of steps on setting up my SIP connection to the office...

mikkov 2008-08-19 15:34

Re: Openvpn Applet
 
Maybe there is slight misunderstanding.

Openvpn has up and down parameters which can run any command when tun device is opened and closed

Quote:

--up cmd
Shell command to run after successful TUN/TAP device open (pre --user UID change). The up script is useful for specifying route commands which route IP traffic destined for private subnets which exist at the other end of the VPN connection into the tunnel.

--down cmd
Shell command to run after TUN/TAP device close (post --user UID change and/or --chroot ). Called with the same parameters and environmental variables as the --up option above.

Note that if you reduce privileges by using --user and/or --group, your --down script will also run at reduced privilege.
To me it looks like this is exactly what you want to do.

gochito 2008-08-19 20:16

Re: Openvpn Applet
 
:-) Yeap, seems like there is... let me get into those and will comment on the results!

gochito 2008-08-19 21:33

Re: Openvpn Applet
 
Great! using the up and down parameters from openvpn and borrowing from jimhoy's scripts, I was able to get it working !

Here are Jimhoy's scripts...

http://www.internettablettalk.com/fo...=rtcomm&page=3

I used this part for the up:

#!/bin/sh
sleep 5
VPN_INT="tun0"
VPN_IP=`ifconfig $VPN_INT 2> /dev/null | sed -n 's/.*inet[adr: ]*\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/p'`
if [ -n "$VPN_IP" ]; then
mc-account set sip0 string:local-ip-address=$VPN_IP
fi

And a similar one for the down !

Excellent!

krbvroc1 2008-08-30 16:06

Re: Openvpn Applet
 
Maybe a dumb question but where is the tun/tap device?

I imported a ovpn file that I use on my laptop. Both 'test' and connect appears to work. However, there does not appear to be a tun or tap 'device'. If I type 'ifconfig' there is only lo and wlan0. 'route' does not show anything new.

I am running the latest diablo. I do not see a tun.ko module either. (unless is is built into the kernel) Any ideas?

mikkov 2008-08-30 17:45

Re: Openvpn Applet
 
Without seeing your config or log I guess that openvpn first starts but then crashes when using "Start" button.

Openvpn crashes if you have set verb 4 or higher in configuration file. Test button sets verb to 3 but start button uses what ever is set in configuration. Maybe I should address this problem in the next version.

If verb values isn't your problem maybe you could post you configuration file somewhere with private data anonymised (ip addresses etc)

alaaji 2008-09-01 16:05

Re: Openvpn Applet
 
How do I enter the username and password. It doesn't work for me without these two things.

mikkov 2008-09-01 16:16

Re: Openvpn Applet
 
Quote:

Originally Posted by mikkov (Post 215035)
openvpn-applet asks passwors only if condig contains askpass, and username and password only if config contains auth-user-pass

Your config file has to contain one of these parameters. If you are using something else for the authentication, let me know what.

alaaji 2008-09-01 16:23

Re: Openvpn Applet
 
My config file uses the auth-user-pass. When I run the test, I get a message stating: "Enter Auth Username:Mon Sep 1 16:21:00 2008 ERROR: could not read Auth username from stdin" and then it exits.

mikkov 2008-09-01 16:32

Re: Openvpn Applet
 
do you have version 0.3.3? It should work.

Is there anything else on the line with auth-user-pass?

alaaji 2008-09-01 17:22

Re: Openvpn Applet
 
Yes, I have version 0.3.3-1. The only other thing that it says is "OpenVPN 2.0.9 arm-unknown-linux-gnueabi [SSL] [LZO] [EPOLL] built on Jul 31 2008"

Thanks for helping me out here. I've been wracking my brain on how to get this to work even before you came out with this applet. I got it to work just fin on my Ubuntu laptop but this is more of a challenge.

mikkov 2008-09-01 17:45

Re: Openvpn Applet
 
Does it work if you start openvpn from console? start it with "/usr/sbin/openvpn /etc/openvpn/your_config"

mikkov 2008-09-02 10:28

Re: Openvpn Applet
 
Version 0.3.4 should fix problems with usernames and passwords.

alaaji 2008-09-04 04:37

Re: Openvpn Applet
 
Quote:

Originally Posted by mikkov (Post 220027)
Version 0.3.4 should fix problems with usernames and passwords.

I tried the new version but I am still getting the same message from before. :(
When I get the message that it can't read from "stdin", what is that? Can I edit this file? Where is it located? Is there a problem with the LZO option?

mikkov 2008-09-04 08:01

Re: Openvpn Applet
 
Configuration files are in /etc/openvpn. You have imported the file there, so you should have the "source" file. You can edit the source file and import it again. Or you can edit file directly from command line as root.

I can't reproduce you problem, so I would need to see your configuration file in order to fix the problem. You can edit ip-address and other sensitive information out from the file.

alaaji 2008-09-04 13:47

Re: Openvpn Applet
 
1 Attachment(s)
I've attached a copy of what my *.conf file looks like. I just edited out the sensitive info.

mikkov 2008-09-04 16:08

Re: Openvpn Applet
 
Seems to work for me. You could try to disable openvpn-applet and then enable it (or reboot).

Home applets don't seem to automatically restart after updating. I have to see if there is something that I could do about it for the next update.

alaaji 2008-09-05 08:54

Re: Openvpn Applet
 
Quote:

Originally Posted by mikkov (Post 220853)
Seems to work for me. You could try to disable openvpn-applet and then enable it (or reboot).

Home applets don't seem to automatically restart after updating. I have to see if there is something that I could do about it for the next update.

Thanks! That did the trick. I appreciate all of your help. :D

n810max 2008-09-06 05:56

Re: Openvpn Applet
 
Why does the openvpn-applet work when i choose open option>test but not when i click client>start on n810 (assuming my config is client.conf)


I have been struggling for days to make it work.


The open option>test works but you cannot leave the openvpn-applet debug window, apparently the window is modal. Thus, you cannot do anything on the tablet while the debug window is open.


However, I can ping the vpn ip from another computer which shows the tunnel is up.


Even when I run it from the xterm /etc/init.d/openvpn start the vpn fails (FAILED)

When I ran openvpn --config /etc/openvpn/client.conf, I get Assertion Failed error message.

It seems vpn only works with the openvpn-applet option test mode.

Hope you could help me.


Thanks in advance,

n810max 2008-09-06 06:03

Re: Openvpn Applet
 
mikkov, please disregard my post. While browsing the thread, I stumbled on post #21 at 08-31-2008, 01:45 AM where you suggested to get rid of the verb > 3.
which i did. Now it is working. Thanks to this wonderful thread. I have my openvpn working now.

stangri 2008-09-19 20:25

Re: Openvpn Applet
 
Please forgive a newbie (both in N8x0 and OpenVPN use), but can I somehow make the applet remember the login and password for the OpenVPN connection?

I have imported the configuration I used in Tunnelblik and the CA cert file and when I enter the login and password at the prompt I get the connection, but is it possible to script the login and password somewhere so I wouldn't have to type them all the time?

I'm not in control of my password for OpenVPN and it's a very long sequence with digits and upper case symbols, there's no way I can remember it.

thanks!

mikkov 2008-10-03 22:10

Re: Openvpn Applet
 
This is a little bit late answer but you can define password in openvpn configuration file:

Quote:

--auth-user-pass [up]
Authenticate with server using username/password. up is a file containing username/password on 2 lines (Note: OpenVPN will only read passwords from a file if it has been built with the --enable-password-save configure option, or on Windows by defining ENABLE_PASSWORD_SAVE in config-win32.h).

If up is omitted, username/password will be prompted from the console.

The server configuration must specify an --auth-user-pass-verify script to verify the username/password provided by the client.

Actually I am not sure if extras repo openvpn is built with --enable-password-save option. There is no other method at least for the moment.

see http://openvpn.net/index.php/documen...x-manpage.html

stangri 2008-10-05 12:27

Re: Openvpn Applet
 
Mikko,
thanks that worked fine. I've had the CA cert and the UP filenames in double-quotes, as soon as I removed them it just worked.

PS. Also thanks for porting FreeCIV, BOS Wars :).

jgombos 2008-11-27 22:24

Re: Openvpn Applet
 
It won't import the configuration.

openVPN works from the CLI just fine, but it seems the applet can't handle the configuration. The applet parses the config file, and automatically populates the filenames for the certificates (although it fails to grab the ta.key). Then I tap "import selected" and it just brings me to an empty dialog box, with no indication about what the problem is. This is the config file I'm feeding it:
Code:

float
remote xxx.xxx.xxx.xxx xxxx
dev tun
persist-key
persist-tun
proto udp
pull
route-method exe
route-delay 2
nobind
tun-mtu xxxx
comp-lzo
auth-user-pass pwauth
auth xxxxxxxxxxxxxx
cipher xxxxxxxxxxxxxxx
tls-cipher xxxxxxxxxxxxxxxxxxx
tls-client
client
tls-auth ta.key 1
ns-cert-type server
ca ca.crt
cert client.crt
key client.key
keepalive 10 60
resolv-retry xxxxxxx
verb 1
log openvpn.log

Is there a way to manually force a file import? Eg. can I just drop them in a folder and edit a configuration file for the applet itself?

mikkov 2008-11-27 22:31

Thanks for the report. I will try to investigate this problem later.

Until I fix the problem you can copy configuration files directly to /etc/openvpn directory. Applet should see the .conf or .ovpn file from there.


All times are GMT. The time now is 23:45.

vBulletin® Version 3.8.8