blob: 2e3e0e8843d278ebd691606d58f1060e97b858cf [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "Very Secure FTP server"
2HOMEPAGE = "https://security.appspot.com/vsftpd.html"
3SECTION = "net"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271"
6
7DEPENDS = "libcap openssl"
8
9SRC_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 Williamsddad1a12017-02-23 20:36:32 -060021 file://0001-vsftpd-allow-sysinfo-in-the-seccomp-sandbox.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022 ${@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 Williamsb48b7b42016-08-17 15:04:38 -050026
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/v/vsftpd/"
28UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.orig\.tar"
29
Patrick Williamsb48b7b42016-08-17 15:04:38 -050030LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \
31 file://COPYRIGHT;md5=04251b2eb0f298dae376d92454f6f72e \
32 file://LICENSE;md5=654df2042d44b8cac8a5654fc5be63eb"
33SRC_URI[md5sum] = "da119d084bd3f98664636ea05b5bb398"
34SRC_URI[sha256sum] = "9d4d2bf6e6e2884852ba4e69e157a2cecd68c5a7635d66a3a8cf8d898c955ef7"
35
36
37PACKAGECONFIG ??= "tcp-wrappers"
38PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050039
Patrick Williamsddad1a12017-02-23 20:36:32 -060040DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
41RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-listfile', '', d)}"
42PAMLIB = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -lpam', '', d)}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050043WRAPLIB = "${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '-lwrap', '', d)}"
Patrick Williamsddad1a12017-02-23 20:36:32 -060044NOPAM_SRC ="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050045
46inherit update-rc.d useradd systemd
47
48CONFFILES_${PN} = "${sysconfdir}/vsftpd.conf"
49LDFLAGS_append =" -lcrypt -lcap"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080050CFLAGS_append_libc-musl = " -D_GNU_SOURCE -include fcntl.h"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050051EXTRA_OEMAKE = "-e MAKEFLAGS="
52
53do_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
60do_compile() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050061 oe_runmake "LIBS=-L${STAGING_LIBDIR} -lcrypt -lcap ${PAMLIB} ${WRAPLIB}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050062}
63
64do_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 Williamsddad1a12017-02-23 20:36:32 -060084 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050085 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
96INITSCRIPT_PACKAGES = "${PN}"
97INITSCRIPT_NAME_${PN} = "vsftpd"
98INITSCRIPT_PARAMS_${PN} = "defaults 80"
99
100USERADD_PACKAGES = "${PN}"
101USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp \
102 --shell /bin/false ftp "
103GROUPADD_PARAM_${PN} = "-r ftp"
104
105SYSTEMD_SERVICE_${PN} = "vsftpd.service"
106
107pkg_postinst_${PN}() {
108 if [ -z "$D" ]; then
Patrick Williamsddad1a12017-02-23 20:36:32 -0600109 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 Williamsb48b7b42016-08-17 15:04:38 -0500114 fi
115}