Supported Intel AMT Features > System Defense > Using the System Defense API > Creating and Applying System Defense Policies
CollapseAll image

Creating and Applying System Defense Policies

These are the necessary steps when using the HLAPI to create a System Defense policy and apply it to an Intel AMT device.

Each step includes a C# code sample.

Step #1: Create the required user defined filters

//Example IP filter

IPFilter ipFilter = FilterFactory.CreateIPFilter("ipFilter", FilterType.Drop, FilterDirection.Both, true, IPVersion.IPv4);

 

//Example Ethernet filter

EthernetFilter etherFilter = FilterFactory.CreateEthernetFilter("etherFilter", FilterType.StatisticsAndDrop, FilterDirection.Incoming, false, (ushort)EtherTypes.ETH_TYPE_RARP);

 

//Example TCP filter

TCPFilter tcpFilter = FilterFactory.CreateTCPFilter

  ("tcpFilter", FilterType.Pass, FilterDirection.Incoming,true,

  IPVersion.IPv4, HeaderIPAddress.Destination,

  new IPAddress(newbyte[] { 10, 0, 0, 2 }),

  new IPAddress(newbyte[] { 255, 255, 255, 0 }),

  HeaderPortAddresses.Both, 80, 90,TCPFlag.ACK);

 

//Example UDP filter

UDPFilter udpFilter = FilterFactory.CreateUDPFilter("udpFilter", FilterType.StatisticsAndPass, FilterDirection.Outgoing, true, IPVersion.IPv4, HeaderPortAddresses.Both, 80, 92);

 

//Example Protocol filter

ProtocolFilter protocolFilter = FilterFactory.CreateProtocolFilter(ProtocolFilter", 2500, FilterDirection.Incoming, false, IPVersion.IPv6, (byte)IPProtocols.IPV6);

 

 Note:

For more information, see:

•   Filter Class Diagram

•   Creating User Defined Filters

 

Step #2: Make a collection of user defined filters

Collection<UserFilter> filtersCollection = new Collection<UserFilter>();

filtersCollection.Add(ipFilter);

filtersCollection.Add(etherFilter);

filtersCollection.Add(tcpFilter);

filtersCollection.Add(udpFilter);

filtersCollection.Add(protocolFilter);

 

Step #3: Create a System Defense Policy (with a filter collection)

Policy policy1 = new Policy("myPolicy1", 10, 150, filtersCollection);

 

 Note:

The Policy constructor is overloaded with two options. This example uses the option  that creates a policy without system filters. For information about the second option, see Creating System Filters.

 

Step #4: Make a collection of System Defense Policies

Collection<Policy> policiesCollection = new Collection<Policy>();

policiesCollection.Add(policy1);

policiesCollection.Add(policy2);

 

Step #5: Connect to the Intel AMT device

Step #6: Apply the collection of policies to the Intel AMT device

amt.SystemDefense.PolicyStore.CreateOrUpdatePolicies(policiesCollection);

 

 Note:

The CreateOrUpdatePolicies method adds the policies in the collection to the Intel AMT device in this way (according to the policy names in the collection):

•   If a policy does NOT exist on the Intel AMT device it is added.

•   If a policy already exists on the Intel AMT device it is updated.

•   All other existing policies on the Intel AMT device are left as they are.

 

Step #7: Enable a policy on the Intel AMT device

This step is required to enable a policy on the Intel AMT device.

NetworkInterface supportedInterface = amt.SystemDefense.GetSupportedInterface();

amt.SystemDefense.PolicyStore.EnableUserPolicy("myPolicy1", supportedInterface);

 

See Also:

•   System Defense Policies

•   System Defense Filters

Copyright © 2006-2022, Intel Corporation. All rights reserved.