LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-16-2024, 12:48 AM   #16
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10

Quote:
Originally Posted by sundialsvcs View Post
OpenVPN provides a server setting which prevents more than one simultaneous session from using the same credentials. (Everything in OpenVPN boils down to "the user's key." It knows nothing of system usernames, much less passwords.) The keys contain within their encrypted content a unique serial number, and the same number cannot be used twice at the same time.

Of course it goes without saying that you should never use PSKs = simple passwords." Every user or computer should be issued its own unique key, which you can if necessary selectively revoke.

Anyone who shares VPN key information should be subject to immediate employment termination. And they should be sternly warned of this on day one.

Also note that most software does not enable a "non-administrator user" to access the key information anyway: they are entitled to use the key, but they have no reason to know it. (Any more than they "need to know" what is actually encoded on the unique badge they use to get beyond the lobby of the building.)

If you further "password-protect" a key, you are actually encrypting it. So it must be successfully decrypted before it can then be used. But the security of the key rests only with "itself," encrypted or not. (And with the fact that it has not yet been revoked.) The key is "one of a kind," and the user cannot manufacture one for himself.

Give each user a unique key and a copy of the tls-auth certificate (which is common). The latter enables you to even try(!) to connect – completely shutting-down "unauthorized access attempts."
Hello,
Thank you so much for your reply.
So, the best way to prevent two people from logging in at the same time is to use username and password authentication.
 
Old 01-16-2024, 01:53 AM   #17
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by Jason.nix View Post
Are you saying that by default two people cannot use the same key at the same time?
Yes, that is how it works.

See also post #10:
Quote:
Originally Posted by rkelsen View Post
Unless you change the default settings, the server will reject multiple concurrent connections with the same certificate.
and post #7:
Quote:
Originally Posted by rkelsen View Post
The server will reject attempts by a second user to use the same keys as someone else.
Quote:
Originally Posted by Jason.nix View Post
So, the best way to prevent two people from logging in at the same time is to use username and password authentication.
No.
 
1 members found this post helpful.
Old 01-16-2024, 08:52 AM   #18
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by rkelsen View Post
Yes, that is how it works.

See also post #10: and post #7:

No.
Hello,
Thank you so much for your reply.
One of the reasons I hadn't noticed this was that when one user connects to the OpenVPN server and then the next user connects to the server with the same key, the OpenVPN Connect app stays connected.
I have two questions:
1- I used the following two commands to generate keys for clients:
Code:
# ./easyrsa gen-req <client name> nopass
# ./easyrsa sign-req client <client name>
In the first command, I see the following message:
Quote:
Common Name (eg: your user, host or server name) [client name]:
I just hit the enter key and the key was generated. I repeated the same thing for the second client and just changed the name of the client.
Now, two clients should be able to connect simultaneously. Am I right?

2- Are ca.key and ta.key the same for all clients?

Last edited by Jason.nix; 01-16-2024 at 08:55 AM.
 
Old 01-16-2024, 06:13 PM   #19
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by Jason.nix View Post
One of the reasons I hadn't noticed this was that when one user connects to the OpenVPN server and then the next user connects to the server with the same key, the OpenVPN Connect app stays connected.
If this happens, then there is something wrong.
Quote:
Originally Posted by Jason.nix View Post
I have two questions:
1- I used the following two commands to generate keys for clients:
Code:
# ./easyrsa gen-req <client name> nopass
# ./easyrsa sign-req client <client name>
You should only use nopass for the server's keys. Definitely not on client keys, unless you're setting up a permanent VPN between sites and the remote client is a headless server.
Quote:
Originally Posted by Jason.nix View Post
Now, two clients should be able to connect simultaneously. Am I right?
Using different keys, yes.
Quote:
Originally Posted by Jason.nix View Post
2- Are ca.key and ta.key the same for all clients?
No.

ca.key is the private key. This should NEVER be shared with anyone. It should only exist on the CA machine.

It probably wouldn't hurt to read the documentation to learn more about this. The questions you have seem to be quite fundamental and are all covered: https://community.openvpn.net/openvpn/wiki/HOWTO
 
1 members found this post helpful.
Old 01-17-2024, 12:44 AM   #20
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by rkelsen View Post
If this happens, then there is something wrong.

You should only use nopass for the server's keys. Definitely not on client keys, unless you're setting up a permanent VPN between sites and the remote client is a headless server.

Using different keys, yes.

No.

ca.key is the private key. This should NEVER be shared with anyone. It should only exist on the CA machine.

It probably wouldn't hurt to read the documentation to learn more about this. The questions you have seem to be quite fundamental and are all covered: https://community.openvpn.net/openvpn/wiki/HOWTO
Hello,
Thanks again.
Quote:
If this happens, then there is something wrong.
1- Should an option be included in the server or client configuration files?

2- I guess nopass is just to increase security, if the key falls into someone's hands, then he\she need to know the username and password to use it.

3- If you want to create a file with the extension .ovpn for the client that will connect to your server, then you need to put the keys Ca.crt, Client.crt, Client.key and Ta.key in the client file. Am I wrong?
 
Old 01-17-2024, 01:20 AM   #21
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by Jason.nix View Post
1- Should an option be included in the server or client configuration files?
By default, the server will disallow two connections using the same Common Name. If you want to enable multiple connections with the same Common Name (which is not a good idea), then you have to use the "duplicate-cn" directive in your configuration file.
Quote:
Originally Posted by Jason.nix View Post
2- I guess nopass is just to increase security, if the key falls into someone's hands, then he\she need to know the username and password to use it.
Just the opposite. nopass leaves the key unencrypted, which means anyone can use it.
Quote:
Originally Posted by Jason.nix View Post
3- If you want to create a file with the extension .ovpn for the client that will connect to your server, then you need to put the keys Ca.crt, Client.crt, Client.key and Ta.key in the client file. Am I wrong?
No, you're not wrong. Your understanding is correct. The "client.crt" and "client.key" parts are different for each user, and should have different names.
 
1 members found this post helpful.
Old 01-17-2024, 01:44 AM   #22
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by rkelsen View Post
By default, the server will disallow two connections using the same Common Name. If you want to enable multiple connections with the same Common Name (which is not a good idea), then you have to use the "duplicate-cn" directive in your configuration file.

Just the opposite. nopass leaves the key unencrypted, which means anyone can use it.

No, you're not wrong. Your understanding is correct. The "client.crt" and "client.key" parts are different for each user, and should have different names.
Hi,
Thanks again.
I use the OpenVPN Connect app on Android and PC. When I connect to the server with the same key on two devices, the OpenVPN Connect app on the previous client does not disconnect, but it doesn't work either. Why?

Last edited by Jason.nix; 01-17-2024 at 01:45 AM.
 
Old 01-17-2024, 03:40 AM   #23
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
By default, OpenVPN uses UDP. This allows it to operate without a connection.

When you "connect" to it, what you're actually doing is registering your IP address with the server. It then knows to accept packets from your IP address which are encrypted with the key you're using. If a user on a different IP address then "connects," with the same key it will deny access to packets from the original IP address. The original client device won't even know.

This is an over-simplification, and I'm more than happy to be corrected by someone who knows better.

You can check the logs in /etc/openvpn or /var/log/messages or /var/log/syslog for more details about the connections and what is going on.
 
1 members found this post helpful.
Old 01-19-2024, 06:51 AM   #24
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by rkelsen View Post
By default, OpenVPN uses UDP. This allows it to operate without a connection.

When you "connect" to it, what you're actually doing is registering your IP address with the server. It then knows to accept packets from your IP address which are encrypted with the key you're using. If a user on a different IP address then "connects," with the same key it will deny access to packets from the original IP address. The original client device won't even know.

This is an over-simplification, and I'm more than happy to be corrected by someone who knows better.

You can check the logs in /etc/openvpn or /var/log/messages or /var/log/syslog for more details about the connections and what is going on.
Hello,
Thank you so much for your reply.
But in my opinion, it is better that the creators of OpenVPN designed it in such a way that the previous connection is interrupted so that the user realizes that someone is connected to the server with his\her keys.
How can I save the contents of the openvpn-status.log file? When someone connects to the server, his\her information is placed in this file, and when he\she leaves the server, his\her information is deleted!
 
Old 01-19-2024, 08:37 AM   #25
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Quote:
Originally Posted by Jason.nix View Post
Hello,
Thank you so much for your reply.
But in my opinion, it is better that the creators of OpenVPN designed it in such a way that the previous connection is interrupted so that the user realizes that someone is connected to the server with his\her keys.
no
the working session will work, another one cannot be opened with the same key. User will be informed using email/sms/whatever, but not by disconnecting.
 
1 members found this post helpful.
Old 01-20-2024, 01:12 AM   #26
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by pan64 View Post
no
the working session will work, another one cannot be opened with the same key. User will be informed using email/sms/whatever, but not by disconnecting.
Hello,
Thank you so much for your reply.
No idea about how can I save the contents of the openvpn-status.log file?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Returning to Slackware after a few years, but I have a few questions pocker Slackware 14 04-19-2021 02:22 PM
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM
Error When converting Routing OpenVPN to bridge mode openvpn danmartinj Linux - Software 0 11-06-2009 09:23 AM
Monitoring and restricting OpenVPN jonnytabpni Linux - Networking 7 04-18-2009 10:37 AM
OpenVPN Question : connecting 5-6 comps with OpenVPN duryodhan Linux - Networking 7 02-15-2007 10:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration