23 Feb 2012

Directory listing timeout with ProFTPd in Centos and Virtualmin

I'm using Virtualmin to manage a Centos 5.7 machine.
When trying to use FileZilla to access the server using ftp I kept getting the following errors:

Status: Resolving address of servername.com
Status: Connecting to IP_ADDRESS:21...
Status: Connection established, waiting for welcome message...
Response: 220 FTP Server ready.
Command: USER my_username
Response: 331 Password required for servername.com
Command: PASS *******
Response: 230 User my_username logged in
Command: OPTS UTF8 ON
Response: 200 UTF8 set to on
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is the current directory
Command: TYPE I
Response: 200 Type set to I
Command: PASV
Response: 227 Entering Passive Mode (XXX,XXX,XXX,XXX,XXX,XXX).
Command: MLSD
Error: Connection timed out
Error: Failed to retrieve directory listing



However using Nautilus, Ubuntu's file explorer, I had no problem accessing the server.

It turned out to be some modules missing in the server, needed to assure the right support for passive ftp connection.

I just add to edit /etc/sysconfig/iptables-config to make sure it was loading ip_conntrack_ftp and ip_conntrack_tftp:


IPTABLES_MODULES="ip_conntrack_netbios_ns ip_conntrack_ftp ip_conntrack_tftp"


I then restarted iptables with:

/etc/init.d/iptables restart


And now I can access my files using any FTP client (at least it works with FileZilla :) )


13 Oct 2011

Creating an SSH tunnel in Microsoft Windows using putty

We've already seen how to create an ssh tunnel using *nix command line in  a previous post, but now we'll see how to do it in microsoft windows.

Just to remember you that an SSH tunnel can be used, among many other things, to give you access to an application running on a specific port on a remote machine to which you would not have direct access as it was blocked by a firewall. You need, however, to have ssh access to that machine.

Firts we need putty, an ssh client that can be downloaded here for free:
http://www.chiark.greenend.org.uk/~sgtatham/putty/

Then start it up and type in the hostname you are connecting to as shown in the picture.
Having the hostname we change to the Tunnel configuration screen, under Connection/SSH (see figure).
 Here we enter the local port in which the destination port will be mapped and the destination IP or hostname and port and then click the 'Add' button.

In this example we would be tunneling our local port 8088 to the remote machine's port 8088.
Finnaly we just hit 'Open' and a shell will be shown asking for our credentials on the remote server.
After a successfull login the remote service will be available in the local machine as localhost:8088



12 Sept 2011

Avoiding SSL mixed content warning in https pages

When opening a page using https you can get SSL warnings because the page mixes secure (https) and non-secure content (http). This can happen for many reasons, e.g. javascript inclusion like Facebook plugins or images from 3rd party hosts.

A simple solution to avoid this is to simply remove the protocol (http or https) from the url and start it with //

Example:
//connect.facebook.net/en_US/all.js#appId=YOUR_APP_ID_HERE&xfbml=1

instead of

http//connect.facebook.net/en_US/all.js#appId=YOUR_APP_ID_HERE&xfbml=1