From 5b80bfd7bffd4c20d80b7c70a7130529e9a755dd Mon Sep 17 00:00:00 2001 From: ToshikazuOhiwa Date: Mon, 30 Mar 2020 09:24:26 +0900 Subject: agl-basesystem --- .../vsftpd/files/change-secure_chroot_dir.patch | 62 +++++++++ .../recipes-daemons/vsftpd/files/init | 50 ++++++++ .../vsftpd/files/volatiles.99_vsftpd | 1 + .../recipes-daemons/vsftpd/files/vsftpd.conf | 139 +++++++++++++++++++++ .../recipes-daemons/vsftpd/files/vsftpd.ftpusers | 15 +++ .../recipes-daemons/vsftpd/files/vsftpd.service | 9 ++ .../recipes-daemons/vsftpd/files/vsftpd.user_list | 20 +++ 7 files changed, 296 insertions(+) create mode 100644 external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/change-secure_chroot_dir.patch create mode 100755 external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/init create mode 100644 external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/volatiles.99_vsftpd create mode 100644 external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.conf create mode 100644 external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.ftpusers create mode 100644 external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.service create mode 100644 external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.user_list (limited to 'external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files') diff --git a/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/change-secure_chroot_dir.patch b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/change-secure_chroot_dir.patch new file mode 100644 index 00000000..b69de1d1 --- /dev/null +++ b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/change-secure_chroot_dir.patch @@ -0,0 +1,62 @@ +From ce2be5d4967445828d5ae9d9462cfaa78ae03c73 Mon Sep 17 00:00:00 2001 +From: Ming Liu +Date: Wed, 18 Sep 2013 09:44:20 +0800 +Subject: [PATCH] vsftpd: change default value of secure_chroot_dir + +Upstream-Status: Pending + +Change secure_chroot_dir pointing to a volatile directory. + +Signed-off-by: Ming Liu + +--- + INSTALL | 6 +++--- + tunables.c | 2 +- + vsftpd.conf.5 | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/INSTALL b/INSTALL +index 4f811aa..427122a 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -27,11 +27,11 @@ user in case it does not already exist. e.g.: + [root@localhost root]# useradd nobody + useradd: user nobody exists + +-2b) vsftpd needs the (empty) directory /usr/share/empty in the default ++2b) vsftpd needs the (empty) directory /var/run/vsftpd/empty in the default + configuration. Add this directory in case it does not already exist. e.g.: + +-[root@localhost root]# mkdir /usr/share/empty/ +-mkdir: cannot create directory `/usr/share/empty': File exists ++[root@localhost root]# mkdir /var/run/vsftpd/empty/ ++mkdir: cannot create directory `/var/run/vsftpd/empty': File exists + + 2c) For anonymous FTP, you will need the user "ftp" to exist, and have a + valid home directory (which is NOT owned or writable by the user "ftp"). +diff --git a/tunables.c b/tunables.c +index 284a10d..8c63c3f 100644 +--- a/tunables.c ++++ b/tunables.c +@@ -254,7 +254,7 @@ tunables_load_defaults() + /* -rw------- */ + tunable_chown_upload_mode = 0600; + +- install_str_setting("/usr/share/empty", &tunable_secure_chroot_dir); ++ install_str_setting("/var/run/vsftpd/empty", &tunable_secure_chroot_dir); + install_str_setting("ftp", &tunable_ftp_username); + install_str_setting("root", &tunable_chown_username); + install_str_setting("/var/log/xferlog", &tunable_xferlog_file); +diff --git a/vsftpd.conf.5 b/vsftpd.conf.5 +index fcc6022..e4ffdee 100644 +--- a/vsftpd.conf.5 ++++ b/vsftpd.conf.5 +@@ -969,7 +969,7 @@ This option should be the name of a directory which is empty. Also, the + directory should not be writable by the ftp user. This directory is used + as a secure chroot() jail at times vsftpd does not require filesystem access. + +-Default: /usr/share/empty ++Default: /var/run/vsftpd/empty + .TP + .B ssl_ciphers + This option can be used to select which SSL ciphers vsftpd will allow for diff --git a/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/init b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/init new file mode 100755 index 00000000..72adf0d9 --- /dev/null +++ b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/init @@ -0,0 +1,50 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: vsftpd +# Default-Start: 2345 +# Default-Stop: 016 +# Short-Description: Very Secure Ftp Daemon +# Description: vsftpd is a Very Secure FTP daemon. It was written completely from +# scratch +### END INIT INFO + +DAEMON=/usr/sbin/vsftpd +NAME=vsftpd +DESC="FTP Server" +ARGS="" +FTPDIR=/var/lib/ftp + +test -f $DAEMON || exit 0 + +set -e + +case "$1" in + start) + echo -n "* starting $DESC: $NAME... " + if ! test -d $FTPDIR; then + mkdir -p $FTPDIR/in + chown ftp $FTPDIR -R + chmod a-w $FTPDIR + chmod u+w $FTPDIR/in + fi + start-stop-daemon -S -b -x $DAEMON -- $ARGS + echo "done." + ;; + stop) + echo -n "* stopping $DESC: $NAME... " + start-stop-daemon -K -x $DAEMON + echo "done." + ;; + restart) + echo "* restarting $DESC: $NAME... " + $0 stop + $0 start + echo "done." + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + +exit 0 diff --git a/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/volatiles.99_vsftpd b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/volatiles.99_vsftpd new file mode 100644 index 00000000..8a602ba3 --- /dev/null +++ b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/volatiles.99_vsftpd @@ -0,0 +1 @@ +d root root 0755 /var/run/vsftpd/empty none diff --git a/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.conf b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.conf new file mode 100644 index 00000000..bb192948 --- /dev/null +++ b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.conf @@ -0,0 +1,139 @@ +# Example config file /etc/vsftpd.conf +# +# The default compiled in settings are fairly paranoid. This sample file +# loosens things up a bit, to make the ftp daemon more usable. +# Please see vsftpd.conf.5 for all compiled in defaults. +# +# READ THIS: This example file is NOT an exhaustive list of vsftpd options. +# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's +# capabilities. + +# run standalone +listen=YES + +# Allow anonymous FTP? (Beware - allowed by default if you comment this out). +anonymous_enable=NO +# +# Uncomment this to allow local users to log in. +local_enable=YES +# +# Uncomment this to enable any form of FTP write command. +write_enable=YES +# +# Default umask for local users is 077. You may wish to change this to 022, +# if your users expect that (022 is used by most other ftpd's) +local_umask=022 +# +# Uncomment this to allow the anonymous FTP user to upload files. This only +# has an effect if the above global write enable is activated. Also, you will +# obviously need to create a directory writable by the FTP user. +#anon_upload_enable=YES +# +# Uncomment this if you want the anonymous FTP user to be able to create +# new directories. +#anon_mkdir_write_enable=YES +# +# Activate directory messages - messages given to remote users when they +# go into a certain directory. +dirmessage_enable=YES +# +# Activate logging of uploads/downloads. +xferlog_enable=YES +# +# Make sure PORT transfer connections originate from port 20 (ftp-data). +connect_from_port_20=YES +# +# If you want, you can arrange for uploaded anonymous files to be owned by +# a different user. Note! Using "root" for uploaded files is not +# recommended! +#chown_uploads=YES +#chown_username=whoever +# +# You may override where the log file goes if you like. The default is shown +# below. +#xferlog_file=/var/log/vsftpd.log +# +# If you want, you can have your log file in standard ftpd xferlog format +xferlog_std_format=YES +# +# You may change the default value for timing out an idle session. +#idle_session_timeout=600 +# +# You may change the default value for timing out a data connection. +#data_connection_timeout=120 +# +# It is recommended that you define on your system a unique user which the +# ftp server can use as a totally isolated and unprivileged user. +#nopriv_user=ftp +# +# Enable this and the server will recognise asynchronous ABOR requests. Not +# recommended for security (the code is non-trivial). Not enabling it, +# however, may confuse older FTP clients. +#async_abor_enable=YES +# +# By default the server will pretend to allow ASCII mode but in fact ignore +# the request. Turn on the below options to have the server actually do ASCII +# mangling on files when in ASCII mode. +# Beware that turning on ascii_download_enable enables malicious remote parties +# to consume your I/O resources, by issuing the command "SIZE /big/file" in +# ASCII mode. +# These ASCII options are split into upload and download because you may wish +# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking), +# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be +# on the client anyway.. +#ascii_upload_enable=YES +#ascii_download_enable=YES +# +# You may fully customise the login banner string: +#ftpd_banner=Welcome to blah FTP service. +# +# You may specify a file of disallowed anonymous e-mail addresses. Apparently +# useful for combatting certain DoS attacks. +#deny_email_enable=YES +# (default follows) +#banned_email_file=/etc/vsftpd.banned_emails +# +# You may specify an explicit list of local users to chroot() to their home +# directory. If chroot_local_user is YES, then this list becomes a list of +# users to NOT chroot(). +#chroot_list_enable=YES +# (default follows) +#chroot_list_file=/etc/vsftpd.chroot_list +# +# You may activate the "-R" option to the builtin ls. This is disabled by +# default to avoid remote users being able to cause excessive I/O on large +# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume +# the presence of the "-R" option, so there is a strong case for enabling it. +#ls_recurse_enable=YES +# +# This string is the name of the PAM service vsftpd will use. +pam_service_name=vsftpd +# +# This option is examined if userlist_enable is activated. If you set this +# setting to NO, then users will be denied login unless they are explicitly +# listed in the file specified by userlist_file. When login is denied, the +# denial is issued before the user is asked for a password. +userlist_deny=YES +# +# If enabled, vsftpd will load a list of usernames, from the filename given by +# userlist_file. If a user tries to log in using a name in this file, they +# will be denied before they are asked for a password. This may be useful in +# preventing cleartext passwords being transmitted. See also userlist_deny. +userlist_enable=YES +# +# If enabled, vsftpd will display directory listings with the time in your +# local time zone. The default is to display GMT. The times returned by the +# MDTM FTP command are also affected by this option. +use_localtime=YES +# +# If set to YES, local users will be (by default) placed in a chroot() jail in +# their home directory after login. Warning: This option has security +# implications, especially if the users have upload permission, or shell access. +# Only enable if you know what you are doing. Note that these security implications +# are not vsftpd specific. They apply to all FTP daemons which offer to put +# local users in chroot() jails. +chroot_local_user=YES +# +allow_writeable_chroot=YES +# +tcp_wrappers=YES diff --git a/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.ftpusers b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.ftpusers new file mode 100644 index 00000000..096142f5 --- /dev/null +++ b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.ftpusers @@ -0,0 +1,15 @@ +# Users that are not allowed to login via ftp +root +bin +daemon +adm +lp +sync +shutdown +halt +mail +news +uucp +operator +games +nobody diff --git a/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.service b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.service new file mode 100644 index 00000000..e2710202 --- /dev/null +++ b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Vsftpd ftp daemon +After=network.target + +[Service] +ExecStart=@SBINDIR@/vsftpd + +[Install] +WantedBy=multi-user.target diff --git a/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.user_list b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.user_list new file mode 100644 index 00000000..d283e3d2 --- /dev/null +++ b/external/meta-openembedded/meta-networking/recipes-daemons/vsftpd/files/vsftpd.user_list @@ -0,0 +1,20 @@ +# vsftpd userlist +# If userlist_deny=NO, only allow users in this file +# If userlist_deny=YES (default), never allow users in this file, and +# do not even prompt for a password. +# Note that the default vsftpd pam config also checks /etc/vsftpd.ftpusers +# for users that are denied. +root +bin +daemon +adm +lp +sync +shutdown +halt +mail +news +uucp +operator +games +nobody -- cgit 1.2.3-korg