2

在Centos7/8上使用HillstoneVPN

 2 years ago
source link: https://www.lainme.com/doku.php/blog/2021/11/%E5%9C%A8centos7/8%E4%B8%8A%E4%BD%BF%E7%94%A8hillstonevpn
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

在Centos7/8上使用HillstoneVPN

公司内网使用的是Hillstone的SSL VPN,官方的Linux客户端只支持非常有限的几个老发行版,连Centos7都不支持。不过有些发行版并非真的不能用,只是程序里对发行版做了判断,不是指定的几个就强行退出。

后来我发现有人做了一个移除了版本限制的客户端,在Centos7下面可以完美运行:https://github.com/JackMoriarty/HillstoneVPN/releases

但在Centos8上运行时总是报错,

Unit dbus-org.freedesktop.resolve1.service not found

这个报错的服务是systemd-resolved的,默认没有开启。但我启动systemd-resolved服务后,虽然不再报错,VPN连接后却完全无法上网。搜索后才知道systemd-resolved更改了很多原本的机制,VPN软件必须做相应的修改才能使用。那么怎么才能不用systemd-resolved,又不让客户端报错呢?我花了几个小时终于发现了最简单的解决方法,删除/sbin/resolvconf

虽然客户端可以用了,但我对这个客户端很不满意:

  • 无法做成systemd服务开机自动启动和连接指定的VPN
  • 需要在桌面持续运行,无法很好的最小化

经过一些搜索后,我发现了一个第三方的命令行客户端Hilldust (https://github.com/LionNatsu/hilldust),基本能解决上述问题,但它也有自己的一点不足

  • 不支持从配置文件读入参数,在多人使用的电脑上会暴露密码
  • 没有从VPN服务器返回的路由表中设置路由,对我们公司的网络无法设置正确的路由
  • 不能很好的作为systemd服务运行,主要是退出时的判断仅有KeyInterrupt,没有考虑SIGNAL。
  • 使用iproute2来配置网络,可能和NetworkManager冲突。另外网络复位主要靠save & restore,如果在VPN运行期间还做了其他网络的调整,复位的时候也会回退这些调整。

于是我在Hilldust上重新做了一个Wrapper,处理了一下这些地方,在Centos7/8上都测试通过了。如果你也需要的话,可以试试:https://github.com/lainme/hilldustWrapper


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK