LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   A few questions about restricting access to OpenVPN server (https://www.linuxquestions.org/questions/linux-server-73/a-few-questions-about-restricting-access-to-openvpn-server-4175732466/)

Jason.nix 01-05-2024 04:41 AM

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.

___ 01-05-2024 10:22 PM

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.

rkelsen 01-05-2024 10:46 PM

Quote:

Originally Posted by Jason.nix (Post 6474752)
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.

Jason.nix 01-06-2024 03:53 AM

Quote:

Originally Posted by rkelsen (Post 6474897)
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?

pan64 01-06-2024 04:07 AM

Quote:

Originally Posted by Jason.nix (Post 6474920)
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 (Post 6474920)
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.

Jason.nix 01-06-2024 05:30 AM

Quote:

Originally Posted by pan64 (Post 6474923)
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.

rkelsen 01-06-2024 05:51 AM

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.

Jason.nix 01-06-2024 05:54 AM

Quote:

Originally Posted by rkelsen (Post 6474940)
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?

sundialsvcs 01-12-2024 01:17 PM

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.

rkelsen 01-12-2024 02:46 PM

Quote:

Originally Posted by Jason.nix (Post 6474941)
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?

Jason.nix 01-15-2024 02:29 AM

Quote:

Originally Posted by sundialsvcs (Post 6476271)
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?

Jason.nix 01-15-2024 02:31 AM

Quote:

Originally Posted by rkelsen (Post 6476284)
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.

pan64 01-15-2024 03:09 AM

what about looking for an answer yourself, like this: https://serverfault.com/questions/22...taneous-access

sundialsvcs 01-15-2024 08:46 AM

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."

Jason.nix 01-16-2024 12:39 AM

Quote:

Originally Posted by pan64 (Post 6476843)
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?


All times are GMT -5. The time now is 11:38 AM.