Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

297 lines
11 KiB

  1. v1.51 Copyright(c) 1998-2001, Microsoft Corporation
  2. USAGE:
  3. ipseccmd \\machinename -f FilterList -n NegotiationPolicyList -t TunnelAddr
  4. -a AuthMethodList -1s SecurityMethodList -1k Phase1RekeyAfter -1p
  5. -1f MMFilterList -1e SoftSAExpirationTime -soft -confirm
  6. [-dialup OR -lan]
  7. {-w TYPE:DOMAIN -p PolicyName:PollInterval -r RuleName -x -y -o}
  8. ipseccmd \\machinename show filters policies auth stats sas all
  9. BATCH MODE:
  10. ipseccmd -file filename
  11. File must contain regular ipseccmd commands,
  12. all these commands will be executed in one shot.
  13. ipseccmd has three mutually exclusive modes: static, dynamic, and query.
  14. The default mode is dynamic.
  15. Dynamic mode will plumb policy directly into the IPSec Services
  16. Security Policies Database. The policy will be persisted, i.e. it will stay
  17. after a reboot. The benefit of dynamic policy is that it can co-exist with
  18. DS based policy.
  19. To delete all dynamic policies, execute "ipseccmd -u" command
  20. When the tool is used in static mode,
  21. it creates or modifies stored policy. This policy can be used again and
  22. will last the lifetime of the store. Static mode is indicated by the -w
  23. flag. The flags in the {} braces are only valid for static mode. The usage
  24. for static mode is an extension of dynamic mode, so please read through
  25. the dynamic mode section.
  26. In query mode, the tool queries IPSec Security Policies Database.
  27. NOTE: references to SHA in ipseccmd are referring to the SHA1 algorithm.
  28. ------------
  29. QUERY MODE
  30. ------------
  31. The tool displays requested type of data from IPSec Security Policies Database
  32. filters - shows main mode and quick mode filters
  33. policies - shows main mode and quick mode policies
  34. auth - shows main mode authentication methods
  35. stats - shows Internet Key Exchange (IKE) and IPSec statistics
  36. sas - shows main mode and quick mode Security Associations
  37. all - shows all of the above data
  38. It is possible to combine several flags
  39. EXAMPLE: ipseccmd show filters policies
  40. ------------
  41. DYNAMIC MODE
  42. ------------
  43. Each execution of the tool sets an IPSec rule, an IKE policy,
  44. or both. When setting the IPSec policy, think of it as setting an "IP Security Rule"
  45. in the UI. So, if you need to set up a tunnel policy, you will need
  46. to execute the tool twice, once for the outbound filters and outgoing tunnel
  47. endpoint, and once for the inbound filters and incoming tunnel endpoint.
  48. OPTIONS:
  49. \\machinename sets policies on that machine. If not included, the
  50. local machine is assumed.
  51. NOTE: that if you use this it must be the first argument AND
  52. you MUST have administrative privileges on that machine.
  53. -confirm will ask you to confirm before setting policy
  54. can be abbreviated to -c
  55. *OPTIONAL, DYNAMIC MODE ONLY*
  56. The following flags deal with IPSec policy. If omitted, a default value
  57. is used where specified.
  58. -f FilterList
  59. where FilterList is one or more space separated filterspecs
  60. a filterspec is of the format:
  61. A.B.C.D/mask:port=A.B.C.D/mask:port:protocol
  62. you can also specify DEFAULT to create default response rule
  63. The Source address is always on the left of the '=' and the Destination
  64. address is always on the right.
  65. MIRRORING: If you replace the '=' with a '+' two filters will be created,
  66. one in each direction.
  67. mask and port are optional. If omitted, Any port and
  68. mask 255.255.255.255 will be used for the filter.
  69. You can replace A.B.C.D/mask with the following for
  70. special meaning:
  71. 0 means My address(es)
  72. * means Any address
  73. a DNS name (NOTE: multiple resolutions are ignored)
  74. a GUID of the local network interface in the form {12345678-1234-1234-1234-123456789ABC}
  75. GUIDs are NOT supported for static mode
  76. protocol is optional, if omitted, Any protocol is assumed. If you
  77. indicate a protocol, a port must precede it or :: must preceded it.
  78. NOTE BENE: if protocol is specified, it must be the last item in
  79. the filter spec.
  80. Examples:
  81. Machine1+Machine2::6 will filter TCP traffic between Machine1 and Machine2
  82. 172.31.0.0/255.255.0.0:80=157.0.0.0/255.0.0.0:80:TCP will filter
  83. all TCP traffic from the first subnet, port 80 to the second subnet,
  84. port 80
  85. PASSTHRU and DROP filters: By surrounding a filter specification with (),
  86. the filter will be a passthru filter. If you surround it with [], the
  87. filter will be a blocking, or drop, filter.
  88. Example: (0+128.2.1.1) will create 2 filters (it's mirrored) that will
  89. be exempted from policy.
  90. You can use the following protocol symbols: ICMP UDP RAW TCP
  91. Star notation:
  92. If you're subnet masks are along octet boundaries, then you
  93. can use the star notation to wildcard subnets.
  94. Examples:
  95. 128.*.*.* is same as 128.0.0.0/255.0.0.0
  96. 128.*.* is the same as above
  97. 128.* is the same as above
  98. 144.92.*.* is same as 144.92.0.0/255.255.0.0
  99. There is no DEFAULT, -f is required
  100. -n NegotiationPolicyList
  101. where NegotiationPolicyList is one or more space separated
  102. IPSec policies in the one of the following forms:
  103. ESP[ConfAlg,AuthAlg]RekeyPFS[Group]
  104. AH[HashAlg]
  105. AH[HashAlg]+ESP[ConfAlg,AuthAlg]
  106. where ConfAlg can be NONE, DES, or 3DES
  107. and AuthAlg can be NONE, MD5, or SHA
  108. and HashAlg is MD5 or SHA
  109. NOTE: ESP[NONE,NONE] is not a supported config
  110. NOTE: SHA refers the SHA1 hash algorithm
  111. Rekey is number of KBytes or number of seconds to rekey
  112. put K or S after the number to indicate KBytes or seconds, respectively
  113. Example: 3600S will rekey after 1 hour
  114. To use both, separate with a slash.
  115. Example: 3600S/5000K will rekey every hour and 5 MB.
  116. REKEY PARAMETERS ARE OPTIONAL
  117. PFS this is OPTIONAL, if it is present it will enable phase 2 perfect
  118. forward secrecy. You may use just P for short.
  119. It is also possible to specify which PFS Group to use:
  120. PFS1 or P1, PFS2 or P2
  121. By Default, PFS Group value will be taken from current Main Mode settings
  122. DEFAULT: ESP[3DES,SHA] ESP[3DES,MD5] ESP[DES,SHA]
  123. ESP[DES,MD5]
  124. -t tunnel address in one of the following forms:
  125. A.B.C.D
  126. DNS name
  127. DEFAULT: omission of tunnel address assumes transport mode
  128. -a AuthMethodList
  129. A list of space separated auth methods of the form:
  130. PRESHARE:"preshared key string"
  131. KERBEROS
  132. CERT:"CA Info"
  133. The strings provided to preshared key and CA info ARE case sensitive.
  134. You can abbreviate the method with the first letter, ie. P, K, or C.
  135. DEFAULT: KERBEROS
  136. -soft will allow soft associations
  137. DEFAULT: don't allow soft SAs
  138. -lan will set policy only for lan adapters
  139. -dialup will set policy only for dialup adapters
  140. *BOTH ARE OPTIONAL, if not specified, All adapters are used*
  141. DEFAULT: All adapters
  142. The following deal with IKE phase 1 policy. An easy way to remember
  143. is that all IKE phase 1 parameters are passed with a 1 in the flag.
  144. If no IKE flags are specified, the current IKE policy
  145. will be used. If there is no current IKE policy, the defaults
  146. specified below will be used.
  147. -1s SecurityMethodList
  148. where SecurityMethodList is one or more space separated SecurityMethods
  149. in the form:
  150. ConfAlg-HashAlg-GroupNum
  151. where ConfAlg can be DES or 3DES
  152. and HashAlg is MD5 or SHA
  153. and GroupNum is:
  154. 1 (Low)
  155. 2 (Med)
  156. Example: DES-SHA-1
  157. DEFAULT: 3DES-SHA-2 3DES-MD5-2 DES-SHA-1 DES-MD5-1
  158. -1p enable PFS for phase 1
  159. DEFAULT: not enabled
  160. -1k number of Quick Modes or number of seconds to rekey for phase 1
  161. put Q or S after the number to indicate Quick Modes or seconds,
  162. respectively
  163. Example: 10Q will rekey after 10 quick modes
  164. To use both, separate with a slash.
  165. Example: 10Q/3600S will rekey every hour and 10 quick modes
  166. *OPTIONAL*
  167. DEFAULT: no QM limit, 480 min lifetime
  168. -1e SoftSAExpirationTime
  169. set Soft SA expiration time attribute of the main mode policy
  170. value is specified in seconds
  171. DEFAULT: not set if Soft SA is not allowed
  172. set to 300 seconds if Soft SA is allowed
  173. -1f MMFilterList
  174. set specific main mode filters. Syntax is the same as for -f option
  175. except that you cannot specify passthru, block filters, ports and protocols
  176. DEFAULT: filters are generated automatically based on quick mode filters
  177. -----------
  178. STATIC MODE
  179. -----------
  180. Static mode uses most of the dynamic mode syntax, but adds a few flags
  181. that enable it work at a policy level as well. Remember, dynamic mode
  182. just lets you add anonymous rules to the policy agent. Static mode
  183. allows you to create named policies and named rules. It also has some
  184. functionality to modify existing policies and rules, provided they were
  185. originally created with ipseccmd.
  186. Static mode is supposed to provide most of the functionality of the IPSec UI
  187. in a command line tool, so there are references here to the UI.
  188. First, there is one change to the dynamic mode usage that static mode
  189. requires. In static mode, pass through and block filters are indicated
  190. in the NegotiationPolicyList that is specified by -n. There are three
  191. items you can pass in the NegotiationPolicyList that have special meaning:
  192. BLOCK will ignore the rest of the policies in NegotiationPolicyList and
  193. will make all of the filters blocking or drop filters.
  194. This is the same as checking the "Block" radio button
  195. in the UI
  196. PASS will ignore the rest of the policies in NegotiationPolicyList and
  197. will make all of the filters pass through filters.
  198. This is the same as checking the "Permit"
  199. radio button in the UI
  200. INPASS will plumb any inbound filters as pass through.
  201. This is the same as checking the "Allow unsecured communication,
  202. but always respond using IPSEC" check box in the UI
  203. Static Mode flags:
  204. All flags are REQUIRED unless otherwise indicated.
  205. -w Write the policy to storage indicated by TYPE:LOCATION
  206. TYPE can be either REG for registry or DS for Directory Storage
  207. if \\machinename was specified and TYPE is REG, will be written
  208. to the remote machine's registry
  209. DOMAIN for the DS case only. Indicates the domain name of the
  210. DS to write to. If omitted, use the domain the local machine is in.
  211. OPTIONAL
  212. -p PolicyName:PollInterval
  213. Name the policy with this string. If a policy with this name is
  214. already in storage, this rule will be added to the policy.
  215. Otherwise a new policy will be created. If PollInterval is specified,
  216. the polling interval for the policy will be set.
  217. -r RuleName
  218. Name the rule with this string. If a rule with that name already exists,
  219. that rule is modified to reflect the information supplied to ipseccmd.
  220. For example, if only -f is specified and the rule exists,
  221. only the filters of that rule will be replaced.
  222. -x will set the policy active in the LOCAL registry case OPTIONAL
  223. -y will set the policy inactive in the LOCAL registry case OPTIONAL
  224. -o will delete the policy specified by -p OPTIONAL
  225. (NOTE: this will delete all aspects of the specified policy
  226. don't use if you have other policies pointing to the objects in that policy)
  227. The command completed successfully.