Openvpn on Linux: Passing Username and Password in Command Line

OpenVPN on Linux: passing username and password in command line

The previous answer didn't work for me (still asked for username and password), what did work was putting your credentials in a file (pass.txt), like this

username@email.com
password

and calling openvpn with --auth-user-pass pass.txt.

source

Note that in some OpenVPN versions (e.g. OpenVPN 2.4.11) there is a bug where you have to first use --config and then --auth-user-pass or your auth file will be ignored without any warning.

So, here a complete example:

sudo openvpn --config /home/ipv/conf/ipvanish-CA-Toronto-tor-a09.ovpn --auth-user-pass pass.txt

Openvpn leading -- error parse from txt username and password

Did you try --config? Just:

echo 12345 | sudo -S openvpn --config /path/to/config.file --auth-user-pass pass.txt

Openvpn with username and password

There's a directive you can use in your server.conf, depending on your OpenVPN version.

  • client-cert-not-required:

    Makes your VPN a less secure as the cert is not required to authenticate (deprecated).

  • verify-client-cert none|optional|require:

    Using verify-client-cert none is the equivalent of the aforementioned option.

Source Link: Click here

How can I pipe a username and password into another command that will execute (BASH)?

You can have local-exec create a username / password file if you're using vault or something else to grab the credentials on the fly. Then provide the --auth-user-pass up argument to read the file, then have local-exec remove the file.

--auth-user-pass [up]

Authenticate with server using username/password. up is a file containing username/password on 2 lines. If the password line is missing, OpenVPN will prompt for one.
If up is omitted, username/password will be prompted from the console.

The server configuration must specify an --auth-user-pass-verify script to verify the username/password provided by the client.

Source: https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage



Related Topics



Leave a reply



Submit