GP3.2 OpenVPN (en): Unterschied zwischen den Versionen

Aus Gemini-Wiki
Zur Navigation springen Zur Suche springen
Zeile 154: Zeile 154:
 
Back to [[#top | table of contents]]
 
Back to [[#top | table of contents]]
  
== Einstellungen ==
+
== Settings ==
 
[[Bild:GP3 OpenVPN Einstellungen.png|thumb|none|OpenVPN Einstellungen|480px]]
 
[[Bild:GP3 OpenVPN Einstellungen.png|thumb|none|OpenVPN Einstellungen|480px]]
  
Öffnet das '''OpenVPN Server''' Plugin im BluePanel unter den Daemons. Nun kontrollieren wir zuerst die Einstellungen, bevor wir den OpenVPN Server starten. Drückt die '''[blaue]''' Taste Menü und selektiert den Menüpunkt '''[Einstellungen]'''. Benutzt die folgende Tabelle für die Beschreibungen und korrigiert sie wenn nötig. Die Netzwerkeinstellungen werden im Normalfall von der Dreambox übernommen und müssen '''nur''' in seltenen Fällen angepasst werden.
+
Open the '''OpenVPN Server''' Plugin in the BluePanel under the daemons. Now we check first the settings, before starting the OpenVPN Server. Push the '''[blue]''' button and choose the point '''[Settings]'''. Use the following list for the descriptions and modify if requires. The network settings should be taken from the Dreambox and should '''only''' be changed in rare occasions.
  
 
{| border=1 style="text-align:center; margin:1em 1em 1em 0; background:#D0D0D0; border:1px #000000 solid; border-collapse:collapse; empty-cells:show;" CELLPADDING=2 CELLSPACING=0"
 
{| border=1 style="text-align:center; margin:1em 1em 1em 0; background:#D0D0D0; border:1px #000000 solid; border-collapse:collapse; empty-cells:show;" CELLPADDING=2 CELLSPACING=0"
| width="160px" | '''Einstellung'''
+
| width="160px" | '''Settings'''
| width="700px" | '''Beschreibung'''
+
| width="700px" | '''Description'''
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#FFFFFF"
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#FFFFFF"
| width="70px" | '''Anzahl Klients'''
+
| width="70px" | '''Number of clients'''
| width="600px" | Definiert die Anzahl der Klients, die auf den OpenVPN Server zugreifen dürfen.
+
| width="600px" | Amount of clients, which can connect with the OpenVPN Server.
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#FFFFFF"
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#FFFFFF"
| width="70px" | '''erste Klient IP'''
+
| width="70px" | '''first client IP'''
| width="600px" | Ab dieser Ip- Adresse werden die Adressen für die verschiedenen Klients zugewiesen. '''Achtung''' stellt sich, dass sich dieser Bereich nicht mit dem von eurem dhcp Server überschneidet!
+
| width="600px" | From this IP adress on the IP's are assigned to the clients. '''Attention''' make sure this range is not overlapping with the dhcp server of the network!
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
 
| width="70px" | '''IP eth0'''
 
| width="70px" | '''IP eth0'''
| width="600px" | Eingabe der IP Adresse eurer Dreambox für die Lan Schnittstelle (eth0). Diese Adresse wird schlussendlich für die Netzwerkbrücke verwendet (br0).  
+
| width="600px" | The IP Adress of the Dreambox for the lan interface (eth0). This adress is only used for the network bridge (br0).  
  
Beachtet, dass die lokale Netzwerkkarte in diesem Modus keine IP-Adresse mehr hat, also nicht erschrecken, wenn ihr einmal mit '''ifconfig''' die vorhandenen Netzwerkadapter kontrolliert.
+
Keep in mind the local network card has no IP adress in this mode, don't panic when checking the network adapter with '''ifconfig'''.
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
 
| width="70px" | '''Netzmaske eth0'''
 
| width="70px" | '''Netzmaske eth0'''
| width="600px" | Eingabe der Subnetmaske vom lokalen Netzwerk.
+
| width="600px" | Enter the subnetmask of the local network.
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
 
| width="70px" | '''Broadcast eth0'''
 
| width="70px" | '''Broadcast eth0'''
| width="600px" | Eingabe der Broadcast Adresse vom lokalen Netzwerk.
+
| width="600px" | Enter the broadcast adress of the local network.
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#F0F0F0"
| width="70px" | '''IP-Router Gateway'''
+
| width="70px" | '''IP Router Gateway'''
| width="600px" | Eingabe der IP Adresse eures Routers.
+
| width="600px" | Enter the IP adress of the routers.
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#FFFFFF"
 
|- style="text-align:center; margin:1em 1em 1em 0; background:#FFFFFF"
| width="70px" | '''Log-Datei'''
+
| width="70px" | '''Log File'''
| width="600px" | Ein- ausschalten der Logdatei. Wenn aktiviert, befindet sich die Logdatei unter /var/log/openvpn.log
+
| width="600px" | Enable/disable the log file. When activated the log is in /var/log/openvpn.log
 
|}
 
|}
  
Speichert die Eingaben anschliessend mit der '''[grünen]''' Taste. Nach dem Speichern wir automatisch der OpenVPN Server gestartet. Der OpenVPN Server wird auch nach einem Neustart der Dreambox automatisch gestartet, wenn eine Konfigurationsdatei und gültige Zertifikate vorhanden sind.
+
Save the settings with the '''[green]''' button. After saving the settings the OpenVPN Server is started automatically. The OpenVPN Server will also be started automatically after restarting the Dreambox, when a config file and certificates are available.
  
{{Hinweis|'''Neustart der Dreambox'''<br/>Der OpenVPN Server wird nach einem Neustart der Dreambox '''automatisch''' gestartet, wenn die Konfigurationsdatei (server.conf) und gültige Zertifikate vorhanden sind.}}
+
{{Hinweis|'''Restart the Dreambox'''<br/>The OpenVPN Server will also be started '''automatically''' after restarting the Dreambox, when a config file and certificates are available.}}
  
  
 
Back to [[#top | table of contents]]
 
Back to [[#top | table of contents]]
 
  
 
== OpenVPN Logdatei ==
 
== OpenVPN Logdatei ==

Version vom 16. September 2012, 20:11 Uhr

Deutsch.png - in Deutsch English.png - in English
The Gemini Project

UNDER CONSTRUCTION -Configure OpenVPN Server and client

After installing the geminiopenvpn Plugin you have an OpenVPN Server or Client which is easy to configure. The plugin uses certificates (Server-Multi-Client). The connection on the OpenVPN Server is made over an encrypted TLS connection.

For connections the OpenVPN Server Plugin creates a virtual network interface (tap0), which is connected over a network bridge (br0) with the internal network adapter (eth0) of the Dreambox. One or more OpenVPN clients get an IP adress of the internal network and can access all availiable services without additional routing.

The mode used by OpenVPN is Bridging. With this mode the Broadcasts are forwarded without any problem. Same for network protocols like IPv4, IPv6, Netalk, IPX, ...


Requirements for using OpenVPN

  • OE2.0 image with GP3.2 Plugin.
  • OpenVPN Plugin must be installed, configured and started.
  • The OpenVPN Server supports only a cabled network (no Wlan).
  • Portforwarding on the router to the Dreambox (Port 1194/UDP).
  • For reaching the Server you need to know your WAN IP, or use a DDNS Service (e.g. No-IP).
  • For access you need to create certificates for each client.
  • OpenVPN needs to be installed on clients. Protocols like IPSec, IKE, PPTP, or L2TP are not supported.
  • Server Lan and Client Lan must be different.


Back to table of contents

OpenVPN Server

Install the OpenVPN Plugin via BluePanel and configure the Server as described. After rebooting you find the OpenVPN Server (and client) in the BluePanel. It's also possible to install the plguin over the console with the following command:

opkg update && opkg install geminiopenvpn


Back to table of contents


Create Root Certificate

root Zertifikat - Skin Beispiel: gp-skin-dmconcinnity-mod

Now we create the keys and certificates for the Certificate Authority (CA). Open the OpenVPN Server Plugin and push the [green] button for certificates.

Choose root-certificate and change the settings as described in the list. For all parameters only letters and numbers can be used.

Parameter Description
Password Enter a Password. Memorize the password, you will need the password for creating Server and Client certificates or for blocking a certifikate.
valid for x years Enter the validity period for the certificate in years.
Project Enter a Project name for the certificate creation.
Country Enter the country.
City Enter the city.
State Enter the state.

Save the settings with the [green] button. The corresponding files will be created and saved in the directory /etc/ssl/openvpn.

Back to table of contents


Create Server Certificate

Server Zertifikat

Open the OpenVPN Server Plugin and push the [green] button for certificates. Push again the [green] button and choose as type the setting Server and change the settings as described in the list.

Parameter Description
valid for x years Enter the validity period for the certificate in years.

Save the settings with the [green] button to create the certificates. You will be prompted to enter the password (which was entered while creating the root certificate). When a wrong password is entered the following error message is displayed: can't generate certificate.

When the correct password is entered the certificates, keys and the Diffie-Hellman parameters are created. This can take some minutes (up to 30 min), the status is displayed in the plugin. The plugin can be closed while the creation is in progress, the process continues in background.


Back to table of contents


Create Client Certificate(s)

Klient Zertifikat

Open the OpenVPN Server Plugin and push the [green] button for certificates. Push again the [green] button and choose as type the setting Client and change the settings as described in the list.

Parameters Description
valid for x years Enter the validity period for the certificate in years.
Name: Desired name for the client.

If more client certificates are used, each must have a different name.

Save the settings with the [green] button to create the certificates. You will be prompted to enter the password (which was entered while creating the root certificate). When a wrong password is entered the following error message is displayed: can't generate certificate.

When the correct password is entered the cleint certificate, key and config file can be found in the following directory:

/etc/ssl/openvpn

These files (three files for each client) will be used later on the OpenVPN clients to set up a connection with the server. The needed files look like follows, e.g. if the entered name was 7020hd. In addition to the three files every client needs the Root Certificate (vpn-ca.pem).

File name Description
7020hd-cert.pem Client Certificate.
7020hd-key.pem Key File.
7020hd.ovpn Config file for the client.

If multiple certificates for multiple clients are created, every name needs to be different.

vpn-ca.pem The Root Certificate.

Overview of the configuration

The created configurations can be displayed with the [green] button (certificates) in the OpenVPN Server Plugin. The example shows the configuration for a root certificate, Server settings and the configuration of two clients, with the names htc and 7020hd.


Back to table of contents

Settings

OpenVPN Einstellungen

Open the OpenVPN Server Plugin in the BluePanel under the daemons. Now we check first the settings, before starting the OpenVPN Server. Push the [blue] button and choose the point [Settings]. Use the following list for the descriptions and modify if requires. The network settings should be taken from the Dreambox and should only be changed in rare occasions.

Settings Description
Number of clients Amount of clients, which can connect with the OpenVPN Server.
first client IP From this IP adress on the IP's are assigned to the clients. Attention make sure this range is not overlapping with the dhcp server of the network!
IP eth0 The IP Adress of the Dreambox for the lan interface (eth0). This adress is only used for the network bridge (br0).

Keep in mind the local network card has no IP adress in this mode, don't panic when checking the network adapter with ifconfig.

Netzmaske eth0 Enter the subnetmask of the local network.
Broadcast eth0 Enter the broadcast adress of the local network.
IP Router Gateway Enter the IP adress of the routers.
Log File Enable/disable the log file. When activated the log is in /var/log/openvpn.log

Save the settings with the [green] button. After saving the settings the OpenVPN Server is started automatically. The OpenVPN Server will also be started automatically after restarting the Dreambox, when a config file and certificates are available.

Ambox notice.png Restart the Dreambox
The OpenVPN Server will also be started automatically after restarting the Dreambox, when a config file and certificates are available.


Back to table of contents

OpenVPN Logdatei

OpenVPN Server starten

Informationen über den Status des OpenVPN Servers, können mit der [roten] Taste (Logdatei) aufgerufen werden. Das Beispiel zeigt den erfolgreichen Start des OpenVPN Servers mit zwei verbunden Klients.

Die Log Datei kann alternativ auch via Konsole angezeigt werden, mit folgendem Befehl:

cat /var/log/openvpn.log


Back to table of contents


Verbindungsübersicht

Das OpenVPN Server Plugin kontrolliert zyklisch, ob Klient(s) verbunden sind und zeigt diese wie im Bild Aktive Verbindungen an. In diesem Beispiel sind zwei Klients verbunden, mit dem Namen htc und 7020hd.


Back to table of contents


Zertifikat(e) sperren

Zertifikat abgelaufen

Zertifikate könnt ihr auch sperren, wenn ihr den Zugriff von einem Klient unterbinden wollt. Das sperren erfolgt über die [rote] Taste, wenn das Menü der Zertifikate aufgerufen wird. Gesperrte Klient Zertifikate werden in der Übersicht als abgelaufen markiert. Beim Sperren müsst ihr wieder das korrekte Passwort eingeben, welches bei der root_Zertifikat Erstellungen eingegeben worden ist.


Ambox attention.png Sperren von Zertifikaten
Gesperrte Zertifikate können nicht reaktiviert werden. Sie müssen neu erstellt werden!


Back to table of contents


OpenVPN Server - Menü Taste

OpenVPN Server starten

Öffnet das OpenVPN Server Plugin und drückt die [blaue] Taste der Fernbedienung. Die Funktionen sind in der folgenden Tabelle beschrieben.

Menüpunkt Beschreibung
starten / stoppen openvpn Mit dem Eintrag, könnt ihr den OpenVPN Serven manuell stoppen, bzw. starten.
zeige 'Routes' Zeigt Routing Informationen der Netzwerkbrücke (br0).
Einstellungen Einstellungen für den OpenVPN Server.


Back to table of contents

Löschen von Zertifikaten

Zertifikate können im OpenVPN Server Plugin nicht gelöscht werden. Die Dateien müsst ihr manuell löschen im Verzeichnis:

/etc/openvpn/ssl


Back to table of contents

OpenVPN Klient

Es gibt viele, verschiedene OpenVPN Frontends, für die einzelnen Betriebssysteme, um Verbindungen auf einen OpenVPN Server zu erstellen. Die folgenden Abschnitte beschrieben die Konfigurationen des OpenVPN Klients der Dreambox (mit GP3.2 Plugin) und einem Android basierenden Smartphone.


Dreambox als Klient

Beim Einrichten des OpenVPN Klients, müssen die erstellten Klient Dateien (4 Stk.) von der Serverbox kopiert und in das folgende Verzeichnis der Klient Dreambox eingefügt werden:

/etc/openvpn

Hier nochmal eine Auflistung der vier benötigten Dateien für den OpenVPN Klient. Das xxx steht für den Namen, welcher bei der Klient Erstellungen eingegeben worden ist.

  • xxx-cert.pem
  • xxx.pem
  • xxx.ovpn
  • vpn-ca.pem


Back to table of contents


Konfigurationsdatei editieren

Bevor eine Verbindung aufgebaut werden kann, müsst ihr die Konfigurationsdatei (*.ovpn) editieren. Beim der Zeile remote muss die IP-Adresse oder Hostadresse und der korrekte Port eingetragen werden. Die Konfiguration könnte wie folgt ausschauen, wenn der Zugriff über den Hostnamen webaccess.dyndns.tv erfolgt via Port 1194.

.
.
# example 'remote foobar.org 1194'
# example 'remote 97.123.100.236 1194'
remote webaccess.dyndns.tv 1194

resolv-retry infinite
nobind
persist-key
persist-tun
.
.


Back to table of contents


Verbindung aufbauen

Dreambox Client - Skin Beispiel: gp-skin-swan-black

Öffnet das OpenVPN Client Plugin im BluePanel unter den Daemons. Im Plugin erscheint ein Eintrag (nicht verbunden), wenn die Konfigurationsdateien in das korrekte Verzeichnis kopiert worden sind (/etc/openvpn).

Startet die Verbindung auf den OpenVPN Server mit der [OK] Taste. Funktioniert alles, dann erscheint der Status verbunden im OpenVPN Client Plugin. Trennen könnt ihr die Verbindung durch erneutes drücken der [OK] Taste.

Ambox notice.png Verbindung nach Neustart
Die Verbindung wird nach bei einem Neustart der Dreambox automatisch hergestellt, wenn eine Konfigurationsdatei (*.ovpn) im Verzeichnis /etc/openvpn gefunden wird.


Back to table of contents

Android Smartphone als Klient

Beispiel - OpenVPN settings Android

Das Bild zeigt ein Beispiel von einem Android basierenden Smartphone, welches mit der Dreambox verbunden ist. Als App wird OpenVPN settings eingesetzt, um die Verbindung zum Server zu starten. Beachtet, dass das Gerät gerootet sein muss, um OpenVPN zu nutzen. Weiters wird der tun/tap Treiber, die Busybox und OpenVPN benötigt. Bei vielen Custom-Roms sind diese Abhängigkeiten schon in der Firmware integriert.

Die Konfigurationsdatei (*.opvn) muss korrekt angepasst werden mit dem Remoteserver und dem entsprechenden Port ergänzt werden. Kopiert anschliessend die Klient Dateien auf die SD-Karte, z.B. in einen erstellten Ordner openvpn. Jetzt müsst ihr nur noch die OpenVPN settings App anpassen (z.B. Pfad zu Konfiguration, Zertifikaten) und der Tunnel auf den OpenVPN Server kann gestartet werden.


Zurück zum Inhaltsverzeichnis


Support thread

If you need help with OpenVPN, follow the link ;)

geminiopenvpn


Back to overview: Gemini-Wiki:English Portal or Mainpage