blob: 7a20356018922232bb753b34ea5ff945570005df [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
27LIC_FILES_CHKSUM = "file://COPYING;md5=a6067ad950b28336613aed9dd47b1271 \
28 file://COPYRIGHT;md5=04251b2eb0f298dae376d92454f6f72e \
29 file://LICENSE;md5=654df2042d44b8cac8a5654fc5be63eb"
30SRC_URI[md5sum] = "da119d084bd3f98664636ea05b5bb398"
31SRC_URI[sha256sum] = "9d4d2bf6e6e2884852ba4e69e157a2cecd68c5a7635d66a3a8cf8d898c955ef7"
32
33
34PACKAGECONFIG ??= "tcp-wrappers"
35PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050036
Patrick Williamsddad1a12017-02-23 20:36:32 -060037DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
38RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-listfile', '', d)}"
39PAMLIB = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-L${STAGING_BASELIBDIR} -lpam', '', d)}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050040WRAPLIB = "${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '-lwrap', '', d)}"
Patrick Williamsddad1a12017-02-23 20:36:32 -060041NOPAM_SRC ="${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', 'file://nopam-with-tcp_wrappers.patch', 'file://nopam.patch', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050042
43inherit update-rc.d useradd systemd
44
45CONFFILES_${PN} = "${sysconfdir}/vsftpd.conf"
46LDFLAGS_append =" -lcrypt -lcap"
47
48EXTRA_OEMAKE = "-e MAKEFLAGS="
49
50do_configure() {
51 # Fix hardcoded /usr, /etc, /var mess.
52 cat tunables.c|sed s:\"/usr:\"${prefix}:g|sed s:\"/var:\"${localstatedir}:g \
53 |sed s:\"/etc:\"${sysconfdir}:g > tunables.c.new
54 mv tunables.c.new tunables.c
55}
56
57do_compile() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050058 oe_runmake "LIBS=-L${STAGING_LIBDIR} -lcrypt -lcap ${PAMLIB} ${WRAPLIB}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050059}
60
61do_install() {
62 install -d ${D}${sbindir}
63 install -d ${D}${mandir}/man8
64 install -d ${D}${mandir}/man5
65 oe_runmake 'DESTDIR=${D}' install
66 install -d ${D}${sysconfdir}
67 install -m 600 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}/vsftpd.conf
68 install -d ${D}${sysconfdir}/init.d/
69 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/vsftpd
70 install -d ${D}/${sysconfdir}/default/volatiles
71 install -m 644 ${WORKDIR}/volatiles.99_vsftpd ${D}/${sysconfdir}/default/volatiles/99_vsftpd
72
73 install -m 600 ${WORKDIR}/vsftpd.ftpusers ${D}${sysconfdir}/
74 install -m 600 ${WORKDIR}/vsftpd.user_list ${D}${sysconfdir}/
75 if ! test -z "${PAMLIB}" ; then
76 install -d ${D}${sysconfdir}/pam.d/
77 cp ${S}/RedHat/vsftpd.pam ${D}${sysconfdir}/pam.d/vsftpd
78 sed -i "s:/lib/security:${base_libdir}/security:" ${D}${sysconfdir}/pam.d/vsftpd
79 sed -i "s:ftpusers:vsftpd.ftpusers:" ${D}${sysconfdir}/pam.d/vsftpd
80 fi
Patrick Williamsddad1a12017-02-23 20:36:32 -060081 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Patrick Williamsb48b7b42016-08-17 15:04:38 -050082 install -d ${D}${sysconfdir}/tmpfiles.d
83 echo "d /var/run/vsftpd/empty 0755 root root -" \
84 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
85 fi
86
87 # Install systemd unit files
88 install -d ${D}${systemd_unitdir}/system
89 install -m 0644 ${WORKDIR}/vsftpd.service ${D}${systemd_unitdir}/system
90 sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/vsftpd.service
91}
92
93INITSCRIPT_PACKAGES = "${PN}"
94INITSCRIPT_NAME_${PN} = "vsftpd"
95INITSCRIPT_PARAMS_${PN} = "defaults 80"
96
97USERADD_PACKAGES = "${PN}"
98USERADD_PARAM_${PN} = "--system --home-dir /var/lib/ftp --no-create-home -g ftp \
99 --shell /bin/false ftp "
100GROUPADD_PARAM_${PN} = "-r ftp"
101
102SYSTEMD_SERVICE_${PN} = "vsftpd.service"
103
104pkg_postinst_${PN}() {
105 if [ -z "$D" ]; then
Patrick Williamsddad1a12017-02-23 20:36:32 -0600106 if type systemd-tmpfiles >/dev/null; then
107 systemd-tmpfiles --create
108 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
109 ${sysconfdir}/init.d/populate-volatile.sh update
110 fi
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500111 fi
112}