Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: proftpd-d...@packages.debian.org, 
pkg-proftpd-maintain...@alioth-lists.debian.net
Control: affects -1 + src:proftpd-dfsg

Hi

this is a pre-check before uploading in bookworm p-u a fixed package.

The proposed solution is described in 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038416#25
and implies adding and enable one more unit to pre-check the socket vs service 
units,
and install/upgrade the other units in disabled mode. That even requires
stopping the service at prerm stage.

[ Reason ]

Murphy law applies and we (ProFTPD team) found a serious flaw in bookworm
proftpd - as summarized in the report #1038416 - which prevents having a 
working service after a new install or even an upgrade in bookworm.

[ Impact ]

The default proftpd configuration requires a standalone daemon running,
but the installation of a .socket unit prevents it to run and is not
working even, because the distributed proftpd.conf (and generally the
system admin's one) renders unusable the program via systemd. This is
evident after rebooting, while the daemon is regularly
working just after installation.

At the end of the day the admin get a not working service and 
needs to manually disable the .socket and enable the .service, or
change ServerType to inetd. This is unexpected and suboptimal.

[ Tests ]

The proposed solution works on a fresh install or an upgrade.

[ Risks ]

The change is quite trivial and should not impact other parts of the system.

[ Checklist ]
  [X] *all* changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in (old)stable
  [X] the issue is verified as fixed in unstable

[ Changes ]

Adding a new service unit which runs on-exit/on-success alternatively
the original .socket/.service unit on the basis of the current
proftpd configuration after install. The prerm script now stop services
just before removing package units.
Changes include documentation of the new units management in NEWS
and README.Debian.

[Other info]


-- 
Francesco P. Lovergine
diff -Nru proftpd-dfsg-1.3.8+dfsg/debian/changelog proftpd-dfsg-1.3.8+dfsg/debian/changelog
--- proftpd-dfsg-1.3.8+dfsg/debian/changelog	2023-03-14 10:16:31.000000000 +0100
+++ proftpd-dfsg-1.3.8+dfsg/debian/changelog	2023-06-22 11:15:57.000000000 +0200
@@ -1,3 +1,15 @@
+proftpd-dfsg (1.3.8+dfsg-4+deb12u1) bookworm-proposed-updates; urgency=medium
+
+  * Introduced a new systemd service to start the main socket/service 
+    on the basis of the proftpd.conf configuration (standalone/inetd).
+    (Closes: #1038416)
+  * Introduced a new prerm script to manage stop of service/socket now
+    not more managed by DH scripts.
+  * Added an entry to NEWS file to explain the change in unit files.
+  * Revised README.Debian to reflect changes in unit file management.
+
+ -- Francesco Paolo Lovergine <fran...@debian.org>  Thu, 22 Jun 2023 11:15:57 +0200
+
 proftpd-dfsg (1.3.8+dfsg-4) unstable; urgency=medium
 
   * Correct Umask entry in commented section (Closes: #1006011).
diff -Nru proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.NEWS proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.NEWS
--- proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.NEWS	2023-03-13 12:24:28.000000000 +0100
+++ proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.NEWS	2023-06-22 11:15:57.000000000 +0200
@@ -1,3 +1,15 @@
+proftpd-dfsg (1.3.8+dfsg-4+deb12u1) bookworm-proposed-updates; urgency=medium
+
+    Starting from this version a new systemd unit file 'proftpd-run.service' has
+    been introduced to allow switching between standalone and systemd (socket) mode.
+    In order to switch mode, it is possible to change ServerType from standalone to inetd
+    in /etc/proftpd/proftpd.conf and run systemctl stop proftpd.service
+        systemctl start proftpd.socket
+    The only unit to be maintained enabled is proftpd-run.service, and disabling
+    it would ensures to stop the ftp service at boot time.
+
+ -- Francesco Paolo Lovergine <fran...@debian.org>  Wed, 21 Jun 2023 15:21:32 +0200
+
 proftpd-dfsg (1.3.7a+dfsg-6) unstable; urgency=medium
 
     The default method of installation is the traditional standalone
diff -Nru proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.prerm proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.prerm
--- proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.prerm	1970-01-01 01:00:00.000000000 +0100
+++ proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.prerm	2023-06-22 11:13:30.000000000 +0200
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ;
+then
+    deb-systemd-invoke stop 'proftpd.service' >/dev/null || true
+    deb-systemd-invoke stop 'proftpd.socket' >/dev/null || true
+fi
+
+#DEBHELPER#
diff -Nru proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.proftpd-run.service proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.proftpd-run.service
--- proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.proftpd-run.service	1970-01-01 01:00:00.000000000 +0100
+++ proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.proftpd-run.service	2023-06-22 11:12:42.000000000 +0200
@@ -0,0 +1,14 @@
+[Unit]
+Description=ProFTPD FTP Server in standalone/socket mode
+Documentation=man:proftpd(8)
+OnFailure=proftpd.socket
+OnSuccess=proftpd.service
+
+[Service]
+Type=oneshot
+Environment=CONFIG_FILE=/etc/proftpd/proftpd.conf
+EnvironmentFile=-/etc/default/proftpd
+ExecStart=/usr/bin/grep -iqE '^[[:space:]]*ServerType[[:space:]]+standalone$' $CONFIG_FILE
+
+[Install]
+WantedBy=multi-user.target
diff -Nru proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.README.Debian proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.README.Debian
--- proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.README.Debian	2023-03-13 12:24:28.000000000 +0100
+++ proftpd-dfsg-1.3.8+dfsg/debian/proftpd-core.README.Debian	2023-06-22 11:15:57.000000000 +0200
@@ -104,8 +104,8 @@
 
 That could be done by running 
 
-	service proftpd stop
-	systemctl disable proftpd.service
+	systemctl stop proftpd.service
+	systemctl disable proftpd-run.service (only for xinetd/inetd use)
 
 then changing from 'standalone' to 'inetd' the ServerType entry in
 /etc/proftpd/proftpd.conf, and: 
@@ -132,10 +132,10 @@
   - or using systemd support for socket. To do that run:
 
 	systemctl stop proftpd.service
-	systemctl disable proftpd.service
-	systemctl enable proftpd.socket
 	systemctl start proftpd.socket
 
+    The proftpd-run.service will take care of the mode switching at boot time.
+
 ** Other information
 
 Please, read accurately the NEWS, README and changelog file in /usr/share/doc/proftpd-basic
diff -Nru proftpd-dfsg-1.3.8+dfsg/debian/rules proftpd-dfsg-1.3.8+dfsg/debian/rules
--- proftpd-dfsg-1.3.8+dfsg/debian/rules	2023-03-13 12:24:28.000000000 +0100
+++ proftpd-dfsg-1.3.8+dfsg/debian/rules	2023-06-22 11:14:45.000000000 +0200
@@ -93,8 +93,9 @@
 	dh_installinit --name=$(NAME)
 
 override_dh_installsystemd:
-	dh_installsystemd -p$(PACKAGE) --name=$(NAME) $(NAME).socket
+	dh_installsystemd -p$(PACKAGE) --no-enable --no-start --name=$(NAME) $(NAME).socket
 	dh_installsystemd -p$(PACKAGE) --name=$(NAME)@ $(NAME)@.service
-	dh_installsystemd -p$(PACKAGE) --name=$(NAME) $(NAME).service
+	dh_installsystemd -p$(PACKAGE) --no-enable --no-start --name=$(NAME) $(NAME).service
+	dh_installsystemd -p$(PACKAGE) --name=$(NAME)-run $(NAME)-run.service
 
 .PHONY: debian/proftpd-substvars debian/control

Reply via email to