大网数据广告活动
服务器运维问答

Openvpn ignore client config

· 52CE 我爱测

I have a setup where I issue openvpn certificates to clients to redirect their traffic to specific sites. It's important to restrict the sites each client is redirected to. Each client has the IPs that should be routed in the ser…

问题原文

原帖链接 · rwms · CC BY-SA 3.0

I have a setup where I issue openvpn certificates to clients to redirect their traffic to specific sites. It's important to restrict the sites each client is redirected to.

Each client has the IPs that should be routed in the server in client-configs/config-dir/ like this: push route 123.123.123.123 255.255.255.255.

Clients are given an ovpn file with their keys and configurations to setup on their terminals. The issue is that a client could potentially edit their ovpn file and route more traffic through the VPN even though the new routes are not on the server side configs. This would allow them to access sites that they should not.

Is there a solution to restrict this behavior or maybe another tool I could use?

Notes:

  • OpenVPN server has only one public IP attached and is forwarding traffic.
  • Locking down permissions is not an option because this is a BYOD scenario.
  • Outbound firewall restrictions on the openvpn server is also not an option because each client is routed to a different set of IPs.

已采纳解答

原帖链接 · BoomShadow · CC BY-SA 3.0

You are correct. A client can edit their local ovpn file and tell it to ignore pushed routes, and then configure it to route all traffic to the gateway. I've had to do this a couple of times myself for testing. OpenVPN does not have a way to restrict that.

You have 2 options:

  1. Lock down permissions of the client's OVPN file so they cannot edit it
  2. Implement a firewall rule(s) on the OpenVPN server that prevents outbound traffic except for specific subnets

If you're in a corporate environment, you likely already have mechanisms for controlling permissions on users' computers. The first option could be pretty easy.

If you don't have control of users' permissions to the file, then the firewall rule is the best way to go. You already had to setup rules for the forwarding an masquerading to work (Example: https://askubuntu.com/a/578550/283173). You can insert additional iptables rules to only allow your specific subnets.

Update: Based on your revised notes, it's even more clear that your only option is firewall on the server side. You'll have to really think things through about your outbound filters. What you'll probably have to end up doing is making your own program that intelligently creates firewall rules. If you know each client is getting routed to specific IP's, you could dynamically open up routes in the firewall when the client connects. You can hook into OpenVPN's system when clients connect by using the learn-address directive in the server config, to send details about the client connection into your custom program.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。