简体   繁体   English

Python(Twisted + ZSI)中的Web服务调用在chroot监狱中不起作用

[英]Web service call in Python (Twisted + ZSI) not working in chroot jail

I have a Python script that calls a web service using ZSI with Twisted. 我有一个Python脚本,该脚本使用带有Twisted的ZSI调用Web服务。 On Linux, I'm running this script and it works fine. 在Linux上,我正在运行此脚本,它运行良好。

Now, I want this script to run in a chroot jail which is somewhere in my filesystem. 现在,我希望此脚本在文件系统中某个位置的chroot监狱中运行。 I have added the usr, lib and the etc directories in the jail. 我已经在监狱中添加了usr,lib和etc目录。 When I execute the script from the jail, there is no response from the web service and Twisted reports an error which looks like: 当我从监狱执行脚本时,Web服务没有任何响应,并且Twisted报告了如下错误:

[Failure instance: Traceback (failure with no frames): twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion. [失败实例:回溯(无帧失败):twisted.internet.error.ConnectionLost:与另一侧的连接以一种不干净的方式丢失。 ] ]

If I chroot to the root of the filesystem (/) and if the new jail uses the already existing usr, lib and etc directories, it works with no errors. 如果我将根目录更改为文件系统(/)的根目录,并且新监狱使用了已经存在的usr,lib和etc目录,则它将正常工作。

I'm suspecting that there is a library that's missing or a library in the bin/usr/etc directories of the first chroot jail that is not correct. 我怀疑第一个chroot监狱的bin / usr / etc目录中缺少一个不正确的库。 Do you have any clue that can help me? 你有什么可以帮助我的线索吗? Does somebody have a solution to this problem? 有人可以解决这个问题吗?

If your application is raising an unexpected exception at some point - eg, because some dependency fails to import, because it is not installed in the chroot - then this can cause connections to be unexpectedly closed. 如果您的应用程序在某个时候引发了意外的异常-例如,由于某些依赖项导入失败,因为它没有安装在chroot中-那么这可能会导致连接意外关闭。 It's hard to say with any precision, since you haven't mentioned what kind of connections you have or what APIs you're using to manage them. 很难精确地说,因为您没有提到您拥有什么样的连接或您使用什么API来管理它们。

Make sure you have logging enabled and look for unexpected tracebacks being written to your log file. 确保已启用日志记录,并查找意外的回溯被写入日志文件。 If you see any, there's a good chance they are associated with the problem that is causing your application to fail. 如果您看到任何错误,则很有可能它们与导致应用程序失败的问题有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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