1

I've installed pure-ftpd-mysql and it works fine with md5 password hashing. This isn't very secure, so I'd like to use crypt with salted sha512, the way I'm using in dovecot.

How to set up this in pure-ftpd?

Creating new user with sha512 pass:

INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`, 
  `ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`, `QuotaFiles`)
   VALUES ('MyUserName',
    '1',
    ENCRYPT('_mypassword_', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))),
    '2001',
    '2001',
    '/var/www/test',
    '100',
    '100',
    '',
    '*',
    '50',
    '0');

The values in config file:

MYSQLCrypt md5
MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*"  OR ipaccess LIKE "\R")

So my question is what do I need to put in the config file to have the password generated using the above method working.

I thought that changing MYSQLCrypt to crypt should be enough. But this does not work.

In case any other method does not work the manual describes how to create a authentication module http://download.pureftpd.org/pure-ftpd/doc/README.Authentication-Modules (but how do I enable it?)

yagmoth555
  • 16,300
  • 4
  • 26
  • 48
Sfisioza
  • 592
  • 2
  • 7
  • 18

1 Answers1

2

pure-ftpd-mysql supports sha512 crypt with salt.

It's as easy as:

MYSQLCrypt crypt

And do make sure that your Password column is long enough. For crypt $6$ it's 106 characters.

So the table structure working with your query might be like this:

CREATE TABLE ftpd (
 User varchar(16) NOT NULL default '',
 status enum('0','1') NOT NULL default '0',
 Password varchar(106) NOT NULL default '',
 Uid varchar(11) NOT NULL default '-1',
 Gid varchar(11) NOT NULL default '-1',
 Dir varchar(128) NOT NULL default '',
 ULBandwidth smallint(5) NOT NULL default '0',
 DLBandwidth smallint(5) NOT NULL default '0',
 comment tinytext NOT NULL,
 ipaccess varchar(15) NOT NULL default '*',
 QuotaSize smallint(5) NOT NULL default '0',
 QuotaFiles int(11) NOT NULL default 0,
 PRIMARY KEY (User),
 UNIQUE KEY User (User)
 ) ENGINE=MyISAM;
takeshin
  • 1,431
  • 3
  • 19
  • 28