Methods of programatically altering ipsec rules with C#?

后端 未结 3 1469
灰色年华
灰色年华 2021-01-21 10:33

The only method I know how to execute IPsec changes involves calling netsh to do the changes. Is there a method using System.Management and WMI objects directly? If so, what is

3条回答
  •  时光取名叫无心
    2021-01-21 11:22

    You can't do it with WMI. WMI is restricted to TCP Filtering, meaning blocking ports. Nothing more.

    If you are using previous Windows versions, you can either:

    a) use a command line tool, in this case either ipseccmd.exe or ipsecpol.exe (W2K), or netsh

    or

    b) Write the policies to the registry

    My guess is that the command line tools do just that: they write values to the registry.

    I've been into it for some time now and i didn't find a managed code solution. Too bad that the WFP API is not available in previous windows versions.

提交回复
热议问题