[Pkg-mailman-hackers] Bug#994744: mailman3-web: SysV init script doesn't handle correctly PID files
Alexander Velin
velin at fccf.net
Mon Sep 20 12:31:04 BST 2021
Package: mailman3-web
Version: 0+20200530-2
Severity: normal
Tags: patch
Dear Maintainer,
While testing mailman3-web with SysV init, I've noticed the following two
problems:
- PIDFILE is created by DAEMON=/usr/bin/uwsgi_python3, which is
/usr/bin/uwsgi-core, which reads options from /etc/mailman3/uwsgi.ini
(part of mailman3-web). However, the INI file does not set umask,
resulting in a PIDFILE with permissions of 666, and start-stop-daemon
refuses to work with world-writeable PID files, so one cannot stop the
stack via the init script.
This can be mitigated by editing /etc/mailman3/uwsgi.ini and adding
[uwsgi]
umask = 0022
- UWSGI seems not to remove its PIDFILE upon stop, so maybe the init
script should include --remove-pidfile start-stop-daemon option where
appropriate
regards,
--velin
-- System Information:
Debian Release: 11.0
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 5.10.0-8-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled
Versions of packages mailman3-web depends on:
ii dbconfig-sqlite3 2.0.19
ii debconf [debconf-2.0] 1.5.77
ii init-system-helpers 1.60
ii lsb-base 11.1.0
ii python3 3.9.2-3
ii python3-django-hyperkitty 1.3.4-4
ii python3-django-postorius 1.3.4-2+deb11u1
ii python3-psycopg2 2.8.6-2
ii python3-whoosh 2.7.4+git6-g9134ad92-5
ii ucf 3.0043
ii uwsgi-core 2.0.19.1-7.1
ii uwsgi-plugin-python3 2.0.19.1-7.1
Versions of packages mailman3-web recommends:
ii nginx-extras [nginx] 1.18.0-6.1
Versions of packages mailman3-web suggests:
pn postgresql | default-mysql-server | virtual-mysql-server <none>
-- Configuration Files:
/etc/init.d/mailman3-web changed:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME="mailman3-web"
DESC="Mailman3-web uWSGI service"
SCRIPTNAME=/etc/init.d/mailman3-web
DAEMON=/usr/bin/uwsgi_python3
PIDFILE="/run/mailman3-web/${NAME}.pid"
LOGFILE="/var/log/mailman3/web/mailman-web.log"
DAEMON_ARGS="--ini /etc/mailman3/uwsgi.ini --pidfile ${PIDFILE} --daemonize ${LOGFILE}"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
if [ ! -d /run/mailman3-web ]; then
mkdir -p /run/mailman3-web
fi
chown www-data:www-data /run/mailman3-web
do_start () {
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
--test >/dev/null|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
-- $DAEMON_ARGS || return 2
}
do_stop () {
start-stop-daemon --stop --quiet --oknodo --retry=QUIT/30/KILL/5 \
--pidfile $PIDFILE --remove-pidfile --exec $DAEMON
}
do_reload () {
start-stop-daemon --stop --quiet --signal=HUP --pidfile $PIDFILE \
--exec $DAEMON
RETVAL="$?"
# There is no such process, nothing to reload!
[ "$RETVAL" = 1 ] && RETVAL=3
return "$RETVAL"
}
do_force_reload() {
start-stop-daemon --stop --quiet --signal=TERM --pidfile $PIDFILE \
--exec $DAEMON
RETVAL="$?"
# There is no such process, nothing to reload!
[ "$RETVAL" = 1 ] && RETVAL=3
return "$RETVAL"
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
do_start
log_end_msg "$?"
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
log_end_msg "$?"
;;
status)
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
;;
reload)
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg "$?"
;;
force-reload)
log_daemon_msg "Forced reloading $DESC" "$NAME"
do_force_reload
log_end_msg "$RETVAL"
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0)
do_start
log_end_msg "$?"
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
exit 3
;;
esac
exit 0
/etc/mailman3/uwsgi.ini changed:
[uwsgi]
umask = 0022
uwsgi-socket = /run/mailman3-web/uwsgi.sock
enable-threads = true
chdir = /usr/share/mailman3-web
wsgi-file = wsgi.py
master = true
process = 2
threads = 2
uid = www-data
gid = www-data
plugins = python3
attach-daemon = python3 manage.py qcluster
logto = /var/log/mailman3/web/mailman-web.log
-- debconf information:
* mailman3-web/configure-webserver: none
mailman3-web/nginx-choice:
mailman3-web/passwords-do-not-match:
mailman3-web/purge: false
mailman3-web/upgrade-backup: true
mailman3-web/install-error: abort
mailman3-web/db/basepath: /var/lib/mailman3/web
mailman3-web/dbconfig-upgrade: true
* mailman3-web/dbconfig-reinstall: false
mailman3-web/missing-db-package-error: abort
mailman3-web/remove-error: abort
mailman3-web/db/dbname: mailman3web.db
mailman3-web/dbconfig-remove: true
* mailman3-web/restart-webserver: false
* mailman3-web/superuser-mail: root at localhost
* mailman3-web/emailname: stratios.fmi.fail
mailman3-web/internal/reconfiguring: false
* mailman3-web/superuser-name: admin
mailman3-web/internal/skip-preseed: false
* mailman3-web/dbconfig-install: true
mailman3-web/upgrade-error: abort
* mailman3-web/database-type: sqlite3
More information about the Pkg-mailman-hackers
mailing list