diff --git a/vsftpd-2.3.4-sd.patch b/vsftpd-2.3.4-sd.patch index c54aca2..706365a 100644 --- a/vsftpd-2.3.4-sd.patch +++ b/vsftpd-2.3.4-sd.patch @@ -1,35 +1,69 @@ -diff -up vsftpd-2.3.4/vsftpd.8.sd vsftpd-2.3.4/vsftpd.8 ---- vsftpd-2.3.4/vsftpd.8.sd 2011-11-14 15:22:50.363265369 +0100 -+++ vsftpd-2.3.4/vsftpd.8 2011-11-15 08:32:55.270895429 +0100 -@@ -25,6 +25,8 @@ in +diff -up vsftpd-3.0.2/vsftpd.8.sd vsftpd-3.0.2/vsftpd.8 +--- vsftpd-3.0.2/vsftpd.8.sd 2013-09-04 13:04:40.383348837 +0200 ++++ vsftpd-3.0.2/vsftpd.8 2013-09-04 13:45:00.370277842 +0200 +@@ -25,6 +25,23 @@ in Direct execution of the .Nm vsftpd binary will then launch the FTP service ready for immediate client connections. +.Pp -+Systemd changes the vsftpd start-up. When the SysV initscript attempts to start one instance of the vsftpd daemon for each of /etc/vsftpd/*.conf file, each configuration file requires a proper unit file. Each instance of the vsftpd daemon is started separately. See systemd.unit(5). ++Systemd changes the vsftpd daemon start-up. The vsftpd package contains vsftpd-generator script generating symbolic links to /var/run/systemd/generator/vsftpd.target.wants directory. The generator is called during e.g. 'systemctl --system daemon-reload'. All these symbolic links link /usr/lib/systemd/system/vsftpd@.service file. ++The vsftpd daemon(s) is/are controlled by one of following ways: ++.Pp ++1. Single daemon using default /etc/vsftpd/vsftpd.conf configuration file ++.br ++# systemctl {start,stop,...} vsftpd[.service] ++.Pp ++2. Single daemon using /etc/vsftpd/.conf ++.br ++# systemctl {start,stop,...} vsftpd@[.service] ++.Pp ++3. All instances together ++.br ++# systemctl {restart,stop} vsftpd.target ++.Pp ++See systemd.unit(5), systemd.target(5) for further details. .Sh OPTIONS An optional configuration file or files -@@ -55,6 +57,9 @@ the "ftpd_banner" setting is set to "bla +@@ -55,6 +72,13 @@ the "ftpd_banner" setting is set to "bla setting and any identical setting that was in the config file. .Sh FILES .Pa /etc/vsftpd/vsftpd.conf +.Pp -+.Pa /lib/systemd/system/vsftpd.service ++.Pa /usr/lib/systemd/system/vsftpd.service ++.Pp ++.Pa /usr/lib/systemd/system/vsftpd@.service ++.Pp ++.Pa /usr/lib/systemd/system/vsftpd.target .Sh SEE ALSO .Xr vsftpd.conf 5 +.Xr systemd.unit 5 .end -diff -up vsftpd-2.3.4/vsftpd.conf.5.sd vsftpd-2.3.4/vsftpd.conf.5 ---- vsftpd-2.3.4/vsftpd.conf.5.sd 2011-11-14 15:22:50.546267713 +0100 -+++ vsftpd-2.3.4/vsftpd.conf.5 2011-11-15 08:48:42.872580090 +0100 -@@ -13,6 +13,9 @@ inetd such as +diff -up vsftpd-3.0.2/vsftpd.conf.5.sd vsftpd-3.0.2/vsftpd.conf.5 +--- vsftpd-3.0.2/vsftpd.conf.5.sd 2013-09-04 13:04:40.391348915 +0200 ++++ vsftpd-3.0.2/vsftpd.conf.5 2013-09-04 13:44:57.573250302 +0200 +@@ -12,7 +12,23 @@ inetd such as + .BR xinetd to launch vsftpd with different configuration files on a per virtual host basis. - -+Systemd changes the vsftpd daemon start-up. Each configuration file -+requires a proper unit file that can be obtained by cloning and modifying default vsftpd.service. This additional unit file should be placed to /etc/systemd/system. See systemd.unit(5) for details. -+ +- ++.P ++Systemd changes the vsftpd daemon start-up. The vsftpd package contains vsftpd-generator script generating symbolic links to /var/run/systemd/generator/vsftpd.target.wants directory. The generator is called during e. g. 'systemctl --system daemon-reload'. All these symbolic links link /usr/lib/systemd/system/vsftpd@.service file. ++The vsftpd daemon(s) is/are controlled by one of following ways: ++.P ++1. Single daemon using default /etc/vsftpd/vsftpd.conf configuration file ++.br ++# systemctl {start,stop,...} vsftpd[.service] ++.P ++2. Single daemon using /etc/vsftpd/.conf ++.br ++# systemctl {start,stop,...} vsftpd@[.service] ++.P ++3. All instances together ++.br ++# systemctl {restart,stop} vsftpd.target ++.P ++See systemd.unit(5), systemd.target(5) for further details. .SH FORMAT The format of vsftpd.conf is very simple. Each line is either a comment or a directive. Comment lines start with a # and are ignored. A directive line diff --git a/vsftpd-generator b/vsftpd-generator new file mode 100755 index 0000000..f1c4cdc --- /dev/null +++ b/vsftpd-generator @@ -0,0 +1,15 @@ +#!/bin/bash + +confdir=/etc/vsftpd +unitdir=/usr/lib/systemd/system +targetdir=$1/vsftpd.target.wants + +mkdir -p ${targetdir} + +for f in $(ls -1 ${confdir}/*.conf | awk -F "." '{print $1}' | awk -F "/" '{print $4}') +do + echo "Generating systemd units for $f" + ln -s ${unitdir}/vsftpd\@.service ${targetdir}/vsftpd\@$f.service > /dev/null 2>&1 +done + +exit 0 diff --git a/vsftpd.spec b/vsftpd.spec index d43aa6b..a4a3232 100644 --- a/vsftpd.spec +++ b/vsftpd.spec @@ -1,8 +1,9 @@ %{!?tcp_wrappers:%define tcp_wrappers 1} +%define _generatorsdir %{_prefix}/lib/systemd/system-generators Name: vsftpd Version: 3.0.2 -Release: 3%{?dist} +Release: 5%{?dist} Summary: Very Secure Ftp Daemon Group: System Environment/Daemons @@ -17,20 +18,21 @@ Source4: vsftpd.user_list Source5: vsftpd.init Source6: vsftpd_conf_migrate.sh Source7: vsftpd.service +Source8: vsftpd@.service +Source9: vsftpd.target +Source10: vsftpd-generator BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: pam-devel BuildRequires: libcap-devel BuildRequires: openssl-devel +BuildRequires: systemd %if %{tcp_wrappers} BuildRequires: tcp_wrappers-devel %endif Requires: logrotate -Requires (post): systemd-units -Requires (preun): systemd-units -Requires (postun): systemd-units # Build patches Patch1: vsftpd-2.1.0-libs.patch @@ -114,7 +116,8 @@ mkdir -p $RPM_BUILD_ROOT%{_sbindir} mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{vsftpd,pam.d,logrotate.d,rc.d/init.d} mkdir -p $RPM_BUILD_ROOT%{_mandir}/man{5,8} -mkdir -p $RPM_BUILD_ROOT/lib/systemd/system +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +mkdir -p $RPM_BUILD_ROOT%{_generatorsdir} install -m 755 vsftpd $RPM_BUILD_ROOT%{_sbindir}/vsftpd install -m 600 vsftpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/vsftpd.conf install -m 644 vsftpd.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/ @@ -125,7 +128,10 @@ install -m 600 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/ftpusers install -m 600 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/user_list install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/vsftpd install -m 744 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/vsftpd/vsftpd_conf_migrate.sh -install -m 644 %{SOURCE7} $RPM_BUILD_ROOT/lib/systemd/system/ +install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_unitdir} +install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_unitdir} +install -m 644 %{SOURCE9} $RPM_BUILD_ROOT%{_unitdir} +install -m 755 %{SOURCE10} $RPM_BUILD_ROOT%{_generatorsdir} mkdir -p $RPM_BUILD_ROOT/%{_var}/ftp/pub @@ -137,13 +143,15 @@ rm -rf $RPM_BUILD_ROOT %preun %systemd_preun vsftpd.service +%systemd_preun vsftpd.target %postun %systemd_postun_with_restart vsftpd.service %files %defattr(-,root,root,-) -/lib/systemd/system/vsftpd.service +%{_unitdir}/* +%{_generatorsdir}/* %{_sbindir}/vsftpd %dir %{_sysconfdir}/vsftpd %{_sysconfdir}/vsftpd/vsftpd_conf_migrate.sh @@ -162,13 +170,21 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/rc.d/init.d/vsftpd %changelog -* Mon Feb 25 2013 Jiri Skala - 3.0.1-3 +* Tue Sep 10 2013 Jiri Skala - 3.0.2-5 +- fixed #1005549 - vsftpd startup broken +- updated man pages - systemd multiple instances + +* Thu Aug 15 2013 Jiri Skala - 3.0.2-4 +- replaced systemd path by _unitdir macro +- fixes #7194344 - multiple instances (target, generator) + +* Mon Feb 25 2013 Jiri Skala - 3.0.2-3 - fixes #913519 - login fails (increased AS_LIMIT) * Fri Feb 15 2013 Fedora Release Engineering - 3.0.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild -* Wed Sep 19 2012 Jiri Skala - 3.0.1-2 +* Wed Sep 19 2012 Jiri Skala - 3.0.2-2 - update to latest upstream 3.0.2 * Mon Sep 17 2012 Jiri Skala - 3.0.1-1 diff --git a/vsftpd.target b/vsftpd.target new file mode 100644 index 0000000..3f0a942 --- /dev/null +++ b/vsftpd.target @@ -0,0 +1,6 @@ +[Unit] +Description=FTP daemon +After=network.target + +[Install] +WantedBy=multi-user.target diff --git a/vsftpd@.service b/vsftpd@.service new file mode 100644 index 0000000..f3a7a16 --- /dev/null +++ b/vsftpd@.service @@ -0,0 +1,11 @@ +[Unit] +Description=Vsftpd ftp daemon +After=network.target +PartOf=vsftpd.target + +[Service] +Type=forking +ExecStart=/usr/sbin/vsftpd /etc/vsftpd/%i.conf + +[Install] +WantedBy=vsftpd.target