{"id":108,"date":"2014-01-28T13:47:10","date_gmt":"2014-01-28T12:47:10","guid":{"rendered":"http:\/\/www.riedmann.it\/blog\/?p=108"},"modified":"2014-01-28T13:47:10","modified_gmt":"2014-01-28T12:47:10","slug":"open-firewall-from-your-application","status":"publish","type":"post","link":"https:\/\/blog.riedmann.it\/?p=108","title":{"rendered":"Open firewall from your application"},"content":{"rendered":"<p>Since I had added SSL support to the SMTP sending from my application using stunnel, some users don&#8217;t opened up the firewall when requested from the operating system (from Windows Vista up).<\/p>\n<p>Therefore I needed to open up the firewall directly from the application.<\/p>\n<p>Since I don&#8217;t like to have run the application with elevated rights, I decided to make this change from an external app to spawn from my own application.<\/p>\n<p>It is very simply to add a firewall rule using the netsh command:<\/p>\n<blockquote><p>netsh advfirewall firewall add rule name=&#8221;stunnel&#8221; dir=in action=allow program=&#8221;c:\\tools\\stunnel.exe&#8221; enable=yes profile=any<\/p><\/blockquote>\n<p>(where the stunnel.exe path should be adapted to your own settings).<\/p>\n<p>The problem now was that this command needed to be run with elevated rights, and there is no option to do so.<br \/>\nAfter a quick search on the internet, I found <a href=\"http:\/\/www.wintellect.com\/blogs\/jrobbins\/elevate-a-process-at-the-command-line-in-vista\" title=\"elevate.exe\" target=\"_blank\">elevate.exe<\/a> &#8211; a small .NET executable that does what I need: launch a program with elevated rights.<\/p>\n<p>So it was easy: launch elevate.exe (downloadable with sources) and pass as command line the call to netsh.exe.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since I had added SSL support to the SMTP sending from my application using stunnel, some users don&#8217;t opened up the firewall when requested from the operating system (from Windows Vista up). Therefore I needed to open up the firewall directly from the application. Since I don&#8217;t like to have run the application with elevated [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-visual-objects-programming","category-vulcan-net-programming"],"_links":{"self":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=108"}],"version-history":[{"count":1,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":109,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/108\/revisions\/109"}],"wp:attachment":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}