blob: 024b776def7deaf51391693ed8c166c2b0c435eb [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 \
Brad Bishop19323692019-04-05 15:28:33 -040021 file://0001-vsftpd-allow-syscalls-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 \
Andrew Geissler97771a32021-03-05 15:23:11 -060025 file://0001-seccompsandbox.c-allow-newfstatat-and-pselect6-sysca.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026 "
Patrick Williamsb48b7b42016-08-17 15:04:38 -050027
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/v/vsftpd/"
29UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.orig\.tar"
30
Patrick Williamsb48b7b42016-08-17 15:04:38 -050031LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \
32 file://COPYRIGHT;md5=04251b2eb0f298dae376d92454f6f72e \
33 file://LICENSE;md5=654df2042d44b8cac8a5654fc5be63eb"
34SRC_URI[md5sum] = "da119d084bd3f98664636ea05b5bb398"
35SRC_URI[sha256sum] = "9d4d2bf6e6e2884852ba4e69e157a2cecd68c5a7635d66a3a8cf8d898c955ef7"
36
37
38PACKAGECONFIG ??= "tcp-wrappers"
39PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050040
Patrick Williamsddad1a12017-02-23 20:36:32 -060041DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
42RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-listfile', '', d)}"
43PAMLIB = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -lpam', '', d)}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050044WRAPLIB = "${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '-lwrap', '', d)}"
Patrick Williamsddad1a12017-02-23 20:36:32 -060045NOPAM_SRC ="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050046
47inherit update-rc.d useradd systemd
48
49CONFFILES_${PN} = "${sysconfdir}/vsftpd.conf"
50LDFLAGS_append =" -lcrypt -lcap"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051CFLAGS_append_libc-musl = " -D_GNU_SOURCE -include fcntl.h"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050052EXTRA_OEMAKE = "-e MAKEFLAGS="
53
54do_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
61do_compile() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050062 oe_runmake "LIBS=-L${STAGING_LIBDIR} -lcrypt -lcap ${PAMLIB} ${WRAPLIB}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050063}
64
65do_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 Williamsddad1a12017-02-23 20:36:32 -060085 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050086 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
97INITSCRIPT_PACKAGES = "${PN}"
98INITSCRIPT_NAME_${PN} = "vsftpd"
99INITSCRIPT_PARAMS_${PN} = "defaults 80"
100
101USERADD_PACKAGES = "${PN}"
102USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp \
103 --shell /bin/false ftp "
104GROUPADD_PARAM_${PN} = "-r ftp"
105
106SYSTEMD_SERVICE_${PN} = "vsftpd.service"
107
108pkg_postinst_${PN}() {
109 if [ -z "$D" ]; then
Patrick Williamsddad1a12017-02-23 20:36:32 -0600110 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 Williamsb48b7b42016-08-17 15:04:38 -0500115 fi
116}