Microsoft Internet Security and Acceleration Server 2000

Restricting Use of a Protocol

You may determine that there is a particular protocol that should not be used by your users. The Visual Basic code and VBScript provided here demonstrate how to create a protocol rule that prevents use of a particular protocol.

Visual Basic Code

The Visual Basic code for blocking use of a particular protocol is provided here.

Dim objFPC As New FPCLib.FPC
Dim array1 As FPCArray
Dim ProtocolRules As FPCProtocolRules
Dim ProtocolRule As FPCProtocolRule


Set array1 = objFPC.Arrays.GetContainingArray
'Get the protocol rules collection
Set ProtocolRules = array1.ArrayPolicy.ProtocolRules
'Add a rule called "Blocked"
Set ProtocolRule = ProtocolRules.Add("Blocked")
'The following six lines define the protocol rule
ProtocolRule.Action = fpcActionDeny
ProtocolRule.AppliesToMethod = fpcAppliesToAll
ProtocolRule.Description = "Emergency Protocol Blocking"
ProtocolRule.Enabled = True
ProtocolRule.ProtocolSelectionMethod = fpcSpecifiedProtocols
ProtocolRule.SpecifiedProtocols.Add "Gopher","",fpcEnterpriseScope
'Save the rule
ProtocolRule.Save

VBScript

The VBScript derived from the preceding Visual Basic code is shown here. Note the setting of the enumerated types as constants, as described in Using Enumerated Types in Scripts.

const fpcActionDeny = 1
const fpcAppliesToAll = 0
const fpcSpecifiedProtocols = 1
const fpcEnterpriseScope = 1

set objFPC = CreateObject ("FPC.Root")
Set array1 = objFPC.Arrays.GetContainingArray
Set ProtocolRules = array1.ArrayPolicy.ProtocolRules
Set ProtocolRule = ProtocolRules.Add ("Blocked")

ProtocolRule.Action = fpcActionDeny
ProtocolRule.AppliesToMethod = fpcAppliesToAll
ProtocolRule.Description = "Emergency Protocol Blocking"
ProtocolRule.Enabled = True
ProtocolRule.ProtocolSelectionMethod = fpcSpecifiedProtocols
ProtocolRule.SpecifiedProtocols.Add "Gopher","",fpcEnterpriseScope

ProtocolRule.Save