Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client config gets created in /home//<name>.ovpn #806

Closed
4 tasks done
slhck opened this issue Mar 11, 2021 · 4 comments
Closed
4 tasks done

Client config gets created in /home//<name>.ovpn #806

slhck opened this issue Mar 11, 2021 · 4 comments

Comments

@slhck
Copy link

slhck commented Mar 11, 2021

Checklist

  • I read the README
  • I read the FAQ
  • I searched the issues
  • My issue is about the script, and not OpenVPN itself

Describe the issue

Client config gets created in /home//<name>.ovpn

To Reproduce
Steps to reproduce the behavior:

  1. Login as regular user named <name>
  2. sudo su
  3. Navigate to /root
  4. Download script (version e965518) and execute
  5. Add a client during first installation
  6. The config is placed in /home//<name>.ovpn

Expected behavior

The script should generate the ovpn config in /root.

Logs

Tell me a name for the client.
The name must consist of alphanumeric character. It may also include an underscore or a dash.
Client name: werner

Do you want to protect the configuration file with a password?
(e.g. encrypt the private key with a password)
   1) Add a passwordless client
   2) Use a password for the client
Select an option [1-2]: 2
⚠️ You will be asked for the client password below ⚠️

Note: using Easy-RSA configuration from: /etc/openvpn/easy-rsa/vars
Using SSL: openssl OpenSSL 1.1.1f  31 Mar 2020
Generating an EC private key
writing new private key to '/etc/openvpn/easy-rsa/pki/easy-rsa-15542.cOq3cG/tmp.sldyng'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
Using configuration from /etc/openvpn/easy-rsa/pki/easy-rsa-15542.cOq3cG/tmp.DCkRqZ
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName            :ASN.1 12:'werner'
Certificate is to be certified until Jun 14 12:29:23 2023 GMT (825 days)

Write out database with 1 new entries
Data Base Updated

Client werner added.

The configuration file has been written to /home//werner.ovpn.
Download the .ovpn file and import it in your OpenVPN client.

Server if applicable):

  • OS: Ubuntu 20.04

Relevant env:

LOGNAME=root
USER=root
HOME=/root
SHELL=/usr/bin/zsh
SUDO_COMMAND=/usr/bin/su
SUDO_USER=werner
SUDO_UID=1000
SUDO_GID=1002
SHLVL=1
PWD=/root
OLDPWD=/home/werner
@slhck
Copy link
Author

slhck commented Mar 11, 2021

Looking at the fix in e965518 I don't see how this would occur given both the client name being the name of the user and $SUDO_USER being set.

@slhck
Copy link
Author

slhck commented Mar 11, 2021

Aha. When I try adding a client with an arbitrary name (neither root nor werner), it still creates that file in /home//<name>.ovpn.

@angristan
Copy link
Owner

I made a mistake in e965518, but it should be fixed with 319459a!

@slhck
Copy link
Author

slhck commented Mar 11, 2021

Thanks for the quick fix!

timbo2k pushed a commit to timbo2k/openvpn-install that referenced this issue Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants