Sign in to follow this  

Is there a Windows firewall, which I can access the whitelist with C#?

This topic is 2814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Without going into detail, I need a Windows firewall, which would allow a local C# application to change allowed incoming remote IPs (whitelist). Is there any thing available (hopefully free)? Thanks

Share this post


Link to post
Share on other sites
One last question, is it possible to just run the following command line within the application?:

netsh firewall set portopening protocol = ALL port = 7239 name = "Port7239" mode = ENABLED scope = CUSTOM addresses = [IP addresses separated by commas]


Though, the application would need administrative rights..

Share this post


Link to post
Share on other sites
You could create a Windows Service that runs with admin or local system credentials and can call netsh (or do anything else on the system). Combine it with the fact that the service can listen to requests from any application on the machine (or the network, if you so desire, but this is poison for security).

This way, you only need admin credentials to install the service, but not necessarily afterwards.

If you go this route, I recommend using WCF (Windows Communication Foundation) for the interprocess communication. It is very easy to establish protocol-independent links with it and you don't have to write any transport logic yourself.

There is also an API available for Windows Firewall, should you want to program it directly instead of via netsh.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nik02
You could create a Windows Service that runs with admin or local system credentials and can call netsh (or do anything else on the system). Combine it with the fact that the service can listen to requests from any application on the machine (or the network, if you so desire, but this is poison for security).

This way, you only need admin credentials to install the service, but not necessarily afterwards.

If you go this route, I recommend using WCF (Windows Communication Foundation) for the interprocess communication. It is very easy to establish protocol-independent links with it and you don't have to write any transport logic yourself.

There is also an API available for Windows Firewall, should you want to program it directly instead of via netsh.


Excellent. Thank you.

Share this post


Link to post
Share on other sites

This topic is 2814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this