You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Chamila Wijayarathna <cd...@gmail.com> on 2014/05/28 17:08:56 UTC

Python tests with ssl

Hello all,
I'm trying to run test/py/TestServer.py with SSL. When I ran this, I get
following error.

chamila@chamila-Aspire-5742:~/gsoc/1/thrift/test$ py/TestServer.py
--proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer --ssl
Traceback (most recent call last):
  File "py/TestServer.py", line 220, in <module>
    transport = TSSLSocket.TSSLServerSocket(host, options.port,
certfile='../keys/server.pem')
  File
"py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/transport/TSSLSocket.py",
line 182, in __init__
    self.setCertfile(certfile)
  File
"py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/transport/TSSLSocket.py",
line 195, in setCertfile
    raise IOError('No such certfile found: %s' % (certfile))
IOError: No such certfile found: ../keys/server.pem

Any idea on what is wrong here? I have server.pem at test/keys.

Thank You!

-- 
*Chamila Dilshan Wijayarathna,*
SMIEEE, SMIESL,
Undergraduate,
Department of Computer Science and Engineering,
University of Moratuwa.

Re: Python tests with ssl

Posted by Roger Meier <ro...@bufferoverflow.ch>.
Hi Chamila

Quoting Chamila Wijayarathna <cd...@gmail.com>:

> Hi Roger,
> Do we use this TestServer.py for any other thing like 'make check' or only
> for cross language tests?

it's used by test/test.sh and make check in test/py

$ grep -r TestServer.py lib/ test
test/py/Makefile.am:        TestServer.py
test/py/RunClientServer.py:  server_args = [sys.executable,  
relfile('TestServer.py') ]
test/test.sh:              "py/TestServer.py --proto=${proto}  
--port=9090 --genpydir=py/gen-py TSimpleServer
...

-roger

> Thank You!
>
>
> On Thu, May 29, 2014 at 1:14 AM, Chamila Wijayarathna <
> cdwijayarathna@gmail.com> wrote:
>
>> Thanks, I'll look into that.
>>
>>
>> On Thu, May 29, 2014 at 12:06 AM, Roger Meier  
>> <ro...@bufferoverflow.ch>wrote:
>>
>>> try something like this for the server.pem:
>>>
>>> http://stackoverflow.com/questions/7165749/open-file-
>>> in-a-relative-location-in-python
>>>
>>>
>>>
>>> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>>>
>>>  Hi Roger,
>>>> So how can we make this run when running using test.sh?
>>>> Thank You!
>>>>
>>>>
>>>> On Wed, May 28, 2014 at 9:08 PM, Roger Meier <ro...@bufferoverflow.ch>
>>>> wrote:
>>>>
>>>>
>>>>> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>>>>>
>>>>>  Hello all,
>>>>>
>>>>>> I'm trying to run test/py/TestServer.py with SSL. When I ran this, I
>>>>>> get
>>>>>> following error.
>>>>>>
>>>>>> chamila@chamila-Aspire-5742:~/gsoc/1/thrift/test$ py/TestServer.py
>>>>>> --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer --ssl
>>>>>> Traceback (most recent call last):
>>>>>>   File "py/TestServer.py", line 220, in <module>
>>>>>>     transport = TSSLSocket.TSSLServerSocket(host, options.port,
>>>>>> certfile='../keys/server.pem')
>>>>>>   File
>>>>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>>>>> transport/TSSLSocket.py",
>>>>>> line 182, in __init__
>>>>>>     self.setCertfile(certfile)
>>>>>>   File
>>>>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>>>>> transport/TSSLSocket.py",
>>>>>> line 195, in setCertfile
>>>>>>     raise IOError('No such certfile found: %s' % (certfile))
>>>>>> IOError: No such certfile found: ../keys/server.pem
>>>>>>
>>>>>> Any idea on what is wrong here? I have server.pem at test/keys.
>>>>>>
>>>>>>
>>>>> execution within
>>>>> test/py works
>>>>> test not
>>>>>
>>>>> => python testserver needs to know where it is executed
>>>>>
>>>>> -roger
>>>>>
>>>>>
>>>>>> Thank You!
>>>>>>
>>>>>> --
>>>>>> *Chamila Dilshan Wijayarathna,*
>>>>>>
>>>>>> SMIEEE, SMIESL,
>>>>>> Undergraduate,
>>>>>> Department of Computer Science and Engineering,
>>>>>> University of Moratuwa.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> *Chamila Dilshan Wijayarathna,*
>>>> SMIEEE, SMIESL,
>>>> Undergraduate,
>>>> Department of Computer Science and Engineering,
>>>> University of Moratuwa.
>>>>
>>>
>>>
>>
>>
>> --
>> *Chamila Dilshan Wijayarathna,*
>>
>> SMIEEE, SMIESL,
>> Undergraduate,
>> Department of Computer Science and Engineering,
>> University of Moratuwa.
>>
>
>
>
> --
> *Chamila Dilshan Wijayarathna,*
> SMIEEE, SMIESL,
> Undergraduate,
> Department of Computer Science and Engineering,
> University of Moratuwa.


Re: Python tests with ssl

Posted by Chamila Wijayarathna <cd...@gmail.com>.
Hi Roger,
Do we use this TestServer.py for any other thing like 'make check' or only
for cross language tests?
Thank You!


On Thu, May 29, 2014 at 1:14 AM, Chamila Wijayarathna <
cdwijayarathna@gmail.com> wrote:

> Thanks, I'll look into that.
>
>
> On Thu, May 29, 2014 at 12:06 AM, Roger Meier <ro...@bufferoverflow.ch>wrote:
>
>> try something like this for the server.pem:
>>
>> http://stackoverflow.com/questions/7165749/open-file-
>> in-a-relative-location-in-python
>>
>>
>>
>> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>>
>>  Hi Roger,
>>> So how can we make this run when running using test.sh?
>>> Thank You!
>>>
>>>
>>> On Wed, May 28, 2014 at 9:08 PM, Roger Meier <ro...@bufferoverflow.ch>
>>> wrote:
>>>
>>>
>>>> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>>>>
>>>>  Hello all,
>>>>
>>>>> I'm trying to run test/py/TestServer.py with SSL. When I ran this, I
>>>>> get
>>>>> following error.
>>>>>
>>>>> chamila@chamila-Aspire-5742:~/gsoc/1/thrift/test$ py/TestServer.py
>>>>> --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer --ssl
>>>>> Traceback (most recent call last):
>>>>>   File "py/TestServer.py", line 220, in <module>
>>>>>     transport = TSSLSocket.TSSLServerSocket(host, options.port,
>>>>> certfile='../keys/server.pem')
>>>>>   File
>>>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>>>> transport/TSSLSocket.py",
>>>>> line 182, in __init__
>>>>>     self.setCertfile(certfile)
>>>>>   File
>>>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>>>> transport/TSSLSocket.py",
>>>>> line 195, in setCertfile
>>>>>     raise IOError('No such certfile found: %s' % (certfile))
>>>>> IOError: No such certfile found: ../keys/server.pem
>>>>>
>>>>> Any idea on what is wrong here? I have server.pem at test/keys.
>>>>>
>>>>>
>>>> execution within
>>>> test/py works
>>>> test not
>>>>
>>>> => python testserver needs to know where it is executed
>>>>
>>>> -roger
>>>>
>>>>
>>>>> Thank You!
>>>>>
>>>>> --
>>>>> *Chamila Dilshan Wijayarathna,*
>>>>>
>>>>> SMIEEE, SMIESL,
>>>>> Undergraduate,
>>>>> Department of Computer Science and Engineering,
>>>>> University of Moratuwa.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> *Chamila Dilshan Wijayarathna,*
>>> SMIEEE, SMIESL,
>>> Undergraduate,
>>> Department of Computer Science and Engineering,
>>> University of Moratuwa.
>>>
>>
>>
>
>
> --
> *Chamila Dilshan Wijayarathna,*
>
> SMIEEE, SMIESL,
> Undergraduate,
> Department of Computer Science and Engineering,
> University of Moratuwa.
>



-- 
*Chamila Dilshan Wijayarathna,*
SMIEEE, SMIESL,
Undergraduate,
Department of Computer Science and Engineering,
University of Moratuwa.

Re: Python tests with ssl

Posted by Chamila Wijayarathna <cd...@gmail.com>.
Thanks, I'll look into that.


On Thu, May 29, 2014 at 12:06 AM, Roger Meier <ro...@bufferoverflow.ch>wrote:

> try something like this for the server.pem:
>
> http://stackoverflow.com/questions/7165749/open-file-
> in-a-relative-location-in-python
>
>
>
> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>
>  Hi Roger,
>> So how can we make this run when running using test.sh?
>> Thank You!
>>
>>
>> On Wed, May 28, 2014 at 9:08 PM, Roger Meier <ro...@bufferoverflow.ch>
>> wrote:
>>
>>
>>> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>>>
>>>  Hello all,
>>>
>>>> I'm trying to run test/py/TestServer.py with SSL. When I ran this, I get
>>>> following error.
>>>>
>>>> chamila@chamila-Aspire-5742:~/gsoc/1/thrift/test$ py/TestServer.py
>>>> --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer --ssl
>>>> Traceback (most recent call last):
>>>>   File "py/TestServer.py", line 220, in <module>
>>>>     transport = TSSLSocket.TSSLServerSocket(host, options.port,
>>>> certfile='../keys/server.pem')
>>>>   File
>>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>>> transport/TSSLSocket.py",
>>>> line 182, in __init__
>>>>     self.setCertfile(certfile)
>>>>   File
>>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>>> transport/TSSLSocket.py",
>>>> line 195, in setCertfile
>>>>     raise IOError('No such certfile found: %s' % (certfile))
>>>> IOError: No such certfile found: ../keys/server.pem
>>>>
>>>> Any idea on what is wrong here? I have server.pem at test/keys.
>>>>
>>>>
>>> execution within
>>> test/py works
>>> test not
>>>
>>> => python testserver needs to know where it is executed
>>>
>>> -roger
>>>
>>>
>>>> Thank You!
>>>>
>>>> --
>>>> *Chamila Dilshan Wijayarathna,*
>>>>
>>>> SMIEEE, SMIESL,
>>>> Undergraduate,
>>>> Department of Computer Science and Engineering,
>>>> University of Moratuwa.
>>>>
>>>>
>>>
>>>
>>>
>>
>> --
>> *Chamila Dilshan Wijayarathna,*
>> SMIEEE, SMIESL,
>> Undergraduate,
>> Department of Computer Science and Engineering,
>> University of Moratuwa.
>>
>
>


-- 
*Chamila Dilshan Wijayarathna,*
SMIEEE, SMIESL,
Undergraduate,
Department of Computer Science and Engineering,
University of Moratuwa.

Re: Python tests with ssl

Posted by Roger Meier <ro...@bufferoverflow.ch>.
try something like this for the server.pem:

http://stackoverflow.com/questions/7165749/open-file-in-a-relative-location-in-python


Quoting Chamila Wijayarathna <cd...@gmail.com>:

> Hi Roger,
> So how can we make this run when running using test.sh?
> Thank You!
>
>
> On Wed, May 28, 2014 at 9:08 PM, Roger Meier <ro...@bufferoverflow.ch>wrote:
>
>>
>> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>>
>>  Hello all,
>>> I'm trying to run test/py/TestServer.py with SSL. When I ran this, I get
>>> following error.
>>>
>>> chamila@chamila-Aspire-5742:~/gsoc/1/thrift/test$ py/TestServer.py
>>> --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer --ssl
>>> Traceback (most recent call last):
>>>   File "py/TestServer.py", line 220, in <module>
>>>     transport = TSSLSocket.TSSLServerSocket(host, options.port,
>>> certfile='../keys/server.pem')
>>>   File
>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>> transport/TSSLSocket.py",
>>> line 182, in __init__
>>>     self.setCertfile(certfile)
>>>   File
>>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>>> transport/TSSLSocket.py",
>>> line 195, in setCertfile
>>>     raise IOError('No such certfile found: %s' % (certfile))
>>> IOError: No such certfile found: ../keys/server.pem
>>>
>>> Any idea on what is wrong here? I have server.pem at test/keys.
>>>
>>
>> execution within
>> test/py works
>> test not
>>
>> => python testserver needs to know where it is executed
>>
>> -roger
>>
>>>
>>> Thank You!
>>>
>>> --
>>> *Chamila Dilshan Wijayarathna,*
>>>
>>> SMIEEE, SMIESL,
>>> Undergraduate,
>>> Department of Computer Science and Engineering,
>>> University of Moratuwa.
>>>
>>
>>
>>
>
>
> --
> *Chamila Dilshan Wijayarathna,*
> SMIEEE, SMIESL,
> Undergraduate,
> Department of Computer Science and Engineering,
> University of Moratuwa.


Re: Python tests with ssl

Posted by Chamila Wijayarathna <cd...@gmail.com>.
Hi Roger,
So how can we make this run when running using test.sh?
Thank You!


On Wed, May 28, 2014 at 9:08 PM, Roger Meier <ro...@bufferoverflow.ch>wrote:

>
> Quoting Chamila Wijayarathna <cd...@gmail.com>:
>
>  Hello all,
>> I'm trying to run test/py/TestServer.py with SSL. When I ran this, I get
>> following error.
>>
>> chamila@chamila-Aspire-5742:~/gsoc/1/thrift/test$ py/TestServer.py
>> --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer --ssl
>> Traceback (most recent call last):
>>   File "py/TestServer.py", line 220, in <module>
>>     transport = TSSLSocket.TSSLServerSocket(host, options.port,
>> certfile='../keys/server.pem')
>>   File
>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>> transport/TSSLSocket.py",
>> line 182, in __init__
>>     self.setCertfile(certfile)
>>   File
>> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/
>> transport/TSSLSocket.py",
>> line 195, in setCertfile
>>     raise IOError('No such certfile found: %s' % (certfile))
>> IOError: No such certfile found: ../keys/server.pem
>>
>> Any idea on what is wrong here? I have server.pem at test/keys.
>>
>
> execution within
> test/py works
> test not
>
> => python testserver needs to know where it is executed
>
> -roger
>
>>
>> Thank You!
>>
>> --
>> *Chamila Dilshan Wijayarathna,*
>>
>> SMIEEE, SMIESL,
>> Undergraduate,
>> Department of Computer Science and Engineering,
>> University of Moratuwa.
>>
>
>
>


-- 
*Chamila Dilshan Wijayarathna,*
SMIEEE, SMIESL,
Undergraduate,
Department of Computer Science and Engineering,
University of Moratuwa.

Re: Python tests with ssl

Posted by Roger Meier <ro...@bufferoverflow.ch>.
Quoting Chamila Wijayarathna <cd...@gmail.com>:

> Hello all,
> I'm trying to run test/py/TestServer.py with SSL. When I ran this, I get
> following error.
>
> chamila@chamila-Aspire-5742:~/gsoc/1/thrift/test$ py/TestServer.py
> --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer --ssl
> Traceback (most recent call last):
>   File "py/TestServer.py", line 220, in <module>
>     transport = TSSLSocket.TSSLServerSocket(host, options.port,
> certfile='../keys/server.pem')
>   File
> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/transport/TSSLSocket.py",
> line 182, in __init__
>     self.setCertfile(certfile)
>   File
> "py/../../lib/py/build/lib.linux-x86_64-2.7/thrift/transport/TSSLSocket.py",
> line 195, in setCertfile
>     raise IOError('No such certfile found: %s' % (certfile))
> IOError: No such certfile found: ../keys/server.pem
>
> Any idea on what is wrong here? I have server.pem at test/keys.

execution within
test/py works
test not

=> python testserver needs to know where it is executed

-roger
>
> Thank You!
>
> --
> *Chamila Dilshan Wijayarathna,*
> SMIEEE, SMIESL,
> Undergraduate,
> Department of Computer Science and Engineering,
> University of Moratuwa.