Bug 201192

Summary: vsftpd replaces named pipe file as regular file
Product: Red Hat Enterprise Linux 3 Reporter: M A Cargill <marshac>
Component: vsftpdAssignee: Maros Barabas <mbarabas>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: averma, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-19 18:42:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
vsftpd configuration none

Description M A Cargill 2006-08-03 14:37:42 UTC
Description of problem:
This problem with vsftpd that started after new version 3 Red Hat Enterprise
Linux update 8 (vsftpd-1.2.1-3E.6-i386.rpm) that was installed 7/27/06. I am
reporting it here as recommended by Red Hat Service Request people.

We have an application that ftps files down a named pipe on this Red Hat system
from another local computer within the firewall controlled by program. It's
been working and running unchanged since May. We have a user/group for
this purpose. It is not an anonymous ftp.
Now when the program runs, the file that is ftp'ed ends up replacing the pipe
file as a regular file and therefore the rest of the commands then are stopped
from being sent and the whole procedure is broken.

I have rolled back this new version of vsftpd using 'rpm --oldpackage' and the
problem is gone.

Version-Release number of selected component (if applicable):
vsftpd-1.2.1-3E.6-i386.rpm

How reproducible:
easily

Steps to Reproduce:
I am able to duplicate the problem easily by creating a pipe file with
'mkfifo pipefilename'
on the Red Hat system running vsftpd. 
Then when I ftp from the other system and execute the command:
'put filename pipefilename'
The pipefile on Red Hat becomes a regular file.
1.
2.
3.
  
Actual results:
pipefile becomes a regular file with the contents of the ftp put file

Expected results:
553 Could not create file.
and the pipe file remains intact as a named pipe file.
Please note: This is a simple method for testing. Under program control it
behaves differently and better.

Additional info:

Comment 1 M A Cargill 2006-08-03 14:37:42 UTC
Created attachment 133558 [details]
vsftpd configuration

Comment 10 Maros Barabas 2007-05-23 07:35:30 UTC
Please test this issue with vsftpd-1.2.1-3E.11. It works for me. Thanks

Comment 11 Maros Barabas 2007-05-23 08:43:58 UTC
You can find srpm on:
http://people.redhat.com/rbiba/maros/vsftpd-1.2.1-3E.11.src.rpm

Comment 12 M A Cargill 2007-05-23 15:25:52 UTC
(In reply to comment #11)
> You can find srpm on:
> http://people.redhat.com/rbiba/maros/vsftpd-1.2.1-3E.11.src.rpm
Hi,
I followed your instructions and upgraded the src. It complained about user 
barry otherwise it seemed ok. The files in /usr/src/redhat were updated. This 
is what I entered:

rpm -Uvh vsftpd-1.2.1-3E.11.src.rpm

However, when I queried the rpm it doesn't seem updated as follows:

ddiweb1 /home/cargill (root): 69> rpm -qil vsftpd
Name        : vsftpd                       Relocations: (not relocatable)
Version     : 1.2.1                             Vendor: Red Hat, Inc.
Release     : 3E.1                          Build Date: Mon 04 Oct 2004 
05:42:59 AM CDT
Install Date: Tue 22 Aug 2006 12:56:24 PM CDT      Build Host: 
tweety.build.redhat.com
Group       : System Environment/Daemons    Source RPM: vsftpd-1.2.1-
3E.1.src.rpm
Size        : 188857                           License: GPL
Signature   : DSA/SHA1, Wed 17 Nov 2004 03:40:58 PM CST, Key ID 219180cddb42a60e
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://vsftpd.beasts.org/
Summary     : vsftpd - Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.
/etc/logrotate.d/vsftpd.log
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd.ftpusers
/etc/vsftpd.user_list
/etc/vsftpd/vsftpd.conf
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-1.2.1
/usr/share/doc/vsftpd-1.2.1/AUDIT
/usr/share/doc/vsftpd-1.2.1/BUGS
/usr/share/doc/vsftpd-1.2.1/Changelog
/usr/share/doc/vsftpd-1.2.1/FAQ
/usr/share/doc/vsftpd-1.2.1/INSTALL
/usr/share/doc/vsftpd-1.2.1/LICENSE
/usr/share/doc/vsftpd-1.2.1/README
/usr/share/doc/vsftpd-1.2.1/README.security
/usr/share/doc/vsftpd-1.2.1/REWARD
/usr/share/doc/vsftpd-1.2.1/SECURITY
/usr/share/doc/vsftpd-1.2.1/SECURITY/DESIGN
/usr/share/doc/vsftpd-1.2.1/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-1.2.1/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-1.2.1/SECURITY/TRUST
/usr/share/doc/vsftpd-1.2.1/SIZE
/usr/share/doc/vsftpd-1.2.1/SPEED
/usr/share/doc/vsftpd-1.2.1/TODO
/usr/share/doc/vsftpd-1.2.1/TUNING
/usr/share/doc/vsftpd-1.2.1/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub

I stopped and started the vsftpd process and it does still work with the pipe 
procedure. So if I am running the new one. Thanks. If I didn't get it 
installed, please advise.

Thanks, Marsha

Comment 13 Maros Barabas 2007-05-23 17:37:21 UTC
Hi,

please follow instructions below:

1. download vsftpd-1.2.1-3E.11.src.rpm
2. install src.rpm as root with command: rpm -ivh vsftpd-1.2.1-3E-11.src.rpm
3. make rpm with command: rpmbuild -bb /usr/src/redhat/SPECS/vsftpd.spec
4. update vsftpd with command: rpm -Uvh
/usr/src/redhat/RPMS/vsftpd-1.2.1-3E-12.<arch>.rpm

<arch> is x86_64 or x86
Please don't be confused with version 12 of vsftpd. It's newer todays version.
Thanks

Comment 14 M A Cargill 2007-05-24 14:37:22 UTC
Hi there,

Sorry to be so clueless. The instructions were a great help. I got version 
vsftpd-1.2.1-3E.12.i386.rpm installed. Unfortunately, it broke my pipe file 
just like vsftpd-1.2.1-3E.6-i386.rpm does. I am putting back the old version so 
my apps work for now. Please let me know what info I can provide. I can re-
install your new version anytime for a few minutes if you'd like. Here's the 
rpm details if that is useful:

rpm -qil vsftpd
Name        : vsftpd                       Relocations: (not relocatable)
Version     : 1.2.1                             Vendor: (none)
Release     : 3E.12                         Build Date: Thu 24 May 2007 
09:13:50 AM CDT
Install Date: Thu 24 May 2007 09:19:10 AM CDT      Build Host: ddiweb1
Group       : System Environment/Daemons    Source RPM: vsftpd-1.2.1-
3E.12.src.rpm
Size        : 189194                           License: GPL
Signature   : (none)
URL         : http://vsftpd.beasts.org/
Summary     : vsftpd - Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.
/etc/logrotate.d/vsftpd.log
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd.ftpusers
/etc/vsftpd.user_list
/etc/vsftpd/vsftpd.conf
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-1.2.1
/usr/share/doc/vsftpd-1.2.1/AUDIT
/usr/share/doc/vsftpd-1.2.1/BUGS
/usr/share/doc/vsftpd-1.2.1/Changelog
/usr/share/doc/vsftpd-1.2.1/FAQ
/usr/share/doc/vsftpd-1.2.1/INSTALL
/usr/share/doc/vsftpd-1.2.1/LICENSE
/usr/share/doc/vsftpd-1.2.1/README
/usr/share/doc/vsftpd-1.2.1/README.security
/usr/share/doc/vsftpd-1.2.1/REWARD
/usr/share/doc/vsftpd-1.2.1/SECURITY
/usr/share/doc/vsftpd-1.2.1/SECURITY/DESIGN
/usr/share/doc/vsftpd-1.2.1/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-1.2.1/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-1.2.1/SECURITY/TRUST
/usr/share/doc/vsftpd-1.2.1/SIZE
/usr/share/doc/vsftpd-1.2.1/SPEED
/usr/share/doc/vsftpd-1.2.1/TODO
/usr/share/doc/vsftpd-1.2.1/TUNING
/usr/share/doc/vsftpd-1.2.1/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub

Thank you,
Marsha

Comment 15 Maros Barabas 2007-05-28 10:21:58 UTC
Please read my steps below and/or send me more detailed (if it's possible) steps
to reproduce because I can't find the error with version 1.2.1-3E.12.

My steps:

1. mkfifo ~test/pipefilename
2. start vsftpd (1.2.1-3E.12)
3. login as user "test"
5. get dir-listing: 
     > ls
     prw-rw-rw-    1 0        0               0 May 28 09:57 pipefilename
     -rw-rw-r--    1 500      500           100 May 28 09:12 test
6. put file over pipefile: 
     > put test pipefilename
     local: test remote: pipefilename
     227 Entering Passive Mode (127,0,0,1,155,185)
     553 Could not create file.
7. end ftp connection get dir-listing:
     prw-rw-rw- 1 root  root      0 May 28 11:57 pipefilename
     -rw-rw-r-- 1 barry barry   100 May 28 11:12 test

Am I done something wrong ?

Thanks

Comment 16 M A Cargill 2007-05-29 14:59:58 UTC
Good morning,

I apologize. Part of the 'expected results' originally sent with this report 
are not correct.

There should be no "553 Could not create file" reported. Only normal, 
successful ftp transfer message should appear.

The example you set up should be satisfactory for testing purposes. But the 
results should be much different:

o You should NOT receive the "553 Could not create file" message.
o The test file should NOT end up in the destination directory.

When a regular (text) file is copied to a named pipe file, either locally with 
cp or remotely via ftp (when both a source and destination file are included, 
as in your example) the pipe file should NOT be replaced; only the CONTENTS of 
the source file ('test' in your example) is PASSED THROUGH the pipe file to any 
application that might happen to have the pipe file open on the destination 
machine. In your example, there is no such application so the data passed would 
just 'disappear'. The directory on the destination machine should stay 
unchanged, but NO FTP TRANSFER ERRORS will be reported.

Pipe files, by their very nature, are designed for this purpose.

Sorry for the misinformation. I was trying to simplify your testing and 
misunderstood. Bob, who wrote our pipe applications has put this explanation 
together for you. Hope it helps.

Marsha

Comment 17 Maros Barabas 2007-10-17 08:45:08 UTC
Hi again, 

   please try the new version (link below). I provide a patch to repaire this
issue. 

The only problem is that the pipefile is opened as non-block file. In this case
if there is no process listening on the pipe, server ends with "553 Could not
create file". If pipefile will be opened as block file client will hang up (with
no chance to interrupt, because kernel is blocking your client). This is normal
linux behaviour.

Please let me know your results. Thanks

Link: http://mbarabas.fedorapeople.org/vsftpd-1.2.1-3E.15.src.rpm

Comment 18 RHEL Program Management 2007-10-19 18:42:06 UTC
This bug is filed against RHEL 3, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products. Since
this bug does not meet that criteria, it is now being closed.
 
For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/
 
If you feel this bug is indeed mission critical, please contact your
support representative. You may be asked to provide detailed
information on how this bug is affecting you.