Is there a way to configure an OpenVPN server so that it restricts the clients that connect to it by operating system?
We currently use an OpenVPN server to connect our laptops to our servers on AWS (running in a VPC). A customer of ours has requested that we prohibit VPN access from mobile devices - hence we'd want to block Android, iOS, and Windows Phone clients.
Use the IV_PLAT peer info and a connect script (on the server) to reject connections if they use the wrong OS (exit with non-zero)
There is a bit of explanation around here : https://books.google.co.uk/books?id=_1MoDwAAQBAJ&pg=PA318&lpg=PA318&dq=openvpn+peer+info+as+environment+variable&source=bl&ots=CIue3PwB-g&sig=ACfU3U1QW1IKrjiRPyRyBRM1wC6GQlNVeg&hl=en&sa=X&ved=2ahUKEwjawdOe-JfqAhVzsHEKHetZDKwQ6AEwBnoECAwQAQ#v=onepage&q=openvpn%20peer%20info%20as%20environment%20variable&f=false
Copy/pasted here for future generations.
Append the following lines to the basic-udp-server.conf server configuration file:
Next, create the connect script: /etc/openvpn/cookbook/example9-11.sh
You would want to change the "echo" command to an "exit 99" or similar which should disconnect the client. (I haven't tried it.) And obviously use different names for the conf file and script!
So if you have access to the OpenVPN server you could block the requests there by using Passive OS Fingerprinting. and osf to whitelist your desktop OS.
I'm going to write this for Centos since it is when I used it. You are installing an app nfnl_osf and then the fingerprint signature database from OpenBSD to help match the machines.
After we have them both setup we import the database into iptables and then run the below iptables commands to run the check.
Hope that helps!
OpenVPN does push client information to the server via
--push-peer-info
.. the client OS is among those elements which are pushed and could theoretically be used to screen the connection based on the expected/blocked client OS.Example server log: