LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-05-2024, 04:41 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Rep: Reputation: 10
Post A few questions about restricting access to OpenVPN server


Hello,
I have some quedtions about the OpenVPN server:
1- How do I know how many people are connected to the OpenVPN server?

2- You give OpenVPN server keys to someone and he\she may share the keys with others, to avoid this problem is it possible to restrict connection to OpenVPN server based on the MAC address?

Thank you.
 
Old 01-05-2024, 10:22 PM   #2
___
Member
 
Registered: Apr 2023
Posts: 155
Blog Entries: 1

Rep: Reputation: Disabled
vpn is a good, diverse learning project

IDK vpn, but I say this to be globally helpful (not scolding):
Might you prefer the instant results from web-searching?

For these 2 questions, answers look plentiful.
(In other instances, less-definitive search results may help clarify keywords & info needed.)

&I don't mean to derail those who enjoy answering. Best wishes.


Edit, added after #3-on +1: I was wrong, sorry:
just-google probably wouldn't have found
the discussion of security issues.

Last edited by ___; 01-06-2024 at 05:28 PM. Reason: I was wrong....
 
Old 01-05-2024, 10:46 PM   #3
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
Hello,
I have some quedtions about the OpenVPN server:
1- How do I know how many people are connected to the OpenVPN server?

2- You give OpenVPN server keys to someone and he\she may share the keys with others, to avoid this problem is it possible to restrict connection to OpenVPN server based on the MAC address?

Thank you.
Answers to your questions are as follows:

1. Check the logs. There is one at /etc/openvpn/openvpn-status.log which shows a current client list.

2. You can't physically stop people from giving aways keys &/or passwords, but you can make the keys useless to thieves by encrypting them. MAC filters are pretty weak, since MAC addresses are quite easy to spoof. OpenVPN will allow you to filter by MAC address. It is easier to do with the paid-for version, and it is also possible with the Community Edition, but you'll have to write your own scripts to do it.
 
1 members found this post helpful.
Old 01-06-2024, 03:53 AM   #4
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by rkelsen View Post
Answers to your questions are as follows:

1. Check the logs. There is one at /etc/openvpn/openvpn-status.log which shows a current client list.

2. You can't physically stop people from giving aways keys &/or passwords, but you can make the keys useless to thieves by encrypting them. MAC filters are pretty weak, since MAC addresses are quite easy to spoof. OpenVPN will allow you to filter by MAC address. It is easier to do with the paid-for version, and it is also possible with the Community Edition, but you'll have to write your own scripts to do it.
Hello,
Thank you so much for your reply.
1- My question is how can you find out if someone has shared the key with others?

2- I know filtering by MAC address is somewhat useless, because as you said others can spoof the MAC address. I think it is somewhat helpful, because maybe not everyone can do it. Regarding the script you mentioned, can you guide me?
 
Old 01-06-2024, 04:07 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,974

Rep: Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335
Quote:
Originally Posted by Jason.nix View Post
1- My question is how can you find out if someone has shared the key with others?
there is no way. Probably you can restrict the number of hosts by keys, but you will never know if a new device belongs to the same user (old one is replaced) or it is another user. Or if the same user wants to use the vpn from more than one host.
Quote:
Originally Posted by Jason.nix View Post
2- I know filtering by MAC address is somewhat useless, because as you said others can spoof the MAC address. I think it is somewhat helpful, because maybe not everyone can do it. Regarding the script you mentioned, can you guide me?
Now I can change the MAC address on my phone with a single click. Probably not everyone can do that, but it is already documented on the net.
 
Old 01-06-2024, 05:30 AM   #6
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by pan64 View Post
there is no way. Probably you can restrict the number of hosts by keys, but you will never know if a new device belongs to the same user (old one is replaced) or it is another user. Or if the same user wants to use the vpn from more than one host.

Now I can change the MAC address on my phone with a single click. Probably not everyone can do that, but it is already documented on the net.
Hello,
Thank you so much for your reply.
Is it possible to generate a key so that only 10 people can connect to the server through it?
About filtering by MAC address I found this article, but I have to test it.
 
Old 01-06-2024, 05:51 AM   #7
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
Unless you change the default settings, the server will reject multiple concurrent connections with the same certificate.

You can also limit the number of concurrent connections to the server.
 
Old 01-06-2024, 05:54 AM   #8
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 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.

You can also limit the number of concurrent connections to the server.
Hello,
Thanks again.
How? Can I use LDAP mechanism (openvpn-auth-ldap) instead of MAC address filtering? If someone shares his\her username and password with others, then two people cannot connect to the server at the same time. Is this true?

Last edited by Jason.nix; 01-08-2024 at 04:28 AM.
 
Old 01-12-2024, 01:17 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
You cannot prevent the misappropriation of keys, but you can selectively revoke any key that has been misused … and refer the employee to HR for violating company security policy. A revoked key is instantly useless.

You can prevent a given key from being used to initiate more than one session simultaneously.

You can password-protect (encrypt) a key to prevent unauthorized use.

Many commonly-used GUI clients can restrict management of the keys to “system administrators,” and will not disclose the key materials in any case. (Of course(!) the “traveling salesman” does not have “administrative access” to his computer …)

You should always(!) issue keys only to “uniquely identifiable individuals or computers.” (As the case may be.) Never “share them.” After all, the electronic badges that employees use to get past the front door are also never “shared.”

LDAP (“Microsoft OpenDirectory”) is commonly used for centralized key management, and it works very well.

Last edited by sundialsvcs; 01-12-2024 at 01:27 PM.
 
Old 01-12-2024, 02:46 PM   #10
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
Can I use LDAP mechanism (openvpn-auth-ldap) instead of MAC address filtering? If someone shares his\her username and password with others, then two people cannot connect to the server at the same time. Is this true?
Possibly, but the same is true of certificates. The server will reject attempts by à second user to use the same keys as someone else.

What is your concern here? What problem are you trying to solve?
 
Old 01-15-2024, 02:29 AM   #11
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by sundialsvcs View Post
You cannot prevent the misappropriation of keys, but you can selectively revoke any key that has been misused … and refer the employee to HR for violating company security policy. A revoked key is instantly useless.

You can prevent a given key from being used to initiate more than one session simultaneously.

You can password-protect (encrypt) a key to prevent unauthorized use.

Many commonly-used GUI clients can restrict management of the keys to “system administrators,” and will not disclose the key materials in any case. (Of course(!) the “traveling salesman” does not have “administrative access” to his computer …)

You should always(!) issue keys only to “uniquely identifiable individuals or computers.” (As the case may be.) Never “share them.” After all, the electronic badges that employees use to get past the front door are also never “shared.”

LDAP (“Microsoft OpenDirectory”) is commonly used for centralized key management, and it works very well.
Hello,
Thank you so much for your reply.
Quote:
You can prevent a given key from being used to initiate more than one session simultaneously.
How? By setting username and password?
 
Old 01-15-2024, 02:31 AM   #12
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by rkelsen View Post
Possibly, but the same is true of certificates. The server will reject attempts by à second user to use the same keys as someone else.

What is your concern here? What problem are you trying to solve?
Hello,
Thank you so much for you reply.
You give the OpenVPN keys to someone so he\she can connect to your server and he\she share the key with others. Now you have to look for a solution to detect and prevent this.
 
Old 01-15-2024, 03:09 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,974

Rep: Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335Reputation: 7335
what about looking for an answer yourself, like this: https://serverfault.com/questions/22...taneous-access
 
1 members found this post helpful.
Old 01-15-2024, 08:46 AM   #14
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
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."

Last edited by sundialsvcs; 01-15-2024 at 08:52 AM.
 
Old 01-16-2024, 12:39 AM   #15
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by pan64 View Post
what about looking for an answer yourself, like this: https://serverfault.com/questions/22...taneous-access
Hello,
Thank you so much for your reply.
Are you saying that by default two people cannot use the same key at the same time?
 
  


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 11:47 AM.

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