[Twisted-Python] ftp passive mode returning internal IP
This possibly has nothing to do with twisted, but maybe if not someone may be able to point me in the right direction! Basically I've set up a twisted FTP server on ec2, and when a client tries to enter passive mode I'm getting this: Response: 227 Entering Passive Mode (x,x,x,x,159,122). Status: Server sent passive reply with unroutable address. Using server address instead. the x.x.x.x is the boxes private IP, rather than its public IP. It's getting this from ln. 851 in twisted/protocols/ftp.py v12.2.0 Is there somehow I can change the way twisted is getting the IP, or is this an issue with the server set up itself? Any pointers or help on what to look/check for would be of huge help! Thanks! Paul
Hi,
I don't think there is support for configuring the advertised IP address.
I don't know how EC2 ip forwarding works and how can you retrieve it.
To use another IP address, in FTP.ftp_PASV(), look for the following lines:
self.dtpPort = self.getDTPPort(self.dtpFactory)
host = self.transport.getHost().host
port = self.dtpPort.getHost().port
Just replace 'self.transport.getHost().host' with your required IP or
another method for retrieving the IP address.
Cheers,
Adi
On 20 November 2012 22:47, Paul Wiseman
This possibly has nothing to do with twisted, but maybe if not someone may be able to point me in the right direction!
Basically I've set up a twisted FTP server on ec2, and when a client tries to enter passive mode I'm getting this:
Response: 227 Entering Passive Mode (x,x,x,x,159,122). Status: Server sent passive reply with unroutable address. Using server address instead.
the x.x.x.x is the boxes private IP, rather than its public IP.
It's getting this from ln. 851 in twisted/protocols/ftp.py v12.2.0
Is there somehow I can change the way twisted is getting the IP, or is this an issue with the server set up itself?
Any pointers or help on what to look/check for would be of huge help!
Thanks!
Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Adi Roiban
On 20 November 2012 21:31, Adi Roiban
Hi,
I don't think there is support for configuring the advertised IP address. I don't know how EC2 ip forwarding works and how can you retrieve it.
To use another IP address, in FTP.ftp_PASV(), look for the following lines:
self.dtpPort = self.getDTPPort(self.dtpFactory)
host = self.transport.getHost().host port = self.dtpPort.getHost().port
Just replace 'self.transport.getHost().host' with your required IP or another method for retrieving the IP address.
Cheers, Adi
Cheers Adi, I've made a function that launches 'curl ifconfig.me' through subprocess, and I call that and save it when the server starts. Is this definitely the only place where I need to override the host? I'd rather wrap the transport object to be sure but twisted is still pretty magic to me and I'm struggling to find out where this ProtocolWrapper object is originating from.
This possibly has nothing to do with twisted, but maybe if not someone may be able to point me in the right direction!
Basically I've set up a twisted FTP server on ec2, and when a client
to enter passive mode I'm getting this:
Response: 227 Entering Passive Mode (x,x,x,x,159,122). Status: Server sent passive reply with unroutable address. Using server address instead.
the x.x.x.x is the boxes private IP, rather than its public IP.
It's getting this from ln. 851 in twisted/protocols/ftp.py v12.2.0
Is there somehow I can change the way twisted is getting the IP, or is
On 20 November 2012 22:47, Paul Wiseman
wrote: tries this an issue with the server set up itself?
Any pointers or help on what to look/check for would be of huge help!
Thanks!
Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Adi Roiban
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On 21 November 2012 00:02, Paul Wiseman
On 20 November 2012 21:31, Adi Roiban
wrote: Hi,
I don't think there is support for configuring the advertised IP address. I don't know how EC2 ip forwarding works and how can you retrieve it.
To use another IP address, in FTP.ftp_PASV(), look for the following lines:
self.dtpPort = self.getDTPPort(self.dtpFactory)
host = self.transport.getHost().host port = self.dtpPort.getHost().port
Just replace 'self.transport.getHost().host' with your required IP or another method for retrieving the IP address.
Cheers, Adi
Cheers Adi, I've made a function that launches 'curl ifconfig.me' through subprocess, and I call that and save it when the server starts.
Is this definitely the only place where I need to override the host?
I can not guarantee that, but I think it should be the only place.
I'd rather wrap the transport object to be sure but twisted is still pretty magic to me and I'm struggling to find out where this ProtocolWrapper object is originating from.
ftp.FTPFactory.buildProtocol is where the protocol is created, including the ProtocolWrapper. ---- I don't know how EC2 port forwarding works, but as long it does an one to one port mapping, changing the IP address in PASV response should do the job. Cheers, Adi
On 20 November 2012 22:47, Paul Wiseman
wrote: This possibly has nothing to do with twisted, but maybe if not someone may be able to point me in the right direction!
Basically I've set up a twisted FTP server on ec2, and when a client tries to enter passive mode I'm getting this:
Response: 227 Entering Passive Mode (x,x,x,x,159,122). Status: Server sent passive reply with unroutable address. Using server address instead.
the x.x.x.x is the boxes private IP, rather than its public IP.
It's getting this from ln. 851 in twisted/protocols/ftp.py v12.2.0
Is there somehow I can change the way twisted is getting the IP, or is this an issue with the server set up itself?
Any pointers or help on what to look/check for would be of huge help!
Thanks!
Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Adi Roiban
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Adi Roiban
participants (2)
-
Adi Roiban
-
Paul Wiseman