Re: Pyro-core Digest, Vol 68, Issue 2 - 4 Basic Example Question

Luciano Dantas <[email protected]>
Newsgroups gmane.comp.python.pyro
Message-ID <CAMtBMdqmETx4fMoXjPK1XQSyE=-_vJtT1mK3P0UUbZKuof+NVw@mail.gmail.com>
I was having intermittent connection problems between my Virtualbox Windows
7 64bit Host and my Ubuntu 12.04 32bit VM/guest. Since these connections
problems were not reproducible on the other Ubuntu 10.10 32bit VM/guest I
was a little lost. I have bridged networking set up on both machines. It
seems that configuring the Promiscuous Mode to Allow All solves the problem
but still I can't figure out why it was a problem with the newer Ubuntu and
not older, since the older is still configured to Deny Promiscuous Mode.

My 2cents

---------- Forwarded message ----------
From: TCG TCGUtility <[email protected]>
To: [email protected]
Cc:
Date: Wed, 26 Sep 2012 00:51:35 +1200
Subject: [Pyro] Basic Example Question
I think I have a network issue but I just want to be sure I'm doing
completely the right thing.

I've got two machines: one is my laptop and the other a virtual machine
within my laptop.

It's possible to connect from laptop to vm on port 8000 for HTTP and PyRPC.
It's difficult/impossible to make connections back the other way (for
instance a web-server running on 80 or 8000 on the laptop will not be
visible to the VM).

OK so now to what I've tried.

On the Ubuntu VM I've got :

# saved as greeting.pyimport Pyro4
class GreetingMaker(object):
    def get_fortune(self, name):
        return "Hello, {0}. Here is your fortune message:\n" \
               "Behold the warranty -- the bold print giveth and the
fine print taketh away.".format(name)
greeting_maker=GreetingMaker()
daemon=Pyro4.Daemon()                 # make a Pyro
daemonuri=daemon.register(greeting_maker)   # register the greeting
object as a Pyro object
print "Ready. Object uri =", uri      # print the uri so we can use it
in the client laterdaemon.requestLoop()                  # start the
event loop of the server to wait for calls


On the Windows laptop I've got :



# saved as client.pyimport Pyro4
uri=raw_input("What is the Pyro uri of the greeting object?
").strip()name=raw_input("What is your name? ").strip()
greeting_maker=Pyro4.Proxy(uri)          # get a Pyro proxy to the
greeting objectprint greeting_maker.get_fortune(name)   # call method
normally


On the ubuntu VM I start greeting.py and this is what I see :



(venv)tcgut@ubserver1:~/dev/bibimgjobcontserver$ python greeting.py
/home/tcgut/dev/bibimgjobcontserver/venv/local/lib/python2.7/site-packages/Pyro4/core.py:155:
UserWarning: HMAC_KEY not set, protocol data may not be secure



  warnings.warn("HMAC_KEY not set, protocol data may not be secure")
Ready. Object uri = PYRO:obj_4ea116b397b94177abfe8e54d4cf8491@localhost:42049

Then on the windows laptop I start client.py and this is what I see :



(venv) C:\usr\tcgut\data\src\Python\bibimgjobcontrol>python client-greeting.py
What is the Pyro uri of the greeting object?
PYRO:obj_4ea116b397b94177abfe8e54d4cf8491@localhost:42049



What is your name? glaucon
C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py:155:
UserWarning: HMAC_KEY not set, protocol data may not be secure
  warnings.warn("HMAC_KEY not set, protocol data may not be secure")



Traceback (most recent call last):
  File "client-greeting.py", line 8, in <module>
    print greeting_maker.get_fortune(name)   # call method normally
  File "C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py",
line 149, in __call__



    return self.__send(self.__name, args, kwargs)
  File "C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py",
line 266, in _pyroInvoke
    self.__pyroCreateConnection()



  File "C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py",
line 339, in __pyroCreateConnection
    raise errors.CommunicationError(err)
Pyro4.errors.CommunicationError: cannot connect: [Errno 10061] No
connection could be made because the target machine actively refused
it



which on the surface looks like the Ubuntu VM is running a firewall
which is rejecting access on port 42049 - except
as far as I can tell it isn't running any firewall at all and (as
mentioned above) it's possible for HTTP traffic originating on



windows machine to get to a webserver on the Ubuntu VM

What I found really odd about this was providing a uri for the
server.py which said 'localhost' in the middle of it (when
I was trying to access a machine which was not localhost) so  I tried
again only this time I adapted the uri used like this :




PYRO:obj_4ea116b397b94177abfe8e54d4cf8491-Q0ErXNX1RuaBWbWMMV2pGw@public.gmane.org:42049

so that it had the ip address of the VM instead of localhost and I got
the same response ('target machine actively refused it').



So my question is ... can someone confirm that what I'm doing here
should work ! I'm assuming it's some arcane
aspect of the network setup between the windows machine and the VM
that it's hosting but I'd like to be sure.



Also is there any way I can force all traffic onto port 80 or 8000 as
I know it's possible for the two machines to
communicate on those ports.

Thanks

R.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Pyro-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyro-core
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.