0

我有一个软以太 VPN 服务器,我想制作一个自定义客户端应用程序,它看起来像 python 中的其他 vpn 客户端(Nord,Hola vpns)。问题出在 python 中,我找不到使用 Windows 内置 vpn 管理器以编程方式通过 IPsec 协议进行连接的方法。

在 CI 中可以找到一个 RAS API,但由于我是网络基础设施编程的新手,所以我很难正确地解散它,了解它的实际工作原理。

4

1 回答 1

0

You can use Add-VpnConnection and Set-VpnConnectionIPsecConfigurationin Windows PowerShell

See the Example 2 in 2nd link:

PS C:\> Add-VpnConnection -Name "Contoso" -ServerAddress 176.16.1.2 -TunnelType "L2tp"
PS C:\> Set-VpnConnectionIPsecConfiguration -ConnectionName "Contoso" -AuthenticationTransformConstants None -CipherTransformConstants AES128 -EncryptionMethod AES128 -IntegrityCheckMethod SHA256 -PfsGroup None -DHGroup ECP256 -PassThru -Force
AuthenticationTransformConstants : None

CipherTransformConstants         : AES128

DHGroup                          : ECP256

IntegrityCheckMethod             : SHA256

PfsGroup                         : None

EncryptionMethod                 : AES128

And it should also be simple to call the PowerShell from Python.

于 2019-10-15T06:10:25.393 回答