ThunderEX / py-kms

A KMS server written in python.
Other
395 stars 113 forks source link

IOError KMSDatabase not found #10

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello, With this new version of pyKMS, nothing works at all.

I'm providing you the log file from py-kms.

Output of /usr/bin/python /root/py-kms/server.py 10.0.0.254 -v

` TCP server listening at 10.0.0.254 on port 1688. Connection accepted: 10.0.0.1:49670 RPC bind request received. RPC bind acknowledged. Received activation request. Received V6 request on Thu Jul 27 22:30:42 2017. Connection closed: 10.0.0.1:49670

Exception happened during processing of request from ('10.0.0.1', 49670) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 652, in init self.handle() File "/root/py-kms/server.py", line 113, in handle res = bytes(handler.populate()) File "/root/py-kms/rpcBase.py", line 41, in populate return self.generateResponse(self.parseRequest()) File "/root/py-kms/rpcRequest.py", line 18, in generateResponse responseData = kmsBase.generateKmsResponseData(request['pduData'], self.config) File "/root/py-kms/kmsBase.py", line 299, in generateKmsResponseData return messagehandler.executeRequestLogic() File "/root/py-kms/kmsRequestV5.py", line 66, in executeRequestLogic responseBuffer = self.serverLogic(decrypted['request']) File "/root/py-kms/kmsBase.py", line 160, in serverLogic kmsdata = parse(tokenize(open(kmsdb)), lesslist=False)['KmsData'][0] IOError: [Errno 2] No such file or directory: 'KmsDataBase.xml'

Connection accepted: 10.0.0.1:49671 RPC bind request received. RPC bind acknowledged. Received activation request. Received V6 request on Thu Jul 27 22:30:45 2017. Connection closed: 10.0.0.1:49671

Exception happened during processing of request from ('10.0.0.1', 49671) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 652, in init self.handle() File "/root/py-kms/server.py", line 113, in handle res = bytes(handler.populate()) File "/root/py-kms/rpcBase.py", line 41, in populate return self.generateResponse(self.parseRequest()) File "/root/py-kms/rpcRequest.py", line 18, in generateResponse responseData = kmsBase.generateKmsResponseData(request['pduData'], self.config) File "/root/py-kms/kmsBase.py", line 299, in generateKmsResponseData return messagehandler.executeRequestLogic() File "/root/py-kms/kmsRequestV5.py", line 66, in executeRequestLogic responseBuffer = self.serverLogic(decrypted['request']) File "/root/py-kms/kmsBase.py", line 160, in serverLogic kmsdata = parse(tokenize(open(kmsdb)), lesslist=False)['KmsData'][0] IOError: [Errno 2] No such file or directory: 'KmsDataBase.xml'

^CTraceback (most recent call last): File "/root/py-kms/server.py", line 129, in main() File "/root/py-kms/server.py", line 78, in main server.serve_forever() File "/usr/lib/python2.7/SocketServer.py", line 231, in serve_forever poll_interval) File "/usr/lib/python2.7/SocketServer.py", line 150, in _eintr_retry return func(*args) KeyboardInterrupt root@pykms:~# `

ThunderEX commented 7 years ago

I tried again and find no problem. do you have KmsDataBase.xml? what's its location?

ghost commented 7 years ago

I've just done a "git clone" of your reposity, so this file is at the root of the py-kms directory.

When i setup py-kms from scratch, I do the following : cd /root git init git clone py-kms chmod +x /root/py-kms/*.py (make all Python scripts executable) cd /root/py-kms/pyaes/ && chmod +x ./*.py (same thing here) cd /root Then I manually launch the service : python ./py-kms/server.py 10.0.0.254 -v Then the socket is created successfully but KMS requests fails with the "File not found" error described above.

So as you can see, I don't do anything fancy.

But something might be wrong though.

ThunderEX commented 7 years ago

It's due to you execute from /root instead of dir of py-kms. And I introduce a bug that it only look for KmsDataBase.xml in current work dir. So it didn't find that xml file. I've fix it. Thanks a lot and please check latest update!

ghost commented 7 years ago

Hello,

Yay, it works again.

Thank you. :)

Cheers.