forked from cedrozor/myrtille
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed the RDS role, application server role and file storage servic…
…e prerequisites removed the creation of an rdp user ("Myrtille") on install (it was used for tests but is no longer relevant) removed the configuration on the localhost rdp server added automatic configuration of the firewall (websockets ports) updated readme and documentation
- Loading branch information
Showing
10 changed files
with
609 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using NetFwTypeLib; | ||
|
||
namespace Myrtille.Helpers | ||
{ | ||
public static class FirewallHelper | ||
{ | ||
public static void OpenFirewallPort(int port, string description) | ||
{ | ||
try | ||
{ | ||
// firewall manager | ||
var TicfMgr = Type.GetTypeFromProgID("HNetCfg.FwMgr"); | ||
var icfMgr = (INetFwMgr)Activator.CreateInstance(TicfMgr); | ||
|
||
// open port | ||
var TportClass = Type.GetTypeFromProgID("HNetCfg.FWOpenPort"); | ||
var portClass = (INetFwOpenPort)Activator.CreateInstance(TportClass); | ||
|
||
// current profile | ||
var profile = icfMgr.LocalPolicy.CurrentProfile; | ||
|
||
// set properties | ||
portClass.Scope = NET_FW_SCOPE_.NET_FW_SCOPE_ALL; | ||
portClass.Protocol = NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP; | ||
portClass.Port = port; | ||
portClass.Name = description; | ||
portClass.Enabled = true; | ||
|
||
// add the port to the ICF permissions list | ||
profile.GloballyOpenPorts.Add(portClass); | ||
} | ||
catch (Exception exc) | ||
{ | ||
Trace.TraceError("Failed to open firewall port ({0})", exc); | ||
} | ||
} | ||
|
||
public static void CloseFirewallPort(int port) | ||
{ | ||
try | ||
{ | ||
// firewall manager | ||
var TicfMgr = Type.GetTypeFromProgID("HNetCfg.FwMgr"); | ||
var icfMgr = (INetFwMgr)Activator.CreateInstance(TicfMgr); | ||
|
||
// current profile | ||
var profile = icfMgr.LocalPolicy.CurrentProfile; | ||
|
||
// add the port to the ICF permissions list | ||
profile.GloballyOpenPorts.Remove(port, NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP); | ||
} | ||
catch (Exception exc) | ||
{ | ||
Trace.TraceError("Failed to remove firewall port ({0})", exc); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
using System.Xml; | ||
using System.Xml.XPath; | ||
|
||
namespace Myrtille.Helpers | ||
{ | ||
public static class XmlTools | ||
{ | ||
public static XmlNode GetNode( | ||
XmlNode parentNode, | ||
string name) | ||
{ | ||
XmlNode theNode = null; | ||
|
||
if ((parentNode != null) && | ||
(parentNode.ChildNodes != null) && | ||
(parentNode.ChildNodes.Count > 0)) | ||
{ | ||
foreach (XmlNode node in parentNode.ChildNodes) | ||
{ | ||
if (node.Name.ToUpper().Equals(name.ToUpper())) | ||
{ | ||
theNode = node; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return theNode; | ||
} | ||
|
||
public static XmlNode GetNode( | ||
XPathNavigator navigator, | ||
string path) | ||
{ | ||
XmlNode node = null; | ||
|
||
var iterator = navigator.Select(path); | ||
if (iterator.Count == 1) | ||
{ | ||
iterator.MoveNext(); | ||
node = ((IHasXmlNode)iterator.Current).GetNode(); | ||
} | ||
|
||
return node; | ||
} | ||
|
||
public static string ReadConfigKey( | ||
XmlNode parentNode, | ||
string key) | ||
{ | ||
if ((parentNode != null) && | ||
(parentNode.ChildNodes != null) && | ||
(parentNode.ChildNodes.Count > 0)) | ||
{ | ||
XmlNode theNode = null; | ||
|
||
foreach (XmlNode node in parentNode.ChildNodes) | ||
{ | ||
if ((node.Name.ToUpper().Equals("ADD")) && | ||
(node.Attributes != null) && | ||
(node.Attributes["key"] != null) && | ||
(node.Attributes["key"].Value.ToUpper().Equals(key.ToUpper()))) | ||
{ | ||
theNode = node; | ||
break; | ||
} | ||
} | ||
|
||
if ((theNode != null) && | ||
(theNode.Attributes != null) && | ||
(theNode.Attributes["value"] != null)) | ||
{ | ||
var theNodeValue = theNode.Attributes["value"]; | ||
return theNodeValue.Value; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public static void WriteConfigKey( | ||
XmlNode parentNode, | ||
string key, | ||
string value) | ||
{ | ||
if ((parentNode != null) && | ||
(parentNode.ChildNodes != null) && | ||
(parentNode.ChildNodes.Count > 0)) | ||
{ | ||
XmlNode theNode = null; | ||
|
||
foreach (XmlNode node in parentNode.ChildNodes) | ||
{ | ||
if ((node.Name.ToUpper().Equals("ADD")) && | ||
(node.Attributes != null) && | ||
(node.Attributes["key"] != null) && | ||
(node.Attributes["key"].Value.ToUpper().Equals(key.ToUpper()))) | ||
{ | ||
theNode = node; | ||
break; | ||
} | ||
} | ||
|
||
if ((theNode != null) && | ||
(theNode.Attributes != null) && | ||
(theNode.Attributes["value"] != null)) | ||
{ | ||
var theNodeValue = theNode.Attributes["value"]; | ||
theNodeValue.Value = value; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.