Koozali.org: home of the SME Server

Openvpn-bridge

Offline didwedo

  • *
  • 23
  • +0/-0
Openvpn-bridge
« on: March 23, 2020, 11:31:21 AM »
bonjour à tous,
par les temps qui courent j'ai un souci VPN que peut-être d'autres ont...

en son temps j'avais installé tout ça avec tunnelblick sur mac, créé la version serveur, un client...
tout fonctionnait bien.

puis récemment avec les événements du corona, j'ai installé ce user unique sur tous les postes de travail et chacun est reparti à la maison avec son ordi.

évidemment, une fois tous connectés, chacun piquait l'IP de l'ancien connecté.

j'ai donc créé d'autres utilisateurs, avec les mêmes paramètres que le premier que je me garde.
et bien le premier se connecte sans souci, les autres, qui ont seulement le fichier pk12 de différent me font des erreurs certificat.

à n'y rien comprendre.
une idée? voir les lois ci-dessous...

avez-vous pu insérer de multiple utilisateurs?

je précise que je suis en TAP car TUN est déprécié des macs récents comme indiqué sur le site d'Openvnp.

merci à tous pour votre aide.
salutations Chris


2020-03-23 11:36:36.204618 VERIFY ERROR: depth=1, error=self signed certificate in certificate chain: C=CH, ST=VD, L=Lausanne, O=DOMAIN, OU=Certificate Authority, CN=DOMAIN PHPki Certificate Authority, emailAddress=webmaster@DOMAIN.ch
2020-03-23 11:36:36.204718 OpenSSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
2020-03-23 11:36:36.204759 TLS_ERROR: BIO read tls_read_plaintext error
2020-03-23 11:36:36.204788 TLS Error: TLS object -> incoming plaintext read error
2020-03-23 11:36:36.204814 TLS Error: TLS handshake failed
« Last Edit: March 23, 2020, 11:38:05 AM by didwedo »

Offline gieres

  • *
  • 213
  • +0/-0
Re: Openvpn-bridge
« Reply #1 on: March 23, 2020, 02:39:32 PM »
Bonjour,
Je ne suis pas capable d'interpréter le fichier journal mais il faut créer dans PHPKi un certificat par utilisateur. Donc ça ne m'étonne pas que seul le premier VPN connecté fonctionne.
On a un serveur avec plusieurs utilisateurs en télétravail et plusieurs certificats différents : le couple user.pem et user-key.pem. Seuls le certificat d'autorité et le takey.pem sont communs.
Tout fonctionne bien.
Je suis preneur de la procédure (avec les captures d'écrans) s'il s'agit d'un Mac pour compléter le wiki : https://wiki.contribs.org/OpenVPN_Bridge/fr
Et de toute remarque de ce qui ne serait pas clair sur le wiki, comme le fait qu'il faut un certificat par utilisateur.
Bon travail.

Offline didwedo

  • *
  • 23
  • +0/-0
Re: Openvpn-bridge
« Reply #2 on: March 23, 2020, 02:46:11 PM »
Bonjour,
Je ne suis pas capable d'interpréter le fichier journal mais il faut créer dans PHPKi un certificat par utilisateur. Donc ça ne m'étonne pas que seul le premier VPN connecté fonctionne.
On a un serveur avec plusieurs utilisateurs en télétravail et plusieurs certificats différents : le couple user.pem et user-key.pem. Seuls le certificat d'autorité et le takey.pem sont communs.
Tout fonctionne bien.
Je suis preneur de la procédure (avec les captures d'écrans) s'il s'agit d'un Mac pour compléter le wiki : https://wiki.contribs.org/OpenVPN_Bridge/fr
Et de toute remarque de ce qui ne serait pas clair sur le wiki, comme le fait qu'il faut un certificat par utilisateur.
Bon travail.

c'est pourtant bel et bien le cas, j'ai créé un nouvel utilisateur avec ses propres PEM comme vous le dites...
dans le fichier de config dupliqué j'ai changé le pk12, mais rien à faire, même passé en Ca, user.pem et user-key.pem rien ni fait...

j'ai suivi toute la procédure.
ce qui m'a alerté est le fait que TAP serait valable our une seule connection, TUN serait multiple, possible?

merci bcp pour votre aide, chris

Offline gieres

  • *
  • 213
  • +0/-0
Re: Openvpn-bridge
« Reply #3 on: March 23, 2020, 03:37:28 PM »
Je n'enregistre pas le PKCS #12 mais chacun des 3 certificats et la première fois, j'ai trouvé cela bien complexe car à l'enregistrement, ils s’appellent tous .pem sauf la clé privée. Le seul moyen de ne pas se mélanger les pinceaux est de les renommer à chaque téléchargement et de bien s'organiser (pas de téléphone qui sonne !). Un moyen de les distinguer est leur taille. Dans le wiki, j'ai précisé :
Une nouvelle page s'ouvre avec, à gauche une liste déroulante des différents fichiers du certificat :

    PKCS12 Bundle ;
    PEM certificate qui correspond au certificat en lui-même (environ 1,9 kio en 2048 bits) ;
    PEM key qui est la clé privé du certificat (environ 1,7 kio en 2048 bits) ;
    PEM Bundle
    PEM Bundle w/Root qui est le certificat racine ou CA (environ 5,4 kio en 2048 bits).

Attention, quand vous allez demander le téléchargement des fichiers 2, 3 et 5, les fichiers 2 et 5 vont être téléchargés sous le même nom avec l'extension .pem. Renommer rapidement le n°2 en *-cert.pem et le n°5 en *-CA.pem pour éviter toute confusion.


Est-ce que ce ne serait pas là qu'il y aurait un mélange dans la config du serveur ?


Offline didwedo

  • *
  • 23
  • +0/-0
Re: Openvpn-bridge
« Reply #4 on: March 23, 2020, 04:02:03 PM »
Je n'enregistre pas le PKCS #12 mais chacun des 3 certificats et la première fois, j'ai trouvé cela bien complexe car à l'enregistrement, ils s’appellent tous .pem sauf la clé privée. Le seul moyen de ne pas se mélanger les pinceaux est de les renommer à chaque téléchargement et de bien s'organiser (pas de téléphone qui sonne !). Un moyen de les distinguer est leur taille. Dans le wiki, j'ai précisé :
Une nouvelle page s'ouvre avec, à gauche une liste déroulante des différents fichiers du certificat :

    PKCS12 Bundle ;
    PEM certificate qui correspond au certificat en lui-même (environ 1,9 kio en 2048 bits) ;
    PEM key qui est la clé privé du certificat (environ 1,7 kio en 2048 bits) ;
    PEM Bundle
    PEM Bundle w/Root qui est le certificat racine ou CA (environ 5,4 kio en 2048 bits).

Attention, quand vous allez demander le téléchargement des fichiers 2, 3 et 5, les fichiers 2 et 5 vont être téléchargés sous le même nom avec l'extension .pem. Renommer rapidement le n°2 en *-cert.pem et le n°5 en *-CA.pem pour éviter toute confusion.


Est-ce que ce ne serait pas là qu'il y aurait un mélange dans la config du serveur ?

alors j'ai bien vu passer ce post, j'ai testé, aucun changement...
je pense que le pk12 fait bien son effet et est plus simple à gérer, mais j'ai testé hier et aucun changement.

je vais redémarrer open vp-bridge car je n'y ai plus accès avec mon premier compte :-/

encore merci de prendre le temps pour nous.

PS : concernant le mélange j'y ai aussi pensé mais après vérification il n'en est rien.
je serais même prêt à une discussion skype ou téléphone.

Offline didwedo

  • *
  • 23
  • +0/-0
Re: Openvpn-bridge
« Reply #5 on: March 23, 2020, 04:07:30 PM »
Je n'enregistre pas le PKCS #12 mais chacun des 3 certificats et la première fois, j'ai trouvé cela bien complexe car à l'enregistrement, ils s’appellent tous .pem sauf la clé privée. Le seul moyen de ne pas se mélanger les pinceaux est de les renommer à chaque téléchargement et de bien s'organiser (pas de téléphone qui sonne !). Un moyen de les distinguer est leur taille. Dans le wiki, j'ai précisé :
Une nouvelle page s'ouvre avec, à gauche une liste déroulante des différents fichiers du certificat :

    PKCS12 Bundle ;
    PEM certificate qui correspond au certificat en lui-même (environ 1,9 kio en 2048 bits) ;
    PEM key qui est la clé privé du certificat (environ 1,7 kio en 2048 bits) ;
    PEM Bundle
    PEM Bundle w/Root qui est le certificat racine ou CA (environ 5,4 kio en 2048 bits).

Attention, quand vous allez demander le téléchargement des fichiers 2, 3 et 5, les fichiers 2 et 5 vont être téléchargés sous le même nom avec l'extension .pem. Renommer rapidement le n°2 en *-cert.pem et le n°5 en *-CA.pem pour éviter toute confusion.


Est-ce que ce ne serait pas là qu'il y aurait un mélange dans la config du serveur ?

@400000005e78d07a0edb5a34 Authenticate/Decrypt packet error: packet HMAC authentication failed
@400000005e78d07a0edb8914 TLS Error: incoming packet authentication failed from [AF_INET]213.55.220.240:41079

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Openvpn-bridge
« Reply #6 on: March 23, 2020, 06:16:40 PM »
PKCS12 - because it is easy.

I have made some updates to PHPKi which will be out soon.

Once change was to modify the certificate names so you get name-cert.pem name-key.pem etc so it is less confusing

0.82.20 is in smetest

It also has some other small fixes but needs testing.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Openvpn-bridge
« Reply #7 on: March 23, 2020, 06:26:09 PM »
@400000005e78d07a0edb5a34 Authenticate/Decrypt packet error: packet HMAC authentication failed
@400000005e78d07a0edb8914 TLS Error: incoming packet authentication failed from [AF_INET]213.55.220.240:41079

Probably something wrong with your TA key setup.

https://community.openvpn.net/openvpn/ticket/1199
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline didwedo

  • *
  • 23
  • +0/-0
Re: Openvpn-bridge
« Reply #8 on: March 25, 2020, 10:03:30 AM »
Probably something wrong with your TA key setup.

https://community.openvpn.net/openvpn/ticket/1199

I haven't changed takey, why would it work with one user and not the other ???

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Openvpn-bridge
« Reply #9 on: March 25, 2020, 10:28:42 AM »
I haven't changed takey, why would it work with one user and not the other ???

Because logically something, somewhere, is not the same but you haven't give enough information for us to see.

So you better do a proper report and show your configs so we can have a look.

Restart openvpn.

Get the client to connect and then save the log.

Show us the server and clients configs.

I also suggest you try a general search on the interwebs for a phrase like "packet HMAC authentication failed TLS error"

eg:

https://forums.openvpn.net/viewtopic.php?t=26176

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline didwedo

  • *
  • 23
  • +0/-0
Re: Openvpn-bridge
« Reply #10 on: March 26, 2020, 02:26:31 PM »
hello,

i don't know where is located the server configuration.

here is the first client, it work...

proto udp
dev tap
nobind
remote 62.220.130.113 1194
tls-client
tls-auth takey.pem 1
remote-cert-tls server
resolv-retry infinite
persist-key
auth-user-pass
pkcs12 team.p12
cipher AES-256-CBC
compress lzo
pull


here is the second client, it fail...
(that's my account)

proto udp
dev tap
nobind
remote 62.220.130.113 1194
tls-client
tls-auth takey.pem 1
remote-cert-tls server
resolv-retry infinite
persist-key
auth-user-pass
pkcs12 chris.p12
cipher AES-256-CBC
compress lzo
pull


here is the log...

2020-03-26 14:23:15.604830 *Tunnelblick: macOS 10.13.6 (17G65); Tunnelblick 3.8.2 (build 5480); prior version 3.8.1 (build 5400)
2020-03-26 14:23:15.906447 *Tunnelblick: Attempting connection with chris using shadow copy; Set nameserver = 769; monitoring connection
2020-03-26 14:23:15.907301 *Tunnelblick: openvpnstart start chris.tblk 56329 769 0 1 0 1098098 -ptADGNWradsgnw 2.4.8-openssl-1.1.1e
2020-03-26 14:23:15.932953 *Tunnelblick: openvpnstart starting OpenVPN
2020-03-26 14:23:16.749524 OpenVPN 2.4.8 x86_64-apple-darwin [SSL (OpenSSL)] [LZO] [LZ4] [MH/RECVDA] [AEAD] built on Mar 22 2020
2020-03-26 14:23:16.749637 library versions: OpenSSL 1.1.1e  17 Mar 2020, LZO 2.10
2020-03-26 14:23:16.751661 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:56329
2020-03-26 14:23:16.751700 Need hold release from management interface, waiting...
2020-03-26 14:23:17.172016 *Tunnelblick: openvpnstart log:
     Loading tap-notarized.kext
     OpenVPN started successfully.
     Command used to start OpenVPN (one argument per displayed line):
          /Applications/Tunnelblick.app/Contents/Resources/openvpn/openvpn-2.4.8-openssl-1.1.1e/openvpn
          --daemon
          --log /Library/Application Support/Tunnelblick/Logs/-SUsers-Skirrs-SLibrary-SApplication Support-STunnelblick-SConfigurations-Schris.tblk-SContents-SResources-Sconfig.ovpn.769_0_1_0_1098098.56329.openvpn.log
          --cd /Library/Application Support/Tunnelblick/Users/kirrs/chris.tblk/Contents/Resources
          --machine-readable-output
          --setenv IV_GUI_VER "net.tunnelblick.tunnelblick 5480 3.8.2 (build 5480)"
          --verb 3
          --config /Library/Application Support/Tunnelblick/Users/kirrs/chris.tblk/Contents/Resources/config.ovpn
          --setenv TUNNELBLICK_CONFIG_FOLDER /Library/Application Support/Tunnelblick/Users/kirrs/chris.tblk/Contents/Resources
          --verb 3
          --cd /Library/Application Support/Tunnelblick/Users/kirrs/chris.tblk/Contents/Resources
          --management 127.0.0.1 56329 /Library/Application Support/Tunnelblick/pddnllmdjiempkdmafcabdffgefibeaoplbkagll.mip
          --management-query-passwords
          --management-hold
          --script-security 2
          --route-up /Applications/Tunnelblick.app/Contents/Resources/client.up.tunnelblick.sh -9 -a -d -f -m -w -ptADGNWradsgnw
          --down /Applications/Tunnelblick.app/Contents/Resources/client.down.tunnelblick.sh -9 -a -d -f -m -w -ptADGNWradsgnw
          --route-pre-down /Applications/Tunnelblick.app/Contents/Resources/client.route-pre-down.tunnelblick.sh -9 -a -d -f -m -w -ptADGNWradsgnw
2020-03-26 14:23:17.184626 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:56329
2020-03-26 14:23:17.230369 MANAGEMENT: CMD 'pid'
2020-03-26 14:23:17.230456 MANAGEMENT: CMD 'auth-retry interact'
2020-03-26 14:23:17.230516 MANAGEMENT: CMD 'state on'
2020-03-26 14:23:17.230586 MANAGEMENT: CMD 'state'
2020-03-26 14:23:17.230685 MANAGEMENT: CMD 'bytecount 1'
2020-03-26 14:23:17.231990 *Tunnelblick: Established communication with OpenVPN
2020-03-26 14:23:17.233246 *Tunnelblick: >INFO:OpenVPN Management Interface Version 1 -- type 'help' for more info
2020-03-26 14:23:17.235873 MANAGEMENT: CMD 'hold release'
2020-03-26 14:23:17.283133 *Tunnelblick: Obtained VPN username and password from the Keychain
2020-03-26 14:23:17.283983 MANAGEMENT: CMD 'username "Auth" "chris"'
2020-03-26 14:23:17.284061 MANAGEMENT: CMD 'password [...]'
2020-03-26 14:23:17.284214 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2020-03-26 14:23:17.310465 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2020-03-26 14:23:17.310499 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2020-03-26 14:23:17.310987 TCP/UDP: Preserving recently used remote address: [AF_INET]62.220.130.113:1194
2020-03-26 14:23:17.311041 Socket Buffers: R=[196724->196724] S=[9216->9216]
2020-03-26 14:23:17.311055 UDP link local: (not bound)
2020-03-26 14:23:17.311067 UDP link remote: [AF_INET]62.220.130.113:1194
2020-03-26 14:23:17.311141 MANAGEMENT: >STATE:1585228997,WAIT,,,,,,
2020-03-26 14:23:17.345902 MANAGEMENT: >STATE:1585228997,AUTH,,,,,,
2020-03-26 14:23:17.345963 TLS: Initial packet from [AF_INET]62.220.130.113:1194, sid=770f7df7 9dd292a5
2020-03-26 14:23:17.349798 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
2020-03-26 14:23:17.381303 VERIFY ERROR: depth=1, error=self signed certificate in certificate chain: C=CH, ST=VD, L=Lausanne, O=Didwedo, OU=Certificate Authority, CN=Didwedo PHPki Certificate Authority, emailAddress=webmaster@didwedo.ch
2020-03-26 14:23:17.381447 OpenSSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
2020-03-26 14:23:17.381476 TLS_ERROR: BIO read tls_read_plaintext error
2020-03-26 14:23:17.381508 TLS Error: TLS object -> incoming plaintext read error
2020-03-26 14:23:17.381526 TLS Error: TLS handshake failed
2020-03-26 14:23:17.384066 SIGUSR1[soft,tls-error] received, process restarting
2020-03-26 14:23:17.384108 MANAGEMENT: >STATE:1585228997,RECONNECTING,tls-error,,,,,
2020-03-26 14:23:17.387313 MANAGEMENT: CMD 'hold release'
2020-03-26 14:23:17.387379 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2020-03-26 14:23:17.387510 TCP/UDP: Preserving recently used remote address: [AF_INET]62.220.130.113:1194
2020-03-26 14:23:17.387549 Socket Buffers: R=[196724->196724] S=[9216->9216]
2020-03-26 14:23:17.387563 UDP link local: (not bound)
2020-03-26 14:23:17.387575 UDP link remote: [AF_INET]62.220.130.113:1194
2020-03-26 14:23:20.206090 TLS: Initial packet from [AF_INET]62.220.130.113:1194, sid=33a3f629 08753570
2020-03-26 14:23:20.255091 VERIFY ERROR: depth=1, error=self signed certificate in certificate chain: C=CH, ST=VD, L=Lausanne, O=Didwedo, OU=Certificate Authority, CN=Didwedo PHPki Certificate Authority, emailAddress=webmaster@didwedo.ch
2020-03-26 14:23:20.255145 OpenSSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
2020-03-26 14:23:20.255159 TLS_ERROR: BIO read tls_read_plaintext error
2020-03-26 14:23:20.255169 TLS Error: TLS object -> incoming plaintext read error
2020-03-26 14:23:20.255178 TLS Error: TLS handshake failed
2020-03-26 14:23:20.255389 SIGUSR1[soft,tls-error] received, process restarting


thanks for your help

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Openvpn-bridge
« Reply #11 on: March 26, 2020, 10:03:25 PM »
Look in /etc/openvpn/something
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Openvpn-bridge
« Reply #12 on: March 27, 2020, 12:18:03 AM »
Also srarch the internet:

Quote
VERIFY ERROR: depth=1, error=self signed certificate in certificate chain

The cerificates are probably not the same somehow.

Are you missing the CA in on the client?

How did you install the certificates in the client??
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline didwedo

  • *
  • 23
  • +0/-0
Re: Openvpn-bridge
« Reply #13 on: March 27, 2020, 08:43:26 AM »
Look in /etc/openvpn/something

here is the openvpn.conf

push "dhcp-option DOMAIN gw.didwedo.ch"
push "dhcp-option DNS 192.168.3.1"
push "dhcp-option WINS 192.168.3.1"

mtu-test
cipher AES-256-CBC
passtos
nice 5

management localhost 11194 management-pass.txt

# Clients options
client-config-dir ccd
max-clients 20
comp-lzo adaptive
push "comp-lzo adaptive"

status-version 2
status bridge-status.txt
suppress-timestamps
verb 3

Offline didwedo

  • *
  • 23
  • +0/-0
Re: Openvpn-bridge
« Reply #14 on: March 27, 2020, 08:45:06 AM »
Also srarch the internet:

The cerificates are probably not the same somehow.
Are you missing the CA in on the client?
How did you install the certificates in the client??

normally the certificate is in the pk12 right?
for installing the certificate, tunnelblick manages it, right?