Answered by:
Adding SSL Port on TMG

Question
-
I have would like to add ssl port 7201 on TMG which is causing the error below.
Error Code: 502 Proxy Error. The specified Secure Sockets Layer (SSL) port is not allowed. ISA server is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests. (12204)
i have tried this script but its giving and error, do i need to key in the ports on the script given here ?
Someone can assist with a working script.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright (c) Microsoft Corporation. All rights reserved.
' THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
' RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE
' USER. USE AND REDISTRIBUTION OF THIS CODE, WITH OR WITHOUT MODIFICATION, IS
' HEREBY PERMITTED.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This script creates a new tunnel port range containing a single user-specified
' port to allow clients to send requests, for example, SSL requests, to that
' port.
' This script can be run from a command prompt by entering the
' following command:
' CScript AddTPRange.vbs RangeName PortNumber
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
' Define the constants needed.
Const Error_TypeMismatch = &HD
Const Error_AlreadyExists = &H800700B7
Const Error_OutOfRange = &H80070057
Main(WScript.Arguments)
Sub Main(args)
If(args.Count <> 2) Then
Usage()
Else
AddTPRange args(0), args(1)
End If
End Sub
Sub AddTPRange(newRangeName, newTunnelPort)
' Create the root object.
Dim root ' The FPCLib.FPC root object
Set root = CreateObject("FPC.Root")
'Declare the other objects needed.
Dim isaArray ' An ISA Server array object
Dim tpRanges ' An FPCTunnelPortRanges collection
Dim newRange ' An FPCTunnelPortRange object
Dim port ' An Integer
' Get a reference to the array and to
' the collection of tunnel port ranges.
Set isaArray = root.GetContainingArray
Set tpRanges = isaArray.ArrayPolicy.WebProxy.TunnelPortRanges
' Create a new tunnel port range.
On Error Resume Next
port = CDbl(newTunnelPort)
If Err.Number = Error_TypeMismatch Then
WScript.Echo "A number must be entered for the port to be included."
WScript.Quit
End If
Err.Clear
Set newRange = tpRanges.AddRange(newRangeName, port, port)
If Err.Number = Error_AlreadyExists Then
WScript.Echo "A port range with the name specified already exists."
WScript.Quit
ElseIf Err.Number = Error_OutOfRange Then
WScript.Echo "The range of permissible ports is from 1 through 65535."
WScript.Quit
End If
On Error GoTo 0
' Save the changes to the collection of tunnel port ranges
' with fResetRequiredServices set to True to restart the Firewall service.
tpRanges.Save True
WScript.Echo "Done!"
End Sub
Sub Usage()
WScript.Echo "Usage:" & VbCrLf _
& " " & WScript.ScriptName & " RangeName TunnelPort" & VbCrLf _
& "" & VbCrLf _
& " RangeName - Name of the tunnel port range to be added" & VbCrLf _
& " TunnelPort - Port to be included in the new tunnel port range"
WScript.Quit
End Sub
Meshax
Monday, September 17, 2012 8:09 AM
Answers
-
Hi,
Please follow below steps:1. Save below scripts to "AddSSLPort.vbs" ,如: <d:\AddSSLPort.vbs>
Dim root
Dim tpRanges
Dim newRange
Set root = CreateObject("FPC.Root")
Set tpRanges = root.GetContainingArray.ArrayPolicy.WebProxy.TunnelPortRanges
set newRange = tpRanges.AddRange("SSL 7201", 7201, 7201)
tpRanges.Save
2. Open a CMD windows(run as administrator)- > cscript d:\AddSSLPort.vbs
3. net stop fwsrv && net start fwsrvRegards,
James
- Proposed as answer by JamesYi Monday, September 17, 2012 9:27 AM
- Marked as answer by Meshack KE Monday, September 17, 2012 9:38 AM
Monday, September 17, 2012 9:27 AM -
You are not adding the parameters as I mentioned above.
On a administrative command prompt:
cscript [scriptname] "SSL7201" 7201
No need to modify the script. Doing so, you risk to alter the script so that it does not work.
Restart the Firewall service after the script completes.
Hth, Anders Janson Enfo Zipper
- Proposed as answer by Anders Janson Monday, September 17, 2012 9:31 AM
- Marked as answer by Meshack KE Monday, September 17, 2012 9:39 AM
Monday, September 17, 2012 9:31 AM
All replies
-
What kind of error?
Do note that you need to specify parameters when running the script.
CScript AddTPRange.vbs "SSL7201" 7201
where SSL7201 is just a name for the range.
For ref, see http://technet.microsoft.com/en-us/library/cc302450.aspx#ScriptListingAddTPRange.vbs
(scroll up for the syntax of using the script)
Next action is to create a custom protocol definition and add it to an access rule.
Hth, Anders Janson Enfo Zipper
Monday, September 17, 2012 8:49 AM -
Thanks Anders for your support,
do i only need to edit this portion of the script as below.
' This script can be run from a command prompt by entering the
' following command:
' CScript AddTPRange.vbs AIRTEL 7201
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option ExplicitIs that all or i need to enter the port @ some other parts on the script?
Meshax
Monday, September 17, 2012 8:55 AM -
No. You do not edit the script.
You pass the necessary information as parameters when you run the script.
Hth, Anders Janson Enfo Zipper
Monday, September 17, 2012 8:58 AM -
Hi Anderson,
This what i've done, i pasted the script as it is on notepad and named it
"CScript AddTPRange.vbs"
then when i run it direct on elevated cmd i get the error below.Note am running TMG on server 2008 R2
Meshax
Monday, September 17, 2012 9:09 AM -
Hi,
Please follow below steps:1. Save below scripts to "AddSSLPort.vbs" ,如: <d:\AddSSLPort.vbs>
Dim root
Dim tpRanges
Dim newRange
Set root = CreateObject("FPC.Root")
Set tpRanges = root.GetContainingArray.ArrayPolicy.WebProxy.TunnelPortRanges
set newRange = tpRanges.AddRange("SSL 7201", 7201, 7201)
tpRanges.Save
2. Open a CMD windows(run as administrator)- > cscript d:\AddSSLPort.vbs
3. net stop fwsrv && net start fwsrvRegards,
James
- Proposed as answer by JamesYi Monday, September 17, 2012 9:27 AM
- Marked as answer by Meshack KE Monday, September 17, 2012 9:38 AM
Monday, September 17, 2012 9:27 AM -
You are not adding the parameters as I mentioned above.
On a administrative command prompt:
cscript [scriptname] "SSL7201" 7201
No need to modify the script. Doing so, you risk to alter the script so that it does not work.
Restart the Firewall service after the script completes.
Hth, Anders Janson Enfo Zipper
- Proposed as answer by Anders Janson Monday, September 17, 2012 9:31 AM
- Marked as answer by Meshack KE Monday, September 17, 2012 9:39 AM
Monday, September 17, 2012 9:31 AM -
Thanks a lot JamesYI,
The command worked am so happy.
Many Thanks Man.
Meshax
Monday, September 17, 2012 9:40 AM -
Thanks Anders,
Now i get how the thing works next time i'll try that code, i've tried the one given by JamesYi and it worked.
I appreciate you support Anders. Blessings Man.
Meshax
- Edited by Meshack KE Monday, September 17, 2012 9:42 AM
Monday, September 17, 2012 9:42 AM -
This short script works fine! Thanks JamesYi!!Monday, September 10, 2018 7:47 PM