Pages

Wednesday, 27 February 2013

在linux桌面系统下使用gopenvpn



screenshotgopenvpn is a simple graphical front-end for OpenVPN, the open source VPN solution.
It provides a GNOME system tray icon from which OpenVPN connections can be started and stopped, and a dialog from which OpenVPN's logs can be viewed. It can manage multiple simultaneous connections, and graphically indicates when you're connected to a VPN tunnel.

getting the source
You can download the latest source from git repository with the following command:
git clone git://gopenvpn.git.sourceforge.net/gitroot/gopenvpn/gopenvpn.git
installing from source
1. Install prerequisites
The following libraries are prerequisites:
  • glib-2.0
  • gtk+-2.0
  • glade-2.0
  • gnome-keyring (for remembering passphrases)
  • polkit-0.97 (or newer)
The following packages are also prerequisites:
  • gedit (for editing configuration files)
The procedure for installing these prerequisites will vary depending on your operating system. To install the prerequisites in Ubuntu 6.06 Dapper, you could type:
[Debian/Ubuntu] sudo apt-get install libglib2.0-dev libgtk2.0-dev libglade2-dev libgnome-keyring-dev gedit polkit
[Fedora/RHEL] sudo yum install glib2-devel gtk2-devel libglade2-devel gnome-keyring-devel automake autoconf gettext make gcc desktop-file-utils polkit
2. Build it
cd gopenvpn
./autogen.sh
./configure
make
3. Install it
sudo make install
4. To run gopenvpn on login, add /usr/local/bin/gopenvpn to your GNOME
session's startup items.
installing from binaries
Ubuntu Jaunty (9.04)
Package: http://mirror.sifnt.net.au/linux/dists/jaunty/main/binary-i386/gopenvpn_0.6-0sifnt_i386.deb
Diff: http://mirror.sifnt.net.au/linux/dists/jaunty/main/source/gopenvpn_0.6-0sifnt.diff.gz
If you're a Ubuntu user it's probably easier to just add the following sources to apt, that way you can just use apt-get install gopenvpn and apt-get source gopenvpn:
deb http://mirror.sifnt.net.au/linux jaunty main
deb-src http://mirror.sifnt.net.au/linux jaunty main
Red Hat Enterprise Linux / CentOS 5
i386 package: gopenvpn-0.6-2.el5.astc.i386.rpm
x86_64 package: gopenvpn-0.6-2.el5.astc.x86_64.rpm
source package: gopenvpn-0.6-2.el5.astc.src.rpm
The command to install the RPMs on RHEL/CentOS 5.3 would be:
yum --enablerepo=rpmforge install <package-name>
configuration files
gopenvpn will look in the directory /etc/openvpn for OpenVPN configuration files. OpenVPN configuration files with suffixes ".conf" and ".ovpn" are recognized. Any configuration files found will appear in gopenvpn's context menu.
Note that the stable gopenvpn ships with a setuid executable "gopenvpnstart" which is used to start VPN connections without entering a password to gain administrator privileges. The assumption is that OpenVPN configuration files in the /etc/openvpn directory on a desktop computer are safe to be initiated by an ordinary user. If you are concerned about the setuid executable, you can #define USE_GKSU in gopenvpn.c and remove gopenvpnstart. This will cause gopenvpn to ask for administrator privileges via a gksu dialog box whenever you start a connection.
The next release will use PolicyKit instead and gopenvpn will ship with a default policy where the user is asked for its password to start an OpenVPN connection. To edit the configuration, the root password would have to be provided. This is partly implemented in the git repository already.
using gopenvpn
You can launch gopenvpn manually
/usr/local/bin/gopenvpn
... or add it to your GNOME session's startup items so that it starts up whenever you login to your computer.
Once gopenvpn is loaded, its system tray icon will appear. The tray icon appears RED when no connection is active, YELLOW and blinking when a connection is being made, and GREEN when one or more connections is active.
Right-click on the tray icon to display the gopenvpn context menu. The context menu lists all the VPN connections available to connect, as determined by gopenvpn's scan of the /etc/openvpn directory for OpenVPN configuration files.
The OpenVPN log for each connection can be viewed in the Details dialog box, accessible from the "Details..." menu item on the context menu.
The Details dialog box permits you to tab between connections, reviewing the log for each, and can also connect/disconnect connections and edit the configuration files

from http://gopenvpn.sourceforge.net/
---------------------------------------------------------
安装gOpenVPN
打开终端输入以下命令
wget http://mirror.sifnt.net.au/linux/dists/jaunty/main/binary-i386/gopenvpn_0.6-0sifnt_i386.deb
sudo dpkg -i gopenvpn_0.6-0sifnt_i386.deb
(如果不成功请去其官网http://gopenvpn.sourceforge.net/下载安装)
建立VPN连接
把你的openvpn的配置文件复制到/etc/openvpn目录(需要以管理员权限打开此目录)
在菜单互联网目录下找到gOpenVPN运行后会在右上角出现一个含vpn字样的红色图标,右键选择你的配置开始连接等图标变成绿色就表示连接成功可以翻墙了,


(我以前在ubuntu里使用过network-manager-openvpn,可是这次总是不成功,对network-manager- openvpn感兴趣的可以看http://www.tuvpn.com/tutoralcont.php?ln=zh&id=128)