luciver1981
Goto Top

Openvpn Zertifikat und Passwort

Hallo Mitglieder

Ist es möglich Openvpn so zu konfigurieren das ich eine Schlüsseldatei und ein Passwort angeben muss?

Content-Key: 193449

Url: https://administrator.de/contentid/193449

Printed on: April 23, 2024 at 16:04 o'clock

Member: Epixc0re
Epixc0re Oct 29, 2012 at 08:51:39 (UTC)
Goto Top
Hallo,

ja das ist Möglich.
Member: Luciver1981
Luciver1981 Oct 29, 2012 at 08:59:16 (UTC)
Goto Top
Hallo Epixc0re, wie das? Hab es versucht bei der Zertifikatserstellung ein Passwort mitzugeben aber das wird beim verbinden nicht abgefragt.
Member: Epixc0re
Epixc0re Oct 29, 2012 updated at 09:20:38 (UTC)
Goto Top
#verb 7
log /tmp/vpn.log
persist-key
persist-tun
float
client-to-client
management 0.0.0.0 5094 /etc/openvpn/.manage_passwd
status /var/log/openvpn.log
script-security 2
keepalive 10 120
duplicate-cn
mode server
tls-server
dev tap
port 1196
plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so login
ca ma_keys/ca.crt
cert ma_keys/server.crt
key ma_keys/server.key
dh ma_keys/dh1024.pem
proto tcp-server
ifconfig 10.100.40.1 255.255.255.0
ifconfig-pool 10.100.40.2 10.100.40.254 255.255.255.0
push "route-gateway 10.100.40.1"
Member: Luciver1981
Luciver1981 Oct 29, 2012 at 10:59:24 (UTC)
Goto Top
Welche Zeile der config soll die Passwortfunktion einschalten?
Member: Epixc0re
Epixc0re Oct 29, 2012 updated at 11:13:43 (UTC)
Goto Top
plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so login

Dokumentation ist offenbar nicht so Dein Freund, oder?

http://openvpn.net/index.php/open-source/documentation/howto.html#examp ...
Member: kingkong
kingkong Oct 29, 2012 at 12:12:05 (UTC)
Goto Top
Wie hast Du das Zertifikat denn erstellt? Denn eigentlich sollte genau das möglich sein - bei mir funktioniert das zumindest genau so...
Member: Luciver1981
Luciver1981 Oct 29, 2012 at 14:53:23 (UTC)
Goto Top
Na hab es ganz normal über vars, clean-all, build-serverkey xxxxx mit Passwort und dann build-key xxxxx mit Passwort. Aber Epixc0re hat natürlich recht das es bei Linuxsystemen über dieses Plugin lösen kann bin grad am suchen für ein Windows equivalent.
Member: Epixc0re
Epixc0re Oct 29, 2012 updated at 14:59:34 (UTC)
Goto Top
Zitat von @Luciver1981:
Na hab es ganz normal über vars, clean-all, build-serverkey xxxxx mit Passwort und dann build-key xxxxx mit Passwort. Aber
Epixc0re hat natürlich recht das es bei Linuxsystemen über dieses Plugin lösen kann bin grad am suchen für ein
Windows equivalent.

http://wiki.openvpn.eu/index.php/Authentifizierung_am_Server

damit wird's wohl gehen ...
Member: Luciver1981
Luciver1981 Oct 29, 2012 at 15:14:30 (UTC)
Goto Top
Ok danke dir. Werd es mal mit dem VB-Script ausprobieren.
Member: Epixc0re
Epixc0re Oct 29, 2012 at 15:19:17 (UTC)
Goto Top
Wenns das war, dann bitte How can I mark a post as solved? nicht vergessen!
Member: Luciver1981
Luciver1981 Nov 01, 2012 at 12:33:26 (UTC)
Goto Top
Hallo kann es leider nicht als gelöst setzen da es nicht funktioniert hab es erstmal testweise mit der Variante

auth-user-pass-verify c:\\programme\\openvpn\\auth-script.bat via-file

aber die Batchdatei wird nicht aufgerufen. Habs getestet indem ich ein batch gemacht hab wo direkt der exit 0 ist.
Member: Epixc0re
Epixc0re Nov 01, 2012 at 12:42:39 (UTC)
Goto Top
Hallo,

dann wirst du möglicherweise Script Security auf 2 stellen müssen.
Member: Luciver1981
Luciver1981 Nov 01, 2012 updated at 13:33:56 (UTC)
Goto Top
Danke für die Geduld aber es funktioniert trotzdem nicht, hier mal die Server- und Clientkonfig. von meinen Testserver.

Server:

local 10.20.0.1
port 1194
proto udp
dev tun
  1. ----------------------------------------------
  2. Zertifikate
  3. ----------------------------------------------
dh C:\\Programme\\OpenVPN\\server-keys\\dh1024.pem
ca C:\\Programme\\OpenVPN\\server-keys\\ca.crt
cert C:\\Programme\\OpenVPN\\server-keys\\vpn-testserver.crt
key C:\\Programme\\OpenVPN\\server-keys\\vpn-testserver.key
  1. ----------------------------------------------
  2. Server-Setup
  3. ----------------------------------------------
script-security 2
auth-user-pass-verify C:\\Programme\\OpenVPN\\config\\auth.bat via-file
server 10.18.14.0 255.255.255.0
ifconfig-pool-persist C:\\Programme\\OpenVPN\\ipp.txt
client-to-client

  1. ----------------------------------------------
  2. Client-Settings (inkl Special Dir)
  3. ----------------------------------------------
  4. (if needed) client-config-dir ccd
#push "route 192.168.1.0 255.255.255.0"
#push "redirect-gateway"
#push "dhcp-option DNS 192.168.1.10"
#push "dhcp-option WINS 172.20.0.100"

  1. ----------------------------------------------
  2. Defaults
  3. ----------------------------------------------

keepalive 10 120
comp-lzo
persist-key
persist-tun
  1. ----------------------------------------------
  2. Logging
  3. ----------------------------------------------

status C:\\Programme\\OpenVPN\\log\\openvpn-status.log
log C:\\Programme\\OpenVPN\\log\\openvpn.log
log-append C:\\Programme\\OpenVPN\\log\\openvpn.log
verb 3


Client:

client
dev tun
proto udp
remote 10.20.0.1 1194
resolv-retry infinite
nobind
persist-key
persist-tun
script-security 2
ca "ca.crt"
cert "testclient01.crt"
key "testclient01.key"

comp-lzo
verb 3
Member: Luciver1981
Luciver1981 Nov 01, 2012 at 15:13:39 (UTC)
Goto Top
Es funktioniert in der Cleint.conf fehlte die zeile:
auth-user-pass
Ok danke für die gedult ist gelöst.
Member: Epixc0re
Epixc0re Nov 01, 2012 at 15:21:03 (UTC)
Goto Top
Fein, wenn Du jetzt noch, deine laufende Konfiguration Postest - dann sind wir alle hier zufrieden ;)
Member: Luciver1981
Luciver1981 Nov 02, 2012 at 13:45:57 (UTC)
Goto Top
Also die Konfiguration funtkioniert:

Server.conf


local 10.20.0.1
port 1194
proto udp
dev tun
  1. ----------------------------------------------
  2. Zertifikate
  3. ----------------------------------------------
dh C:\\Programme\\OpenVPN\\server-keys\\dh1024.pem
ca C:\\Programme\\OpenVPN\\server-keys\\ca.crt
cert C:\\Programme\\OpenVPN\\server-keys\\vpn-testserver.crt
key C:\\Programme\\OpenVPN\\server-keys\\vpn-testserver.key
  1. ----------------------------------------------
  2. Server-Setup
  3. ----------------------------------------------
server 10.18.14.0 255.255.255.0
ifconfig-pool-persist C:\\Programme\\OpenVPN\\ipp.txt
client-to-client
script-security 2
auth-nocache 1
auth-user-pass-verify C:\\Programme\\OpenVPN\\auth2.bat via-env

  1. ----------------------------------------------
  2. Client-Settings (inkl Special Dir)
  3. ----------------------------------------------
  4. (if needed) client-config-dir ccd
#push "route 192.168.1.0 255.255.255.0"
#push "redirect-gateway"
#push "dhcp-option DNS 192.168.1.10"
#push "dhcp-option WINS 172.20.0.100"

  1. ----------------------------------------------
  2. Defaults
  3. ----------------------------------------------

keepalive 10 120
comp-lzo
persist-key
persist-tun
  1. ----------------------------------------------
  2. Logging
  3. ----------------------------------------------

status C:\\Programme\\OpenVPN\\log\\openvpn-status.log
log C:\\Programme\\OpenVPN\\log\\openvpn.log
log-append C:\\Programme\\OpenVPN\\log\\openvpn.log
verb 3

client.conf

client
dev tun
script-security 2
proto udp
remote 10.20.0.1 1194
resolv-retry infinite
nobind
persist-key
persist-tun

ca "ca.crt"
cert "testclient01.crt"
key "testclient01.key"
auth-nocache
auth-user-pass
comp-lzo
verb 3
Member: Luciver1981
Luciver1981 Nov 02, 2012 updated at 14:21:14 (UTC)
Goto Top
Aber folgendes skript gibt immer exit 0 also egal was in der list.txt steht es ist alles richtig.

@echo off
set n_user=%username% %password%;
find /n "%n_user%" X:\Programme\OpenVPN\list.txt >result.txt
for /f "skip=1" %%a in (result.txt) do set n=%%a
if "%n%"=="----------" exit 1
exit 0

kann da noch jemand helfen?