gemcneill Posted December 6, 2009 Share Posted December 6, 2009 Hey guys I want to enable windows firewall to help protect my server but I already have game servers running on my boxes. Is there a script that can enable it for all server running currently? I found this script that I intend to use for new servers Add the following line as the Install script: netsh firewall add allowedprogram "%gameserverexe%" %serverip%_%serverport% ENABLE Add the following line as the Uninstall script: netsh firewall del allowedprogram "%gameserverexe%" So I guess the script to allow the current servers on the box would be some type of loop and just pull the info from each existing server running and do the add script until all of them were added. I know that tcadmin has this info, but I am not sure how to pull it. This would be a great help. I was not sure if this should go in the script forums or the dedicated server forums since it crosses into both. If it needs to be moved please mod, move it. Thanks in advance. George Link to comment Share on other sites More sharing options...
lpgservers Posted December 6, 2009 Share Posted December 6, 2009 The first script that you mention above wouldn't do much for you to tell you the truth. You'd still have to open all the UDP/TCP ports for the games and there are generally quite a few. You might want to compile a list of the ports the games use by either looking at the Admin Home > System Settings > Supported Games and then going through your game list to see the different ports listed there. Even beyond that, some games require authorization from outside connections and those would have to be allowed as well. My recommendation is to try this on an empty server first and then go through game by game making your list so as you don't upset your clientele. If you don't have another server(sounds like you don't) then your best bet is to go do quite a bit of legwork beforehand. You should be able to find all the ports that games make or receive connections from in the game logs themselves as well. May I ask why you are setting up a firewall now instead of either before or not doing it all? Link to comment Share on other sites More sharing options...
DougK94 Posted December 6, 2009 Share Posted December 6, 2009 What he posted WILL work for the windows firewall as it will open any ports used by the game's exe when the server is created. However what you are saying about finding all the UDP/TCP ports is correct if you are using a firewall other than the built in windows firewall. Link to comment Share on other sites More sharing options...
lpgservers Posted December 6, 2009 Share Posted December 6, 2009 Thanks for the heads up Doug, I didn't realize that would work with Windows Firewall. Link to comment Share on other sites More sharing options...
gemcneill Posted December 6, 2009 Author Share Posted December 6, 2009 This box did not have a firewall enabled before we started installing game servers to it. I know the script will work for all future game servers, but I want to have a script that would work for all current game servers instead of having to either reinstall each game server or configure each rule for each server manually. Is there a way to run the script on the existing game servers with out reinstalling them? George Link to comment Share on other sites More sharing options...
dimitrifrom31 Posted December 6, 2009 Share Posted December 6, 2009 This box did not have a firewall enabled before we started installing game servers to it. I know the script will work for all future game servers, but I want to have a script that would work for all current game servers instead of having to either reinstall each game server or configure each rule for each server manually. Is there a way to run the script on the existing game servers with out reinstalling them? George add the install script in every game config you have on ur TCA. Then log on by RDP on each machine you have running, go to your TCA install > monitor and execute the TCAdminScripting.exe finally create a new txt file somewhere (desktop is fine), rename it so runinstallscripts.tcascript, edit it with note pad and copy paste the following as content : <tcascript> <language name="VB" /> <waitForUserAction value="true"/> <scriptCode><![CDATA[ Imports System Class ExecuteScript Public Shared Sub Main() Dim services() As TCAdminSDK.Objects.Service = TCAdminSDK.Objects.Service.GetServicesByServerId(TCAdminSDK.Info.GetThisServerId()) If Not services Is Nothing Then For Each service As TCAdminSDK.Objects.Service In services Try Dim game As New TCAdminSDK.Objects.Game game.GameID = service.GameId game.Find() Dim script As String = game.InstallScript() Dim user As New TCAdminSDK.Objects.User(service.UserID) 'Load dynamic values Dim DynamicValues As TCAdminSDK.Remote.Plugins.GSAutomation.GameServerDynamicValues With DynamicValues .GameName = game.Name .GameServerShortName = game.ShortName .ServerIP = service.ServerIP .ServerPort = service.ServerPort .QueryPort = service.ServerQueryPort .RCONPort = service.ServerRCONPort .CustomPort1 = service.CustomPort1 .CustomPort2 = service.CustomPort2 .CustomPort3 = service.CustomPort3 .CustomPort4 = service.CustomPort4 .CustomPort5 = service.CustomPort5 .Slots = service.Slots .HostName = String.Empty .RCONPassword = String.Empty .PrivatePassword = String.Empty .IsPrivate = service.Private .UserFilesPath = service.UserFilePath .GameFilesPath = service.AutomationFilesPath .OwnerUserID = service.UserID .OwnerName = user.FullName .OwnerPassword = TCAdminBase.Encryption.DecryptString128Bit(user.Password) .PrimaryServiceID = service.PrimaryServiceID .Application = service.Application .GameKey = service.GameKey End With Dim servicescript As String = TCAdminSDK.Remote.Plugins.GSAutomation.ReplaceGameServerValues(script, DynamicValues) Dim server as new TCAdminSDK.Objects.Server server.ServerId = service.ServerID server.Find() Console.WriteLine("Executing script on server {0}:", server.DisplayName) Console.WriteLine(servicescript) Dim su As TCAdminBase.Plugins.IGenericPlugIn = TCAdminSDK.Remote.InstanceCreator.GetPluginFromServer(service.ServerID, "TCAdminMonitor.StandardPlugins.RemoteServers.ServerUtilities") Dim exitcode As Integer = su.Execute(New Object() {"ExecuteScript", service.WorkingDirectory, servicescript}) Console.WriteLine("Executed script on {0} with exit code {1}", service.UniqueDisplayNameWithOwner, exitcode) Catch ex As Exception Console.WriteLine("-------------------------") Console.WriteLine("Error executing script on {0}: {1}", service.UniqueDisplayNameWithOwner, ex.ToString()) Console.WriteLine("-------------------------") End Try Next End If Console.WriteLine("Finished.") End Sub End Class ]]></scriptCode> </tcascript> then execute it, it will run the install scripts for each game server installed on the machine (even the "disabled" ones). Link to comment Share on other sites More sharing options...
Tyger0001 Posted January 7, 2010 Share Posted January 7, 2010 Hey, dimitrifrom31 I can somewhat understand how to install this script. Is there anyway you can give me a detailed breakdown on "How to install"? I must apologies, if i'm asking for a little too much; Because, scripting i'm still a new to. Thanks in advance Link to comment Share on other sites More sharing options...
dimitrifrom31 Posted January 7, 2010 Share Posted January 7, 2010 Hey, dimitrifrom31 I can somewhat understand how to install this script. Is there anyway you can give me a detailed breakdown on "How to install"? I must apologies, if i'm asking for a little too much; Because, scripting i'm still a new to. Thanks in advance theres nothing to install, just create a new txt file and rename it to whatever.tcascript then copy paste contents and double click it to execute. If you didnt make tcascript associations yet go to your tca install path and execute tcascripting.exe before double clicking the whatever.tcascript file Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.