Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | SUMMARY = "Very Secure FTP server" |
| 2 | HOMEPAGE = "https://security.appspot.com/vsftpd.html" |
| 3 | SECTION = "net" |
| 4 | LICENSE = "GPLv2" |
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271" |
| 6 | |
| 7 | DEPENDS = "libcap openssl" |
| 8 | |
| 9 | SRC_URI = "https://security.appspot.com/downloads/vsftpd-${PV}.tar.gz \ |
| 10 | file://makefile-destdir.patch \ |
| 11 | file://makefile-libs.patch \ |
| 12 | file://makefile-strip.patch \ |
| 13 | file://init \ |
| 14 | file://vsftpd.conf \ |
| 15 | file://vsftpd.user_list \ |
| 16 | file://vsftpd.ftpusers \ |
| 17 | file://change-secure_chroot_dir.patch \ |
| 18 | file://volatiles.99_vsftpd \ |
| 19 | file://vsftpd.service \ |
| 20 | file://vsftpd-2.1.0-filter.patch \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 21 | file://0001-vsftpd-allow-syscalls-in-the-seccomp-sandbox.patch \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | ${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://vsftpd-tcp_wrappers-support.patch', '', d)} \ |
| 23 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '', '${NOPAM_SRC}', d)} \ |
| 24 | file://0001-sysdeputil.c-Fix-with-musl-which-does-not-have-utmpx.patch \ |
Andrew Geissler | 97771a3 | 2021-03-05 15:23:11 -0600 | [diff] [blame] | 25 | file://0001-seccompsandbox.c-allow-newfstatat-and-pselect6-sysca.patch \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | " |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 27 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 28 | UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/v/vsftpd/" |
| 29 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.orig\.tar" |
| 30 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 31 | LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \ |
| 32 | file://COPYRIGHT;md5=04251b2eb0f298dae376d92454f6f72e \ |
| 33 | file://LICENSE;md5=654df2042d44b8cac8a5654fc5be63eb" |
| 34 | SRC_URI[md5sum] = "da119d084bd3f98664636ea05b5bb398" |
| 35 | SRC_URI[sha256sum] = "9d4d2bf6e6e2884852ba4e69e157a2cecd68c5a7635d66a3a8cf8d898c955ef7" |
| 36 | |
| 37 | |
| 38 | PACKAGECONFIG ??= "tcp-wrappers" |
| 39 | PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 40 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 41 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" |
| 42 | RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-listfile', '', d)}" |
| 43 | PAMLIB = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -lpam', '', d)}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 44 | WRAPLIB = "${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '-lwrap', '', d)}" |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 45 | NOPAM_SRC ="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 46 | |
| 47 | inherit update-rc.d useradd systemd |
| 48 | |
| 49 | CONFFILES_${PN} = "${sysconfdir}/vsftpd.conf" |
| 50 | LDFLAGS_append =" -lcrypt -lcap" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 51 | CFLAGS_append_libc-musl = " -D_GNU_SOURCE -include fcntl.h" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 52 | EXTRA_OEMAKE = "-e MAKEFLAGS=" |
| 53 | |
| 54 | do_configure() { |
| 55 | # Fix hardcoded /usr, /etc, /var mess. |
| 56 | cat tunables.c|sed s:\"/usr:\"${prefix}:g|sed s:\"/var:\"${localstatedir}:g \ |
| 57 | |sed s:\"/etc:\"${sysconfdir}:g > tunables.c.new |
| 58 | mv tunables.c.new tunables.c |
| 59 | } |
| 60 | |
| 61 | do_compile() { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 62 | oe_runmake "LIBS=-L${STAGING_LIBDIR} -lcrypt -lcap ${PAMLIB} ${WRAPLIB}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | do_install() { |
| 66 | install -d ${D}${sbindir} |
| 67 | install -d ${D}${mandir}/man8 |
| 68 | install -d ${D}${mandir}/man5 |
| 69 | oe_runmake 'DESTDIR=${D}' install |
| 70 | install -d ${D}${sysconfdir} |
| 71 | install -m 600 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}/vsftpd.conf |
| 72 | install -d ${D}${sysconfdir}/init.d/ |
| 73 | install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/vsftpd |
| 74 | install -d ${D}/${sysconfdir}/default/volatiles |
| 75 | install -m 644 ${WORKDIR}/volatiles.99_vsftpd ${D}/${sysconfdir}/default/volatiles/99_vsftpd |
| 76 | |
| 77 | install -m 600 ${WORKDIR}/vsftpd.ftpusers ${D}${sysconfdir}/ |
| 78 | install -m 600 ${WORKDIR}/vsftpd.user_list ${D}${sysconfdir}/ |
| 79 | if ! test -z "${PAMLIB}" ; then |
| 80 | install -d ${D}${sysconfdir}/pam.d/ |
| 81 | cp ${S}/RedHat/vsftpd.pam ${D}${sysconfdir}/pam.d/vsftpd |
| 82 | sed -i "s:/lib/security:${base_libdir}/security:" ${D}${sysconfdir}/pam.d/vsftpd |
| 83 | sed -i "s:ftpusers:vsftpd.ftpusers:" ${D}${sysconfdir}/pam.d/vsftpd |
| 84 | fi |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 85 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 86 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 87 | echo "d /var/run/vsftpd/empty 0755 root root -" \ |
| 88 | > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf |
| 89 | fi |
| 90 | |
| 91 | # Install systemd unit files |
| 92 | install -d ${D}${systemd_unitdir}/system |
| 93 | install -m 0644 ${WORKDIR}/vsftpd.service ${D}${systemd_unitdir}/system |
| 94 | sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/vsftpd.service |
| 95 | } |
| 96 | |
| 97 | INITSCRIPT_PACKAGES = "${PN}" |
| 98 | INITSCRIPT_NAME_${PN} = "vsftpd" |
| 99 | INITSCRIPT_PARAMS_${PN} = "defaults 80" |
| 100 | |
| 101 | USERADD_PACKAGES = "${PN}" |
| 102 | USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp \ |
| 103 | --shell /bin/false ftp " |
| 104 | GROUPADD_PARAM_${PN} = "-r ftp" |
| 105 | |
| 106 | SYSTEMD_SERVICE_${PN} = "vsftpd.service" |
| 107 | |
| 108 | pkg_postinst_${PN}() { |
| 109 | if [ -z "$D" ]; then |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 110 | if type systemd-tmpfiles >/dev/null; then |
| 111 | systemd-tmpfiles --create |
| 112 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then |
| 113 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 114 | fi |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 115 | fi |
| 116 | } |