glfs/server/major/vsftpd.xml
2023-08-24 11:56:07 +02:00

329 lines
10 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY vsftpd-download-http "https://security.appspot.com/downloads/vsftpd-&vsftpd-version;.tar.gz">
<!ENTITY vsftpd-download-ftp " ">
<!ENTITY vsftpd-md5sum "efbf362a65bec771bc15ad311f5a982e">
<!ENTITY vsftpd-size "210 KB">
<!ENTITY vsftpd-buildsize "1.9 MB">
<!ENTITY vsftpd-time "less than 0.1 SBU">
<!ENTITY vsftpd-empty "/usr/share/vsftpd/empty">
]>
<sect1 id="vsftpd" xreflabel="vsftpd-&vsftpd-version;">
<?dbhtml filename="vsftpd.html"?>
<title>vsftpd-&vsftpd-version;</title>
<indexterm zone="vsftpd">
<primary sortas="a-vsftpd">vsftpd</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to vsftpd</title>
<para>
The <application>vsftpd</application> package contains a very
secure and very small FTP daemon. This is useful for serving files
over a network.
</para>
&lfs120_checked;
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <ulink url="&vsftpd-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url="&vsftpd-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &vsftpd-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &vsftpd-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &vsftpd-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &vsftpd-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">vsftpd Dependencies</bridgehead>
<bridgehead renderas="sect4">Required</bridgehead>
<para role="required">
<xref linkend="libnsl"/>
</para>
<bridgehead renderas="sect4">Recommended</bridgehead>
<para role="recommended">
<xref linkend="linux-pam"/>
</para>
<bridgehead renderas="sect4">Optional</bridgehead>
<para role="optional">
<xref linkend="libcap-pam"/>
</para>
</sect2>
<sect2 role="installation">
<title>Installation of vsftpd</title>
<para>
For security reasons, running <application>vsftpd</application>
as an unprivileged user and group is encouraged. Also, a user should be
created to map anonymous users. As the <systemitem
class="username">root</systemitem> user, create the needed directories,
users, and groups with the following commands:
</para>
<screen role="root"><userinput>install -v -d -m 0755 &vsftpd-empty; &amp;&amp;
install -v -d -m 0755 /home/ftp &amp;&amp;
groupadd -g 47 vsftpd &amp;&amp;
groupadd -g 45 ftp &amp;&amp;
useradd -c "vsftpd User" -d /dev/null -g vsftpd -s /bin/false -u 47 vsftpd &amp;&amp;
useradd -c anonymous_user -d /home/ftp -g ftp -s /bin/false -u 45 ftp</userinput></screen>
<para>
Gcc-10 and later flags an error for an implicit type cast. Make it
explicit:
</para>
<screen><userinput>sed -e "s/kVSFSysStrOpenUnknown;/(enum EVSFSysUtilOpenMode)&amp;/" -i sysstr.c</userinput></screen>
<para>
Build <application>vsftpd</application> as an unprivileged user
using the following command:
</para>
<screen><userinput>make</userinput></screen>
<para>
This package does not come with a test suite.
</para>
<para>
Once again, become the <systemitem class="username">root</systemitem>
user and install <application>vsftpd</application> with the following
commands:
</para>
<screen role="root"><userinput>install -v -m 755 vsftpd /usr/sbin/vsftpd &amp;&amp;
install -v -m 644 vsftpd.8 /usr/share/man/man8 &amp;&amp;
install -v -m 644 vsftpd.conf.5 /usr/share/man/man5 &amp;&amp;
install -v -m 644 vsftpd.conf /etc</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para>
<command>install -v -d ...</command>: This creates the
directory that anonymous users will use (<filename
class='directory'>/home/ftp</filename>)
and the directory the daemon will chroot into
(<filename class='directory'>&vsftpd-empty;</filename>).
</para>
<note>
<para>
<filename class="directory">/home/ftp</filename> should not be
owned by the user <systemitem class="username">vsftpd</systemitem>,
or the user <systemitem class="username">ftp</systemitem>.
</para>
</note>
<para>
<command>echo "#define VSF_BUILD_TCPWRAPPERS" >>builddefs.h</command>:
Use this prior to <command>make</command> to add support for
<application>tcpwrappers</application>.
</para>
<para>
<command>echo "#define VSF_BUILD_SSL" >>builddefs.h</command>:
Use this prior to <command>make</command> to add support for SSL.
</para>
<para>
<command>install -v -m ...</command>:
The <filename>Makefile</filename> uses non-standard installation paths.
These commands install the files in
<filename class='directory'>/usr</filename> and
<filename class='directory'>/etc</filename>.
</para>
</sect2>
<sect2 role="configuration">
<title>Configuring vsftpd</title>
<sect3 id="vsftpd-config">
<title>Config Files</title>
<para>
<filename>/etc/vsftpd.conf</filename>
</para>
<indexterm zone="vsftpd vsftpd-config">
<primary sortas="e-etc-vsftpd.conf">/etc/vsftpd.conf</primary>
</indexterm>
</sect3>
<sect3>
<title>Configuration Information</title>
<para>
<application>vsftpd</application> comes with a basic
anonymous-only configuration file that was copied to
<filename class='directory'>/etc</filename> above. While still as
<systemitem class="username">root</systemitem>, this file should be
modified because it is now recommended to run <command>vsftpd</command>
in standalone mode. Also, you
should specify the privilege separation user created above. Finally,
you should specify the <command>chroot</command> directory.
<command>man vsftpd.conf</command> will give you all the details.
</para>
<screen role="root"><userinput>cat &gt;&gt; /etc/vsftpd.conf &lt;&lt; "EOF"
<literal>background=YES
nopriv_user=vsftpd
secure_chroot_dir=&vsftpd-empty;</literal>
EOF</userinput></screen>
<!-- recheck this issue when vsftpd is updated -->
<!-- Aug'23: Cannot see any difference in behavior of vsftpd
when that option is set or not
<para>
The vsftpd daemon uses seccomp to improve security by default.
But it's known to cause vsftpd unable to handle ftp
<literal>LIST</literal> command with recent kernel versions. Append
a line to <filename>/etc/vsftpd.conf</filename> (as the
<systemitem class="username">root</systemitem> user) to disable
seccomp and workaround this issue:
</para>
<screen role="root"><userinput>cat &gt;&gt; /etc/vsftpd.conf &lt;&lt; "EOF"
<literal>seccomp_sandbox=NO</literal>
EOF</userinput></screen>
-->
<para>
To enable local logins, append the following to the
<filename>/etc/vsftpd.conf</filename> file (as the
<systemitem class="username">root</systemitem> user):
</para>
<screen role="root"><userinput>cat &gt;&gt; /etc/vsftpd.conf &lt;&lt; "EOF"
<literal>local_enable=YES</literal>
EOF</userinput></screen>
<para>
In addition, if using <application>Linux-PAM</application> and
<application>vsftpd</application> with local user logins, you will need
a <application>Linux-PAM</application> configuration file. As the
<systemitem class="username">root</systemitem> user, create the
<filename>/etc/pam.d/vsftpd</filename> file, and add the needed
configuration changes for <application>Linux-PAM</application> session
support using the following commands:
</para>
<screen role="root"><userinput>cat &gt; /etc/pam.d/vsftpd &lt;&lt; "EOF" &amp;&amp;
<literal># Begin /etc/pam.d/vsftpd
auth required /lib/security/pam_listfile.so item=user sense=deny \
file=/etc/ftpusers \
onerr=succeed
auth required pam_shells.so
auth include system-auth
account include system-account
session include system-session</literal>
EOF
cat &gt;&gt; /etc/vsftpd.conf &lt;&lt; "EOF"
<literal>session_support=YES
pam_service_name=vsftpd</literal>
EOF</userinput></screen>
</sect3>
<sect3 id="vsftpd-init">
<title><phrase revision="sysv">Boot Script</phrase>
<phrase revision="systemd">Systemd Unit</phrase></title>
<para>
Install the
<phrase revision="sysv"><filename>/etc/rc.d/init.d/vsftpd</filename>
init script</phrase>
<phrase revision="systemd"><filename>vsftpd.service</filename>
unit</phrase> included in the
<xref linkend="bootscripts" revision="sysv"/>
<xref linkend="systemd-units" revision="systemd"/> package:
</para>
<screen role="root"><userinput>make install-vsftpd</userinput></screen>
</sect3>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Program</segtitle>
<segtitle>Installed Libraries</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>vsftpd</seg>
<seg>None</seg>
<seg>/usr/share/vsftpd, /home/ftp</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="vsftpd-prog">
<term><command>vsftpd</command></term>
<listitem>
<para>
is the FTP daemon
</para>
<indexterm zone="vsftpd vsftpd-prog">
<primary sortas="b-vsftpd">vsftpd</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>