Score:0

Where and how should I define OpenVPN user pass?

mx flag

Due to this link for having the user/pass authentication the line below should be added to server config file.

plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so login

But the link doesn't mention that how the file login should be filled.
I'm on Ubuntu 18.04.

Score:1
za flag

PAM stands for a Pluggable Authentication Modules, is a system authentication and authorization framework. It could use file, database, whatever you had configured as a password storage. It can even use things other than passwords to authenticate (say, OTP and so on); it can do two-factor authentication, link to external trusted third party (like Kerberos) and so on. In the simplest case it uses a shadow file to store encrypted passwords for system users.

openvpn-auth-pam module allows you to authenticate OpenVPN peers using this system authentication framework. login here means the PAM service your OpenVPN will use. Likely you already have some services, like system-auth is used for local users. Take a look into /etc/pam.d/ files to have a feel how PAM is configured and also please read its manuals.

What you'll find out is that the login service by default just refers to the system-auth. To use this as is you first create local system users and set their passwords. Then, add an --auth-user-pass option to the client configs, either with credentials file name or naked (then it will ask for credentials interactively). See man openvpn for details.

Finally, remember to always employ certificate-based authentication first. Each VPN peer must have its own unique certificate/key pair. The username/password authentication must be considered only as a supplementary security measure. And better don't use `duplicate-cn' feature.

Parsa Noori avatar
mx flag
Thanks, you helped me a lot.
Parsa Noori avatar
mx flag
How can I use it to check whether the username matches the password from a file ?
Nikita Kipriyanov avatar
za flag
Server config must require username/password somehow, for example it might invoke this plugin; client config uses `--auth-user-pass` option to specify credentials file or to ask it interactively. Please, read `man openvpn`, it is definitive guide how to configure it. Also, I strongly suggest to use username/password authentication only as a supplementary security measure; the main security measure must be a certificate-based auth, where each client is securely provided with its own key/certificate pair. And never ever use that `duplicate-cn` crap.
Parsa Noori avatar
mx flag
Thanks again. You helped me a lot.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.