Linux Support, Hosting & Security Hertfordshire

Sunday, 18 April 2010

Ubuntu Karmic|Lucid Pure-ftpd hangs when using TLS

Ubuntu Karmic (9.10) and Lucid (10.04) provide pure-ftpd version 1.0.22-1 and 1.0.24-1 by default. These versions of pureftp have a known issue with some FTP clients which cause the LIST command to stall/hang when using TLS. We noticed this with the OSX transmit and coda clients, but ubuntu bugs also shows users also having issues with the Cyberduck FTP client. See ubuntu bug #499854

Upgrading to version 1.0.28-2 resolves this issue. We used the pure-ftpd Debian sid packages successfully and without issue.

In our case we were using the 64bit pure-ftpd-mysql package, however this issue is also known to effect pure-ftpd-ldap

Steps outlined

  1. Remove current pure-ftpd install
  2. Install the required dependencies from ubuntu
  3. Upgrade the openssl package to the required version
  4. Download and install the Debian pure-ftpd packages

Example Commands for amd64 pure-ftpd-mysql packages

/etc/init.d/pure-ftpd-mysql stop
aptitude remove pure-ftpd-mysql
aptitude install libmysqlclient15off openbsd-inetd update-inetd
wget http://ftp.de.debian.org/debian/pool/main/p/pure-ftpd/pure-ftpd-common_1.0.28-2_all.deb
wget http://ftp.de.debian.org/debian/pool/main/p/pure-ftpd/pure-ftpd-mysql_1.0.28-2+b1_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8n-1_amd64.deb
dpkg -i *.deb

Did this post help you? Thank us with bitcoin;

Wednesday, 14 April 2010

BASH/SH Random String/Password Generator

Need to generate a random a-zA-Z0-9 string in bash or sh? Well this little function should help.

You can passover the string length or leave it blank for an 8 character string.

Code

function randompass () {
        local randompassLength
        if [ $1 ]; then
                randompassLength=$1
        else
                randompassLength=8
        fi

        pass=</dev/urandom tr -dc A-Za-z0-9 | head -c $randompassLength
        echo $pass
}

Example Usage

#!/bin/bash
#

function randompass () {
        local randompassLength
        if [ $1 ]; then
                randompassLength=$1
        else
                randompassLength=8
        fi

        pass=</dev/urandom tr -dc A-Za-z0-9 | head -c $randompassLength
        echo $pass
}

fourChrString=`randompass 4`
eightChrString=`randompass`

echo "4 character random string : $fourChrString"
echo "8 character random string : $eightChrString"

Example Output

4 character random string : pnoc
8 character random string : c110EM21

Did this post help you? Thank us with bitcoin;