Page 1 of 1

host .ovpn username and password on web hosting

Posted: Tue Sep 13, 2022 2:52 pm
by vqoley
Hello. is that anything command in config file that can connect username and password from hosting?

i host pass.txt in my site meaning it will like this mysite.com/pass.txt

i try use

auth-user-pass "mysite.com/pass.txt"



but i got an error:

2022-09-13 21:36:02 WARNING: cannot stat file "mysite.com/pass.txt": Unknown error (errno=123)

Options error: --auth-user-pass fails with "mysite.com/pass.txt": Unknown error (errno=123)

Options error: Please correct these errors.





anyone can help me?

Re: host .ovpn username and password on web hosting

Posted: Tue Sep 13, 2022 3:27 pm
by TinCanTech
Openvpn does not interpret such things as URLs or environment variables in the config file.

Also, why would you put your password on a website ..

Re: host .ovpn username and password on web hosting

Posted: Tue Sep 13, 2022 3:31 pm
by vqoley
TinCanTech wrote:
Tue Sep 13, 2022 3:27 pm
Openvpn does not interpret such things as URLs or environment variables in the config file.

Also, why would you put your password on a website ..
i see that. is that anyway to put direct username and password in .ovpn without using extension file?

Re: host .ovpn username and password on web hosting

Posted: Tue Sep 13, 2022 3:37 pm
by TinCanTech
I don't understand you very well. Try searching the manual for 'pass' and 'word'.

Re: host .ovpn username and password on web hosting

Posted: Tue Sep 13, 2022 3:54 pm
by vqoley
TinCanTech wrote:
Tue Sep 13, 2022 3:37 pm
I don't understand you very well. Try searching the manual for 'pass' and 'word'.
sorry. as you said "Openvpn does not interpret such things as URLs or environment variables in the config file.". So i don't want use .txt file to put username and password there. so i looking the other way that can enter username and password in .ovpn config file

example the one i don't want is:
auth-user-pass auth.txt

alternative i looking is like this or similar with it
auth-user-pass username:password

meaning no need link with other file.

i doing this because i build an android app. so its difficult to use local file that written with username and password. so i looking for alternative way that android app easier to access config with username and password.

Re: host .ovpn username and password on web hosting

Posted: Tue Sep 13, 2022 4:36 pm
by TinCanTech
It really makes no difference what file you use to record the username and password.

However, Openvpn only allows a standard text file for this purpose, currently.

Re: host .ovpn username and password on web hosting

Posted: Wed Sep 14, 2022 11:52 am
by dazo
The "auth.text" part is expected to be a file which the openvpn program on your machine can read. If it is in the same directory as your OpenVPN configuration file, then the file can be in the same directory. Just ensure the read privileges to this file is restricted, so other users can't read it.

Update: I was just informed this below only works with OpenVPN 3 based implementations, not OpenVPN 2.x versions.
Alternatively you can instead of using the "auth-user-pass auth.txt" in your configuration file, you can replace it with this:

Code: Select all

<auth-user-pass>
username_goes_here
password_goes_here
</auth-user-pass>

Re: host .ovpn username and password on web hosting

Posted: Fri Sep 16, 2022 10:37 pm
by openvpn_inc
Hi vqoley,

Android users can install a text editor, or create the file somewhere else, and use some means to copy it or download it to the phone or tablet.

regards, rob0

Re: host .ovpn username and password on web hosting

Posted: Sat Sep 17, 2022 7:46 pm
by ordex
A patch to address this issue has been submitted to the mailing list. With this patch it is possible to store user and pwd inline in the .ovpn file, as suggested by dazo.

https://patchwork.openvpn.net/project/o ... stable.cc/