wfg / docker-openvpn-client

OpenVPN client with killswitch and proxy servers; built on Alpine
MIT License
353 stars 107 forks source link

OpenVPN User/password #34

Closed aseelert closed 2 years ago

aseelert commented 2 years ago

I use a Synology NAS with OpenVPN. and you need to login with user/password. is it possible you can add a VPNAUTH_USER and VPNAUTH_PASSWORD option?

<<<config proto udp

script-security 2

comp-lzo

reneg-sec 0

cipher BF-CBC

auth SHA1

auth-user-pass <<<config

2021-10-13 12:22:27 WARNING: Compression for receiving enabled. Compression has been used in the past to break encryption. Sent packets are not compressed unless "allow-compression yes" is also set.

2021-10-13 12:22:27 DEPRECATED OPTION: --cipher set to 'BF-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'BF-CBC' to --data-ciphers or change --cipher 'BF-CBC' to --data-ciphers-fallback 'BF-CBC' to silence this warning.

2021-10-13 12:22:27 OpenVPN 2.5.2 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on May 4 2021

2021-10-13 12:22:27 library versions: OpenSSL 1.1.1k 25 Mar 2021, LZO 2.10

2021-10-13 12:22:27 neither stdin nor stderr are a tty device and you have neither a controlling tty nor systemd - can't ask for 'Enter Auth Username:'. If you used --daemon, you need to use --askpass to make passphrase-protected keys work, and you can not use --auth-nocache.

2021-10-13 12:22:27 Exiting due to fatal error

lasharor commented 2 years ago

Also have the same issue with this container.

Johan-Claesson commented 2 years ago

This seems to be implemented already, but I put my username and password in a file called "credentials.conf" and change the line where it says "auth-user-pass" to "auth-user-pass credentials.conf".

The credentials.conf file as follows: username password

and store the file beside your vpn-file

wfg commented 2 years ago

@aseelert @lasharor I'm not understanding the problem. Can you not supply a file with the username and password? Are you using the built-in Synology OpenVPN client? If so, how are you using this image?

Gondolindrim commented 2 years ago

@wfg Running Syno here. I'm using this image with a container with a .ovpn file for the connection. The server needs credentials to log in, hence @Johan-Claesson 's suggestion. I however was not able to implement his suggestion

nikhil96widhani commented 2 years ago

i am facing same error

wfg commented 2 years ago

OpenVPN configuration files have an auth-user-pass option that can be set to the name of a file containing a username and password in the following format:

username
password

So to be clear, if you have a file called my-credentials.txt in a directory with the following contents:

my-username
my-password

and you have my-config.ovpn in the same directory with the line

auth-user-pass my-credentials.txt

inside, when OpenVPN starts, it will authenticate against the remote with those credentials, and nothing should have to be passed in.

If this doesn't work for you, someone with a Synology will have to explain what the actual problem is here.

wfg commented 2 years ago

@silentioetfide can you share your config file?

SimonvanAs commented 2 years ago

The proposed solution works for me: creating a 'credentials.conf' in the same folder as the OpenVPN.conf touch credentials.conf adding on line 1 the username adding on line 2 the secret saving the bunch starting the container

wfg commented 2 years ago

https://github.com/wfg/docker-openvpn-client#vpn-authentication