简体   繁体   中英

How can I block a port using Wix?

I've got an installer that installs the oracle XE database. Recently, I've been asked to close/block port 1521 programmatically during installation. My app is installed using Wix 3.8. I've seen the Wix Firewall Extension, but I don't see a way to specify the action (ie, "block"). I want to block all incoming traffic on that port, effectively shutting down the listener.

Is there another way to do this or am I missing something with Wix?

In case the Wix extension doesn't support this (which would surprise me), perhaps you can try this VBScript.

Note that I didn't write this script, nor have I used it. Use with caution and at your own risk . Test on a virtual machine.

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
Set colPorts = objPolicy.GloballyOpenPorts

Set objPort = colPorts.Item(9999,6)
objPort.Enabled = FALSE

Similar code, but using C#: Automating Windows Firewall with

Update: We weren't able to get WiX installer to do what we wanted, so we wrote our own custom process (not a CustomAction) that runs post install.

The 3 mains steps were:

  1. Configure the sqlnet.ora (\\database\\app\\oracle\\product\\\\server\\NETWORK\\ADMIN\\sqlnet.ora) file to only allow connections from the localhost by appending the following lines:
 > TCP.VALIDNODE_CHECKING=YES > TCP.INVITED_NODES = 127.0.0.1 
  1. Set up the TNSListener for local access only by running the following sqlplus commands:
 > exec DBMS_XDB.SETLISTENERLOCALACCESS(true); > SHUTDOWN IMMEDIATE > STARTUP 
  1. Stop the OracleXETNSListener service and disable it (custom VB.net code)

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM