Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


October 2006

Netsh Adds Security to IPsec

Encrypt and digitally sign your communications from the command line
RSS
Subscribe to Windows IT Pro | See More Security Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

In "The Potent Union of Netsh and IPsec" (September 2006, InstantDoc ID 92767), I walked you through the process of using a command-line IPsec setup to block any incoming or outgoing traffic on port 80. Blocking and permitting traffic are two of the simplest uses of IPsec—but they're not the only ones. IPsec can also digitally sign or encrypt traffic, and signing and encrypting require a bit more information. So, this month, let's modify last month's task: Let's create an IPsec rule that allows a Web server to offer traffic on TCP port 80, but only if it's encrypted with Triple DES (3DES) and signed with the Secure Hash Algorithm-1 (SHA-1).

Creating the Policy
As we did last month, we'll create an IPsec policy that applies to a Web server or group of Web servers. The policy will consist of just one rule, which must have a filter list and a filter action (as well as an authentication method, but we'll cover that later). The filter action will activate the rule if data arrives at a particular system through TCP port 80 or if data leaves from that system's TCP port 80 to anywhere. Should the filter list be satisfied, the action that the rule will take is to require 3DES encryption and SHA-1 signing.

With Windows Server 2003 commands, we'll create the policy, then the filter list, then the filter action, and finally the IPsec rule. Here's how to render the policy:

netsh ipsec static add policy name="Require encryption
 on Web" description="Force any Web visitors to 
 encrypt communications and Kerberos to
 authenticate" activatedefaultrule=no 

All our IPsec-related commands begin with Netsh Ipsec Static. The Add Policy option creates a policy, and the command proceeds to name and describe the policy.

Creating the Filter and Filter List
The filter we want to build will tell IP to engage the specified rule if data enters or leaves at TCP port 80; therefore, the filter recalls the one we created last month:

netsh ipsec static add filter filter-list="80 in or
  out" srcaddr=any srcport=0 
  dstaddr=me dstport=80 
  protocol=tcp mirrored=yes

In situations involving only one filter, Netsh lets you create both the filter list and the filter by simply naming the filter list after the add filter parameter. When Netsh tries to add this filter to a filter list named "80 in or out" and can't find a filter list by that name, it creates that filter list. The command says that this rule applies when the data originates from anywhere (srcaddr=any) and any port (srcport=0), and is destined for the system to which this policy is applied (dstaddr=me) on TCP port 80 (dstport=80 protocol=tcp). The mirrored=yes parameter specifies that two filters are actually in place: one from anywhere to this system on TCP port 80, and one from this system on TCP port 80 to anywhere.

Creating the Filter Action
Instead of last month's action, which was to block the transmission if the filter is satisfied, this month's action is to encrypt and sign the transmission if the filter is satisfied. That code looks like

netsh ipsec static add filteraction name="force encryption"
  esc="Forces communications using encryption"
  action=negotiate qmsecmethods="ESP[3DES,
  SHA1]" inpass=no soft=no qmpfs=yes 

The Add Filteraction option adds a filter action, and the command proceeds to name and describe the action. Note the inclusion of the action=negotiate parameter, rather than action=block or action=permit. You use the action=negotiate parameter whether you want digital signing or encryption and signing. But which shall it be?

The next parameter, qmsecmethods="ESP[3DES, SHA1]", answers that question. This parameter has many possible parameters, but essentially you specify either ESP[] or AH[] and enter your preferred encryption or hashing algorithm inside the square brackets. For example, "AH[SHA1]" will use SHA-1 to digitally sign traffic. ESP requires the names of two cryptographic algorithms—for encryption and hashing—because it both encrypts and signs traffic. Thus, "ESP[3DES,SHA1]" encrypts with triple 3DES and signs with SHA-1.

   Previous  [1]  2  Next 


Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Windows 7 Sets Sales Record

Microsoft CEO Steve Ballmer described Windows 7's first ten days of sales as "fantastic" while in Japan yesterday. ...


Related Articles Use Netsh to Easily Change IP Addresses

Security Whitepapers Reducing the Costs and Risks of Branch Office Data Protection

Solving Desktop Management Challenges in Healthcare

Solving Desktop Management Challenges in Education

Related Events WinConnections and Microsoft® Exchange Connections

Deep Dive into Windows Server 2008 R2 presented by John Savill

Managing IT Across Multiple Locations

Check out our list of Free Email Newsletters!

Security eBooks Spam Fighting and Email Security for the 21st Century

Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

Related Security Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement