vsftpd started even if not in standalone mode

Bug #648202 reported by Stephane Chazelas on 2010-09-26
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
vsftpd (Ubuntu)
Wishlist
Unassigned
Lucid
Medium
Unassigned
Maverick
Medium
Unassigned

Bug Description

Binary package hint: vsftpd

(lucid vsftpd 2.2.2-3ubuntu6)

because of a syntax error in /etc/init/vsftpd.con, vsftd is started (and respawns a lot as it fails to start) if there's no "listen=yes" in /etc/vsftpd.conf

/etc/init/vsftpd.conf has:

                if [ -e "${CONFFILE}" ] && !egrep -iq "^ *listen(_ipv6)? *= *yes" "${CONFFILE}"

without space between ! and egrep. As a result !egrep returns with an error ("!egrep" command not found) and as a result, the script assumes the "listen = yes" line is in the file.

Moreover, if the /etc/vsftpd.conf file is not there, vsftpd is also started which I suspect was not intended.

Moreover egrep is not a POSIX command.

Would be better written as:

if ! grep -qEis -- '^[[:blank:]]*listen(_ipv6)?[[:blank:]]*=[[:blank:]]*yes' "$CONFFILE"; then...

=======
SRU Justification

IMPACT: See above description to see the its impact.

REPRODUCE:

 1. First edit the configure (/etc/vsftpd.conf) and comment the line "listen=yes".
 2. Then start vsftpd: sudo service vsftpd start
 3. Upstart will report that the service has been started (start/running), when it should have failed to start because the upstart job does the configuration check (stop/pre-start).

HOW FIXED: Add a blank space between ! and egrep as specified above. Also, instead of using 'exit 0' use stop within the upstart job.

PATCH: Attached. Uploaded to lucid-proposed for review there.

REGRESSION POTENTIAL: Minimal. I've tested this throughly and works as expected. (See C-de Avillez comment #2 on how this is supposed to work.

=======

Related branches

Also, I suspect the last line of the pre-start script should be:

check_standalone_mode || stop

instead of:

check_standalone_mode || exit 0

which is a no-op except for the message that check_standalone_mode might display.

C de-Avillez (hggdh2) wrote :

Confirmed on Maverick, could not check Lucid. Some details:

1. it seems it is 'exit 0' that causes fast respawning: after I corrected the '!egrep' syntax, I still got the fast respawn (now check_standalone_mode returns 0, and the 'or' clause is executed).

2. with both lines changed as suggested, a 'sudo start vsftpd' now gives:

cerdea@xango2:/etc/init$ sudo start vsftpd
vsftpd stop/pre-start, process 8508
cerdea@xango2:/etc/init$ initctl list | grep vsftpd
vsftpd stop/waiting
cerdea@xango2:/etc/init$

Changed in vsftpd (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Imre Gergely (cemc) wrote :

I can confirm this exists on Lucid, and the proposed fixes work also.

One thing I don't get is, where does this line appear:

     echo "${CONFFILE}: listen disabled - service will not start"

I couldn't find it anywhere, shouldn't it appear on the console when I do 'start vsftpd' ?

Changed in vsftpd (Ubuntu Lucid):
status: New → Confirmed
Imre Gergely (cemc) wrote :

This should be SRU'd after bug #629234 IMHO. The fix for bug #/577165 should be added here also, as it is a minor change to vsftpd.conf (and only to Lucid). See that bug for a patch.

Changed in vsftpd (Ubuntu):
assignee: nobody → Andres Rodriguez (andreserl)
status: Confirmed → Triaged
status: Triaged → In Progress
Andres Rodriguez (andreserl) wrote :
Changed in vsftpd (Ubuntu):
status: In Progress → Confirmed
importance: Low → Wishlist
assignee: Andres Rodriguez (andreserl) → nobody
Andres Rodriguez (andreserl) wrote :

Natty debdiff attached.

Changed in vsftpd (Ubuntu Lucid):
status: Confirmed → In Progress
Changed in vsftpd (Ubuntu Maverick):
status: Confirmed → In Progress
Changed in vsftpd (Ubuntu Lucid):
status: In Progress → Confirmed
Changed in vsftpd (Ubuntu Maverick):
status: In Progress → Confirmed
Changed in vsftpd (Ubuntu Lucid):
assignee: nobody → Andres Rodriguez (andreserl)
status: Confirmed → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vsftpd - 2.3.2-3ubuntu3

---------------
vsftpd (2.3.2-3ubuntu3) natty; urgency=low

  * debian/vsftpd.upstart: Fix start of vsftpd even if not in standalone mode.
    Thanks to Stephane Chazelas (LP: #648202)
 -- Andres Rodriguez <email address hidden> Fri, 25 Feb 2011 15:16:09 -0500

Changed in vsftpd (Ubuntu):
status: Confirmed → Fix Released
description: updated
Changed in vsftpd (Ubuntu Lucid):
status: In Progress → Confirmed
importance: Undecided → Low
importance: Low → Medium
Changed in vsftpd (Ubuntu Maverick):
importance: Low → Medium
Changed in vsftpd (Ubuntu Lucid):
assignee: Andres Rodriguez (andreserl) → nobody
Andres Rodriguez (andreserl) wrote :

Attaching lucid SRU debdiff. This also fixes:

Typo in /etc/vsftpd.conf: bug #577165
Postinst failed to install/upgrade: bug #629234
Postinst check for vsftpd user/group: bug #677764

Andres Rodriguez (andreserl) wrote :

Attaching maverick SRU debdiff. This also fixes:

Postinst check for vsftpd user/group: bug #677764

Martin Pitt (pitti) wrote :

Sponsored maverick upload.

Changed in vsftpd (Ubuntu Maverick):
status: Confirmed → Fix Committed

Accepted vsftpd into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Martin Pitt (pitti) wrote :

There are two conflicting vsftpd uploads in the lucid-proposed queue:

 vsftpd (2.2.2-3ubuntu6.1) lucid-proposed; urgency=low
 .
   * debian/vsftpd.postinst: (LP: #709194)
     - Update conditional to fix upgrade issue when user exists, but group does not

 vsftpd (2.2.2-3ubuntu6.1) lucid-proposed; urgency=low
 .
   [ Andres Rodriguez ]
   * debian/vsftpd.upstart:
     - Fix typo. Thanks to JÃŒrgen Kreileder (LP: #577165)
     - Fix start of vsftpd even if not in standalone mode. Thanks to
       Stephane Chazelas (LP: #648202)
 .
   [ Dustin Kirkland, Serge Hallyn ]
   * debian/vsftpd.postinst: Check that the group exists first, then the user,
     then try adding the user to the group. (LP: #629234, LP: #677764)

I rejected them both. Please reupload a merged version. Thanks!

tags: removed: verification-needed
Andres Rodriguez (andreserl) wrote :

I have tested this (as part of bug #677764) and everything work as expected (from -proposed). Marking this as verification-done

tags: added: verification-done
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vsftpd - 2.3.0~pre2-4ubuntu2.1

---------------
vsftpd (2.3.0~pre2-4ubuntu2.1) maverick-proposed; urgency=low

  [ Andres Rodriguez ]
  * debian/vsftpd.upstart: Fix start of vsftpd even if not in standalone mode.
    Thanks to Stephane Chazelas (LP: #648202)

  [ Serge Hallyn ]
  * debian/vsftpd.postinst: Use complete name match when checking for existing
    ftp user/group, to avoid install failure. (LP: #677764)
 -- Andres Rodriguez <email address hidden> Wed, 02 Mar 2011 12:11:46 +0100

Changed in vsftpd (Ubuntu Maverick):
status: Fix Committed → Fix Released
Clint Byrum (clint-fewbar) wrote :

APPROVED: the package version 2.2.2-3ubuntu6.2 uploaded to lucid-proposed should be accepted.

Martin Pitt (pitti) wrote :

Accepted vsftpd into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in vsftpd (Ubuntu Lucid):
status: Confirmed → Fix Committed
tags: removed: verification-done
tags: added: verification-needed
Imre Gergely (cemc) wrote :

Package from -proposed tested and working as expected on Lucid:

=== BEFORE:
root@utest-lls32:~# apt-cache policy vsftpd
vsftpd:
  Installed: 2.2.2-3ubuntu6.1
  Candidate: 2.2.2-3ubuntu6.1

root@utest-lls32:~# grep listen= /etc/vsftpd.conf
#listen=YES

root@utest-lls32:~# start vsftpd
vsftpd start/running, process 1608

root@utest-lls32:~# ps ax |grep vsftpd
 1640 pts/0 S+ 0:00 grep --color=auto vsftpd
root@utest-lls32:~#

root@utest-lls32:~# grep "too fast" /var/log/syslog
Apr 25 22:17:17 utest-lls32 init: vsftpd respawning too fast, stopped

=== AFTER:
root@utest-lls32:~# apt-cache policy vsftpd
vsftpd:
  Installed: 2.2.2-3ubuntu6.2
  Candidate: 2.2.2-3ubuntu6.2

root@utest-lls32:~# grep listen= /etc/vsftpd.conf
#listen=YES

root@utest-lls32:~# start vsftpd
vsftpd stop/pre-start, process 1845

root@utest-lls32:~# ps ax |grep vsftpd
 1849 pts/0 S+ 0:00 grep --color=auto vsftpd

Andres Rodriguez (andreserl) wrote :

Thank you for your testing Imre.

Marking as verification done. Thanks

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vsftpd - 2.2.2-3ubuntu6.2

---------------
vsftpd (2.2.2-3ubuntu6.2) lucid-proposed; urgency=low

  * debian/vsftpd.upstart:
    - Fix typo. Thanks to Jürgen Kreileder (LP: #577165)
    - Fix start of vsftpd even if not in standalone mode. Thanks to
      Stephane Chazelas (LP: #648202)

  [ Dustin Kirkland, Serge Hallyn ]
  * debian/vsftpd.postinst: Check that the group exists first, then the user,
    then try adding the user to the group. (LP: #629234, LP: #677764)
 -- Andres Rodriguez <email address hidden> Wed, 13 Apr 2011 18:34:25 -0400

Changed in vsftpd (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers