I can no longer establish the VPN connection and the local freeradius is not even hit. (freeradius -X)
I get this error in /var/log/openvpn/openvpn.log
89.32.123.xxx:18585 TLS Error: Auth Username/Password was not provided by peer
89.32.123.xxx:18585 TLS Error: TLS handshake failed
But I'm expecting to see Freeradius service to be hit (verbose debug shows nothing), when trying to connect to the VPN.
May you elaborate what I may have missed please?
Of course. Sorry about that.
Please let me know if you need to see anything else. I'm happy to provide it.
This issue is killing me for three days and I don't know how to proceed. Thank you
Server configuration file
Server Config
port 1111
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh none
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist /var/log/openvpn/ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
keepalive 10 120
tls-crypt ta.key
cipher AES-256-GCM
auth SHA256
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
log /var/log/openvpn/openvpn.log
verb 3
explicit-exit-notify 1
plugin /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so ovpn-0
Client configuration file
Server Config
client
dev tun
proto udp
remote 18.132.xxx.xxx 1111
resolv-retry infinite
nobind
user nobody
group nobody
persist-key
persist-tun
remote-cert-tls server
cipher AES-256-GCM
auth SHA256
key-direction 1
verb 3
<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</ca>
<cert>
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
Signature Algorithm: ecdsa-with-SHA512
Issuer: CN=Easy-RSA CA
Validity
Not Before: Jul 16 08:45:28 2020 GMT
Not After : Jul 1 08:45:28 2023 GMT
Subject: CN=client1
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (384 bit)
pub:
3a:87:ad:dc:a1:e8:4b
ASN1 OID: secp384r1
NIST CURVE: P-384
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Subject Key Identifier:
X509v3 Authority Key Identifier:
X509v3 Extended Key Usage:
TLS Web Client Authentication
X509v3 Key Usage:
Digital Signature
Signature Algorithm: ecdsa-with-SHA512
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</key>
<tls-crypt>
-----BEGIN OpenVPN Static key V1-----
-----END OpenVPN Static key V1-----
</tls-crypt>
TLS Error: Auth Username/Password was not provided by peer
Please see the Howto for further instructions.
Re: How to authenticate OpenVPN via FreeRadius?
Posted: Thu Jul 23, 2020 6:50 pm
by houmie75
Sorry, I'm a bit lost with your answer. Do you mean I should search for `TLS Error: Auth Username/Password was not provided by peer` in the HowTo section? I couldn't find anything that matches this. Thank you
Re: How to authenticate OpenVPN via FreeRadius?
Posted: Thu Jul 23, 2020 7:01 pm
by TinCanTech
You have not read the Howto about how to setup password authentication.
Re: How to authenticate OpenVPN via FreeRadius?
Posted: Fri Jul 24, 2020 7:30 am
by houmie75
The good news is that I got PAM working with Radius. But OpenVPN continues to refuse triggering PAM.
I have worked through the Howto. Some of the information seems a bit outdated.
e.g.
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so login
should be
plugin /usr/share/openvpn/plugin/lib/openvpn-plugin-auth-pam.so login
But nonetheless that section won't help with FreeRadius connectivity. Based on my research it should work like this:
But this never gets triggered by OpenVPN.
e.g. if I change the server.conf to a fake path:
plugin /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so /etc/pam.d/ovpn-01
OpenVPN 2.4.9 [git:master/c53d65eae4c1ecfe+] x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Jul 15 2020
library versions: OpenSSL 1.1.1g 21 Apr 2020
PLUGIN_INIT: POST /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so '[/usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so] [/etc/pam.d/ovpn-01]' intercepted=PLUGIN_AUTH_USER_PASS_VERIFY
Outgoing Control Channel Encryption: Cipher 'AES-256-CTR' initialized with 256 bit key
Outgoing Control Channel Encryption: Using 256 bit message hash 'SHA256' for HMAC authentication
Incoming Control Channel Encryption: Cipher 'AES-256-CTR' initialized with 256 bit key
Incoming Control Channel Encryption: Using 256 bit message hash 'SHA256' for HMAC authentication
ROUTE_GATEWAY 172.31.32.1/255.255.240.0 IFACE=eth0 HWADDR=02:f3:5c:78:33:da
TUN/TAP device tun0 opened
Is this because when I have compiled the latest OpenVPN, I had to do it with a special flag to enable PAM support to begin with? (e.g. --enable-plugin-auth-pam) ? What could be the reason that OpenVPN doesn't trigger PAM?
I am going to cite this thread next time there is a developer meeting about:
Why Warnings in logs go unheeded !
By the way, we all make mistakes, all of us ...
But sometimes you have to take a deep breath and just step back a little to see the big picture
Re: How to authenticate OpenVPN via FreeRadius?
Posted: Fri Jul 24, 2020 8:45 pm
by houmie75
haha please don't shame me and hear me out.
I'm using Freeradius and StrongSwan (IKEv2) on a daily basis. But I'm just starting off with OpenVPN and may do stupid things.
My understanding is that the accounting is passed on to Radius, which in turn checks the RadiusDB for username/password and sends back an ACCEPT or REJECT. So even if I don't provide a password to my IKEv2 client, I still see FreeRadius being triggered.
But with OpenVPN this is not happening, and I thought this was because of my bad configuration and I'm going into circles.
Now you say that this is happening because my client isn't sending the username/password, and hence OpenVPN server rejects it straight away without triggering FreeRadius.
Ok I did now try again and this time with providing a username/password to see if freeradius triggers.
89.32.xxx.xxx:17187 peer info: IV_GUI_VER="net.tunnelblick.tunnelblick_5481_3.8.2a__build_5481)"
AUTH-PAM: BACKGROUND: user 'houmie' failed to authenticate: Module is unknown
89.32.xxx.xxx:17187 PLUGIN_CALL: POST /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so/PLUGIN_AUTH_USER_PASS_VERIFY status=1
89.32.xxx.xxx:17187 PLUGIN_CALL: plugin function PLUGIN_AUTH_USER_PASS_VERIFY failed with status 1: /usr/local/lib/openvpn/plugins/openvpn-plugin-auth-pam.so
89.32.xxx.xxx:17187 TLS Auth Error: Auth Username/Password verification failed for peer
89.32.xxx.xxx:17187 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, 384 bit EC, curve: secp384r1
89.32.xxx.xxx:17187 [client1] Peer Connection Initiated with [AF_INET]89.32.xxx.xxx:17187
89.32.xxx.xxx:17187 PUSH: Received control message: 'PUSH_REQUEST'
89.32.xxx.xxx:17187 Delayed exit in 5 seconds
89.32.xxx.xxx:17187 SENT CONTROL [client1]: 'AUTH_FAILED' (status=1)
And as you can guess, it still didn't work. I suppose it has something to do with `Module is unknown` error message.
Now you say that this is happening because my client isn't sending the username/password, and hence OpenVPN server rejects it straight away without triggering FreeRadius.
Maybe .. No user/pass is not the same as the wrong user/pass.
I can see it hits the local freeradius server and it even authenticates correctly. What gives that OpenVPN doesn't attempt to hit the local freeradius to fetch the username/password?
If you don't know the answer, do you know by any chance an OpenVPN colleague who has established a successful OpenVPN/Freeradius integration in the past and could advice me please? I'm happy to compensate for it.