Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying the Group name when adding a FirewallException #1533

Closed
Germs2004 opened this issue May 14, 2024 · 2 comments
Closed

Allow specifying the Group name when adding a FirewallException #1533

Germs2004 opened this issue May 14, 2024 · 2 comments

Comments

@Germs2004
Copy link

Please add a feature to WixSharp that allows us to specify the "Group" name when adding a new FirewallException rule. It appears that WixToolkit has a property named "Grouping" for this, though I haven't tested it.

I suggest adding a new "Group" property that works like this:

FirewallException fwAllowRule1 = new()
{
    Feature = featureFirewallRules,
    Scope = FirewallExceptionScope.any,
    Name = "Contoso Web Server",
    Description = "This is my new rule to allow Contoso Web Server to connect.",
    Group = "Contoso"
};
FirewallException fwAllowRule2 = new()
{
    Feature = featureFirewallRules,
    Scope = FirewallExceptionScope.any,
    Name = "Contoso Data Server",
    Description = "This is my new rule to allow Contoso Data Server to connect.",
    Group = "Contoso"
};

screenshot of the Windows Firewall table showing the Group column that I'd like to be able to edit:
image

As a workaround, I think the only way to do this currently is to not use the FirewallException object, but call a Powershell script instead, which supports specifying the Group. Here is a Powershell command for that:
New-NetFirewallRule -DisplayName "Contoso Web Server" -Direction Inbound -Program "C:\Contoso\webserver.exe" -Action Allow -Group "Contoso"

@oleg-shilo
Copy link
Owner

WixSharp actually supports specifying WiX attributes that are not directly mapped to the WixSharp entities properties. Thus you can easily achieve the desired result by using a generic property AtributesDefinition:

image
image

Note, this attribute is only available in WiX5 (not WiX4) so if you do not have it installed globally you might need to do it from the code for your specific project:

WixTools.SetWixVersion(Environment.CurrentDirectory, "5.0.0");

var project = new Project("MyProduct", . . . 

But I added the dedicated property so it will be available in the very next release.

@Germs2004
Copy link
Author

Excellent, thank you for the perfect workaround and for adding the new property. AttributesDefinition worked perfectly. (and thanks for WixSharp, because Wix is terribly difficult without it)

oleg-shilo added a commit that referenced this issue May 27, 2024
- Added file signing functionality to project build process (`Project.SignAllFiles`).
- Added WiX5 new attributes (known at the time) for `FirewallException`'
- Issue #1533: Allow specifying the Group name when adding a FirewallException
- WixSharp.Core: Added EmbeddedUI sample solution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants