don't put unrealircd's pidfile where unrealircd could write it

This commit is contained in:
Brian S. Stephan 2023-04-11 19:31:02 -05:00
parent 26e4c0d022
commit efe43b27b5
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
4 changed files with 41 additions and 12 deletions

View File

@ -0,0 +1,37 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Where to chroot to
# Uncomment this line for chrooting
#UNREALIRCD_CHROOT="/var/chroot/ircd"
UNREALIRCD_CHROOT=""
# Which configuration file to load instead of unrealircd.conf. If you
# want to run multiple instances of unrealircd, you must edit
# files::pidfile to match UNREALIRCD_PIDFILE. You should also ensure
# that files::tunefile is different for each unrealircd instance. See
# https://www.unrealircd.org/docs/Configuration#Files_block
#
# To support multiple instances of unrealircd, you may create symlinks
# in /etc/init.d pointing to /etc/init.d/unrealircd. It is recommended
# that the scheme unrealircd.${instance_name} be used. For each
# instance, you may make a copy of this file with the appropriate name
# to override default options specific to that instance.
UNREALIRCD_CONF="${UNREALIRCD_CHROOT}/etc/unrealircd/${SVCNAME}.conf"
# The path where unrealircd is configured to create its pidfile.
UNREALIRCD_PIDFILE="${UNREALIRCD_CHROOT}/run/${SVCNAME}.pid"
# extra options to pass to unrealircd ...
# You should not specify the -f option here; use
# UNREALIRCD_CONF instead.
#
# [-h servername]
# [-p portnumber]
# [-x loglevel]
# [-t] (to enable debug output)
UNREALIRCD_OPTS=""
# Extra flags to pass to start-stop-daemon. When initially
# debugging, removing --quiet may help.
UNREALIRCD_SSD_OPTS="--quiet"

View File

@ -4,7 +4,7 @@
# Defaults # Defaults
: ${UNREALIRCD_CONF:=/etc/unrealircd/${SVCNAME}.conf} : ${UNREALIRCD_CONF:=/etc/unrealircd/${SVCNAME}.conf}
: ${UNREALIRCD_PIDFILE:=/run/unrealircd/${SVCNAME#unreal}.pid} : ${UNREALIRCD_PIDFILE:=/run/${SVCNAME#unreal}.pid}
# Convenience variable for the chroot bits, not actually user-controllable via conf.d # Convenience variable for the chroot bits, not actually user-controllable via conf.d
UNREALIRCD_USER="unrealircd" UNREALIRCD_USER="unrealircd"
@ -42,14 +42,7 @@ depend() {
provide ircd provide ircd
} }
# It is unsafe for the unrealircd user to be able to write to its own
# PID file, since root will be sending e.g. kill signals to the PID
# listed in that file. Ensure that we overwrite the ownership and
# permissions on /run/unrealircd from previous init scripts.
start_pre() { start_pre() {
# commented out pending information about where to do pidfile vs. socket stuff
# checkpath --directory --owner root:root --mode 0700 "${UNREALIRCD_CHROOT}"/run/unrealircd
checkconfig || return $? checkconfig || return $?
} }

View File

@ -1,2 +1 @@
d /run/unrealircd 755 unrealircd unrealircd d /run/unrealircd 755 unrealircd unrealircd

View File

@ -71,7 +71,7 @@ src_configure() {
--with-logdir="${EPREFIX}"/var/log/${PN} \ --with-logdir="${EPREFIX}"/var/log/${PN} \
--with-modulesdir="${EPREFIX}/usr/$(get_libdir)"/${PN}/modules \ --with-modulesdir="${EPREFIX}/usr/$(get_libdir)"/${PN}/modules \
--without-privatelibdir \ --without-privatelibdir \
--with-pidfile="${EPREFIX}"/run/${PN}/ircd.pid \ --with-pidfile="${EPREFIX}"/run/${PN}.pid \
--with-tmpdir="${EPREFIX}"/var/lib/${PN}/tmp \ --with-tmpdir="${EPREFIX}"/var/lib/${PN}/tmp \
--with-maxconnections=1024 \ --with-maxconnections=1024 \
--with-nick-history=2000 \ --with-nick-history=2000 \
@ -82,7 +82,7 @@ src_configure() {
--with-system-sodium \ --with-system-sodium \
--with-system-jansson \ --with-system-jansson \
--enable-dynamic-linking \ --enable-dynamic-linking \
--with-controlfile="${EPREFIX}"/run/${PN}/unrealircd.ctl \ --with-controlfile="${EPREFIX}"/run/${PN}/${PN}.ctl \
--enable-ssl="${EPREFIX}"/usr \ --enable-ssl="${EPREFIX}"/usr \
$(use_enable curl libcurl "${EPREFIX}"/usr) \ $(use_enable curl libcurl "${EPREFIX}"/usr) \
$(use_with !operoverride no-operoverride) \ $(use_with !operoverride no-operoverride) \
@ -122,7 +122,7 @@ src_install() {
einstalldocs einstalldocs
newinitd "${FILESDIR}"/${PN}.initd-r4 ${PN} newinitd "${FILESDIR}"/${PN}.initd-r4 ${PN}
newconfd "${FILESDIR}"/${PN}.confd-r4 ${PN} newconfd "${FILESDIR}"/${PN}.confd-r5 ${PN}
# config should be read-only # config should be read-only
fperms -R 0640 /etc/${PN} fperms -R 0640 /etc/${PN}