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