Question

We are using Coldfusion 9 on Windows Server 2003. We are testing a "failover" on some code that interacts with LDAP through CFLDAP and LDAPS through Java (for password changes).

Essentially we want to have a list of LDAP server IPS and switch to a new server when a connection failure occurs.

Is there a quick way to block outbound connections to an IP from an OS level to mimic an LDAP server outage without actually disconnecting it from the network or shutting it off?

Was it helpful?

Solution

Add the IP that you want to appear as offline to /etc/hosts as pointing to 127.0.0.1

OTHER TIPS

ColdFusion doesn't have anything built in to facilitate this. After some Googling, I think @Adam Tuttle's solution is probably the best bet for Windows boxes, however it appears you can also use the Windows Firewall to achieve this effect. On *nix boxes looks like the "iptables" command can stop outbound traffic.

Sniffy allows you to block outgoing network connections in your Java applications (Coldfusion is based on Java) - it will throw a ConnectException whenever you try to establish a new connection to restricted host.

Just add -javaagent:sniffy.jar=5559 to your JVM arguments and point your browser to localhost:5559 - it will open a web page with all discovered connections to downstream systems and controls to disable certain connections.

Sniffy connections console

If your application is web-based, you can even do it directly from your application opened in browser - see a demo here: http://demo.sniffy.io/owners?lastName=

Click on a widget in bottom-right corner, select Network Connections tab, disable and connection to localhost:8967 (database) and reload a page to see it in action.

Disclaimer: I'm the author of Sniffy

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top