Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got an OpenVPN setup, wherein the entire class of clients (embedded devices) share the same client certificate.

They are however distinguishable by their hostnames (which is derived from the hardware ID anyways) - I would like to be able to distinguish between them serverside, whether by assigning them different IP addresses (I know all the hostnames out there), or by assigning them different dynamic DNS entries in a zone under my control.

Either option is fine - but how do I get this information from a client into a script serverside?

share|improve this question
up vote 2 down vote accepted

OpenVPN doesn't seem to provide any information about a client other than common name, so there isn't a nice way to do this. You could however hack something together by using username/password authentication in addition to certificate authentication, with the username being unique for each device.

In the server configuration:

auth-user-pass-verify /etc/openvpn/ via-env

Don't set client-cert-not-required -- the real authentication is still going to be done using certificates. is a dummy script which always indicates successful authentication:

exit 0

The clients should then be configured to provide username/password authentication (as well as certificate authentication):

auth-user-pass /etc/openvpn/devicename

devicename then contains a unique username for each device and a dummy password:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.