我在Debian主机上安装了StrongSwan VPN服务器,并希望在客户端连接到它时运行自定义脚本。 我唯一想到的是定期检查日志文件的内容,但看起来笨重。
有什么办法来指定一个脚本来执行连接,最好有一些方法来推断用于该连接的原始IP和login信息?
您可以在连接部分使用leftupdown或rightupdown参数。 每次连接更改状态时,它们都会运行一个指定为参数的脚本:
left|rightupdown = <path> what updown script to run to adjust routing and/or firewalling when the status of the connection changes (default ipsec _updown).
有一些环境variables给你至less是连接更改状态的login信息,例如$PLUTO_PEER给你对等IP。 有关可用环境variables的更多信息,请参阅man 8 pluto (或man 8 ipsec_pluto )。