OpenWrt Forum Archive

Topic: New Package : Pure-ftpd 1.0.20 with all feature

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Can you upload the file again ?
Thanks.

Hello,

If you need it, i have compiled it also. You can find a package here : http://aorlinsk2.free.fr/openwrt/
You will have to install libelf before, since my package is not perfect and the dependencies are not configured...

In the package you have pure-ftpd and pure-pw, no ssl and funky features are compiled in.

If you wait the week-end you can even get the sources of the package.

Anael

Ok, thank you.

I have installed a version from florian's alphacore and I can't get passive mode working ... At work I am behind a NAT so I have to use passive mode.

pure-ftpd starting options
OPTIONS=-" -A -a 0 -c 10 -B -C 3 -D -E -f ftpd -H -I 5 -L 2000:8 -m 4 -p 65000:65100 -P xxx.xxx.xxx.xxx -S 10.0.0.1,30001 -U 133:022 -w -x -X -i -O clf:/opt/var/log/pureftpd.log -R -g /var/run/pure-ftpd.pid -k 95 -Z"

iptables rules

# pure-ftpd open on port 30001
iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 30001 -j DNAT --to-destination 10.0.0.1:30001
iptables -t filter -A input_rule -i $WAN -p TCP --dport 30001 -d 10.0.0.1 -j ACCEPT
iptables -t nat -A PREROUTING -i $WAN -p tcp --dport 65000:65100 -j DNAT --to-destination 10.0.0.1

any ideas ? thank you

Hi Anael!

I tried your package on a WGT634U running buildroot-ng R4927, and I have several problems with it using puredb authentication.

Generating pureftpd.passwd and converting it to .pdb is no problem, but:
# pure-pw list -f /etc/pure-ftpd/pureftpd.passwd
Unable to open the passwd file: No such file or directory

But
# pure-pw show username -f /etc/pure-ftpd/pureftpd.passwd
Works!

when I try to login with an ftp client:
ftp.info pure-ftpd: (?@192.168.0.3) [INFO] New connection from 192.168.0.3
ftp.err pure-ftpd: (?@192.168.0.3) [ERROR] Unable to read the indexed puredb file (or old format detected) - Try pure-pw mkdb

A similar configuration works on my opensuse 10.1.

best regards
Martin

MMCM wrote:

Hi Anael!

I tried your package on a WGT634U running buildroot-ng R4927, and I have several problems with it using puredb authentication.

Generating pureftpd.passwd and converting it to .pdb is no problem, but:
# pure-pw list -f /etc/pure-ftpd/pureftpd.passwd
Unable to open the passwd file: No such file or directory

But
# pure-pw show username -f /etc/pure-ftpd/pureftpd.passwd
Works!

when I try to login with an ftp client:
ftp.info pure-ftpd: (?@192.168.0.3) [INFO] New connection from 192.168.0.3
ftp.err pure-ftpd: (?@192.168.0.3) [ERROR] Unable to read the indexed puredb file (or old format detected) - Try pure-pw mkdb

A similar configuration works on my opensuse 10.1.

best regards
Martin

You have to do pure-pw mkdb with input your pureftpd.passwd and output your pureftpd.db
This will 'compile' your .passwd file into a .db file.
Then run pure-ftpd and give the .db file as your puredb file.

Anael

aorlinsk wrote:

You have to do pure-pw mkdb with input your pureftpd.passwd and output your pureftpd.db
This will 'compile' your .passwd file into a .db file.
Then run pure-ftpd and give the .db file as your puredb file.

Anael

Do you really think, I didn't do that? ;-)

The .db file is definitely there (I can see the accounts with hexdump -C), and I pass it's filename with the following options in S50pure-ftpd:

root@wgt634u:/etc/pure-ftpd# ls -l
-rw-------    1 root     root          103 Oct  9 21:15 pureftpd.passwd
-rw-------    1 root     root         2169 Oct  9 21:46 pureftpd.pdb

root@wgt634u:/etc/init.d# cat S50pure-ftpd
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

BIN=pure-ftpd
DEFAULT=/etc/default/$BIN
LOG_D=/var/log/$BIN
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
OPTIONS="-B -E -lpuredb:/etc/pure-ftpd/pureftpd.pdb -U 133:022 -g $PID_F"
[ -f $DEFAULT ] && . $DEFAULT

start() {
        mkdir -p $LOG_D
        mkdir -p $RUN_D
        $BIN $OPTIONS
}

stop() {
        [ -f $PID_F ] && kill $(cat $PID_F)
}

Anything wrong here?

And even, if there's something wrong with the .db file, it doesn't explain the following:

# pure-pw list -f /etc/pure-ftpd/pureftpd.passwd
Unable to open the passwd file: No such file or directory

Do you use puredb?

Any clues?

root@OpenWrt:/etc/pure-ftpd# ls -l
-rw-------    1 root     root         2154 Jan  1  2000 users.db
-rw-------    1 root     root           88 Jan  1  2000 users.pwfile


root@OpenWrt:/etc/init.d# more S55pureftpd
#!/bin/sh
pure-ftpd -A -B -c 10 -E -g /tmp/pure-ftpd.pid -I 5 -l puredb:/etc/pure-ftpd/users.db -u 1 -U 111:000 -y 3:10 -Z

And this works, I mean you can connect to my FTP using the password defined in the users.db file and upload/download files without problem.

However, I also get

root@OpenWrt:/etc/pure-ftpd# pure-pw list -f users.pwfile
Unable to open the passwd file: No such file or directory
root@OpenWrt:/etc/pure-ftpd# pure-pw list -f users.db
Unable to open the passwd file: No such file or directory

Maybe my build is wrong somewhere, my patches to get the compilation work were maybe a bit too hacky...

I'll try to post the makefile there tonight.


Anael

(Last edited by aorlinsk on 11 Oct 2006, 19:13)

Well, I tested pure-ftpd with exactly your options now, except for the different name of the db file and the pid file.
Still the same problem :-(
Recreating the db file doesn't help too...

Could you create a simple db file for me (one, that works on your system), for testing?
User test, password test, home = /tmp

What platform is your pure-ftpd running?
Mine is WGT634U with buildroot-ng R4927 2.6 kernel
Or does it require any other packages than libelf?

Martin

MMCM wrote:

Well, I tested pure-ftpd with exactly your options now, except for the different name of the db file and the pid file.
Still the same problem :-(
Recreating the db file doesn't help too...

Could you create a simple db file for me (one, that works on your system), for testing?
User test, password test, home = /tmp

What platform is your pure-ftpd running?
Mine is WGT634U with buildroot-ng R4927 2.6 kernel
Or does it require any other packages than libelf?

Martin

Here is what I do :
Please note that my passwd and group file looks like this :

root@OpenWrt:~# more /etc/passwd
root:ROOTPASSWORDHASH:0:0:root:/tmp:/bin/ash
nobody:*:65534:65534:nobody:/var:/bin/false
sshd:x:99:99:sshd:/var/empty/.sshd:/bin/false

root@OpenWrt:~# more /etc/group
root:x:0:
nogroup:x:65534:
sshd:x:99:

So I make your test user with uid and gid 65534

root@OpenWrt:~# rm test.pwfile
root@OpenWrt:~# pure-pw useradd test -f test.pwfile -u 65534 -g 65534 -d /tmp
Password: (test)
Enter it again: (test)
root@OpenWrt:~# more test.pwfile
test:$1$MhIDLrf0$2n26DEDQbaWTTQo.bLcZz0:65534:65534::/tmp/./::::::::::::
root@OpenWrt:~# pure-pw mkdb test.db -f test.pwfile
root@OpenWrt:~#

you can grab the files at http://aorlinsk2.free.fr/openwrt/

Anael, thanks a lot for your support!

I downloaded your file into my /etc/pure-ftpd directory and changed the command line of pure-ftpd to your test.db file.
But: still the same error.

Then I wanted to test if pure-ftpd worked with another authtype and enabled -lunix (/etc/passwd) before -lpuredb:
After doing that, I could login with the accounts in /etc/passwd AND puredb authentication suddenly worked too!
When I remove -lunix from the command line, puredb authentication returns the same error as before.

Additionally, regardless of which account I login with, I can't any see files on the ftp server, but I can CD to any directory within the account's root.
When I try to UPLOAD a file (with windows ftp or WS_FTP Pro) I get "553 I can only retrieve regular files".
The file size on the ftp server is 0 bytes after that, with the correct owner.
After that, I can see exactly the uploaded 0 byte files from the ftp client, WS_FTP Pro reports it's type as "link"!
Existing files with the same owner and/or permissions are not displayed.
Deleting those 0 byte files from the ftp client works.

Strange, isn't it?

Remark: pure-ftpd on my opensuse 10.1 works as exected, and never displayed such errand behavior.

Do you use this package on white russian, kamikaze or buildroot-ng?
Maybe this could be the cause of those problems?

best regards
Martin

(Last edited by MMCM on 13 Oct 2006, 12:28)

MMCM wrote:

Anael, thanks a lot for your support!

I downloaded your file into my /etc/pure-ftpd directory and changed the command line of pure-ftpd to your test.db file.
But: still the same error.

Then I wanted to test if pure-ftpd worked with another authtype and enabled -lunix (/etc/passwd) before -lpuredb:
After doing that, I could login with the accounts in /etc/passwd AND puredb authentication suddenly worked too!
When I remove -lunix from the command line, puredb authentication returns the same error as before.

Additionally, regardless of which account I login with, I can't any see files on the ftp server, but I can CD to any directory within the account's root.
When I try to UPLOAD a file (with windows ftp or WS_FTP Pro) I get "553 I can only retrieve regular files".
The file size on the ftp server is 0 bytes after that, with the correct owner.
After that, I can see exactly the uploaded 0 byte files from the ftp client, WS_FTP Pro reports it's type as "link"!
Existing files with the same owner and/or permissions are not displayed.
Deleting those 0 byte files from the ftp client works.

Strange, isn't it?

Remark: pure-ftpd on my opensuse 10.1 works as exected, and never displayed such errand behavior.

Do you use this package on white russian, kamikaze or buildroot-ng?
Maybe this could be the cause of those problems?

best regards
Martin

I use this package with whiterussian post-RC5 (a snapshot from about 1 month ago). I have put the source of the package on the website too (for whiterussian buildroot though). Maybe you can try to build it with the buildroot-ng by tweaking the makefile into the new format.

I don't know if you tried adding the nobody and nogroup in the /etc/passwd and /etc/group ? Maybe this could help also.

At least maybe my configure patch is a bit dirty (cross-compiling does not work else), this may explain some strange behaviour...

On my side everything works flawlessly, I own a WRTSL54GS and my ftp server maps to a 2gb usb key without problems.

Anael, I followed your advice, and built my own package for buildroot-ng.
Although this I my first package ever, with your configure patch and the instructions on http://forum.openwrt.org/viewtopic.php?pid=31794 it was not that difficult to make it.
The Makefile for buildroot-ng looks a lot simpler than yours ;-)

And the result: My first tests showed no problems at all :-)

I will do further tests in the next days, and if everything is OK, I will post it so it can be included in the buildroot-ng tree.

Again, many thanks for your support.

Martin

The discussion might have continued from here.