阻止到某个 IP 的传出连接以进行失败测试?

发布于 2024-10-10 19:48:01 字数 247 浏览 0 评论 0原文

我们在 Windows Server 2003 上使用 Coldfusion 9。我们正在对一些通过 CFLDAP 与 LDAP 交互的代码以及通过 Java 与 LDAPS 交互的代码进行“故障转移”测试(用于密码更改)。

本质上,我们希望拥有 LDAP 服务器 IPS 的列表,并在发生连接故障时切换到新服务器。

是否有一种快速方法可以阻止从操作系统级别到 IP 的出站连接以模拟 LDAP 服务器中断,而无需实际断开其与网络的连接或将其关闭?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜嗑 2024-10-17 19:48:02

将您想要显示为离线的 IP 添加到 /etc/hosts 中,指向 127.0.0.1

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

鱼忆七猫命九 2024-10-17 19:48:02

ColdFusion 没有内置任何东西来促进这一点。经过一番谷歌搜索后,我认为 @Adam Tuttle 的解决方案可能是 Windows 盒子的最佳选择,但看来您也可以使用 Windows防火墙实现此效果。在 *nix 盒子上看起来像 "iptables"命令可以阻止出站流量

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.

作业与我同在 2024-10-17 19:48:02

Sniffy 允许您阻止 Java 应用程序中的传出网络连接(Coldfusion 基于 Java) - 每当您尝试与受限主机建立新连接时,它都会抛出 ConnectException

只需将 -javaagent:sniffy.jar=5559 添加到您的 JVM 参数中,并将浏览器指向 localhost:5559 - 它将打开一个网页,其中包含所有已发现的与下游系统的连接以及禁用某些连接的控件。

嗅探连接console

如果您的应用程序是基于 Web 的,您甚至可以直接从在浏览器中打开的应用程序中执行此操作 - 请参阅此处的演示:http://demo.sniffy.io/owners?lastName=

单击右下角的小部件,选择网络连接选项卡,禁用并连接到 localhost:8967 (数据库)并重新加载页面以查看其运行情况。

免责声明:我是 Sniffy 的作者

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文