diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-10-30 03:36:21 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-10-30 03:36:21 +0000 |
commit | e6a2fd03865862c81d79bd32249728f20ce99354 (patch) | |
tree | e2ba9ebe3405d7f7b4fb3528818e50ff0097a24c /www-servers/caddy/files | |
parent | 6769d991d1a040381ab263b2eef043e6f50190a6 (diff) |
gentoo auto-resync : 30:10:2023 - 03:36:20
Diffstat (limited to 'www-servers/caddy/files')
-rw-r--r-- | www-servers/caddy/files/confd-2.7.5 | 5 | ||||
-rw-r--r-- | www-servers/caddy/files/initd-2.7.5 | 53 | ||||
-rw-r--r-- | www-servers/caddy/files/remove-binary-altering-commands-2.7.5.patch | 61 |
3 files changed, 119 insertions, 0 deletions
diff --git a/www-servers/caddy/files/confd-2.7.5 b/www-servers/caddy/files/confd-2.7.5 new file mode 100644 index 000000000000..62cca711638a --- /dev/null +++ b/www-servers/caddy/files/confd-2.7.5 @@ -0,0 +1,5 @@ +# command_user="http:http" +# logfile="/var/log/caddy/caddy.log" +# +# caddy_config="/etc/caddy/Caddyfile" +# command_args="run --config ${caddy_config}" diff --git a/www-servers/caddy/files/initd-2.7.5 b/www-servers/caddy/files/initd-2.7.5 new file mode 100644 index 000000000000..408405c42a28 --- /dev/null +++ b/www-servers/caddy/files/initd-2.7.5 @@ -0,0 +1,53 @@ +#!/sbin/openrc-run +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +extra_commands="checkconfig" +extra_started_commands="reload" + +description="Caddy web server" +pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"} +command="/usr/bin/caddy" +command_user="${command_user:-"http:http"}" +caddy_config="${caddy_config:-"/etc/caddy/Caddyfile"}" +command_args="${command_args:-"run --config ${caddy_config}"}" +command_background="true" +logfile="${logfile:-"/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"}" +start_stop_daemon_args="--user ${command_user%:*} --group ${command_user#*:} + --stdout ${logfile} --stderr ${logfile}" + +: "${supervisor:=supervise-daemon}" +: "${respawn_delay:=5}" +: "${respawn_max:=10}" +: "${respawn_period:=60}" + +depend() { + need net +} + +checkconfig() { + if [ ! -f "${caddy_config}" ] ; then + ewarn "${caddy_config} does not exist." + return 1 + fi + "${command}" validate --config "${caddy_config}" >> "${logfile}" 2>&1 +} + +start() { + checkconfig || { eerror "Invalid configuration file !" && return 1; } + checkpath --directory --mode 755 --owner root "${pidfile%/*}" + checkpath --directory --mode 755 --owner "${command_user}" "${logfile%/*}" + default_start +} + +reload() { + if ! service_started "${SVCNAME}" ; then + eerror "${SVCNAME} isn't running" + return 1 + fi + checkconfig || { eerror "Invalid configuration file !" && return 1; } + + ebegin "Reloading ${SVCNAME}" + "${command}" reload --force --config "${caddy_config}" > /dev/null 2>&1 + eend $? +} diff --git a/www-servers/caddy/files/remove-binary-altering-commands-2.7.5.patch b/www-servers/caddy/files/remove-binary-altering-commands-2.7.5.patch new file mode 100644 index 000000000000..54d2c4d91df9 --- /dev/null +++ b/www-servers/caddy/files/remove-binary-altering-commands-2.7.5.patch @@ -0,0 +1,61 @@ +# Remove commands which can modify binary outside of Portage. +# Inspired from: +# https://src.fedoraproject.org/rpms/caddy/blob/rawhide/f/0001-Disable-commands-that-can-alter-the-binary.patch +# https://salsa.debian.org/go-team/packages/caddy/-/blob/debian/sid/debian/patches/0005-Remove-obsolote-subcommands.patch?ref_type=heads +--- a/cmd/commands.go ++++ a/cmd/commands.go +@@ -393,54 +393,10 @@ + cmd.RunE = WrapCommandFuncForCobra(cmdFmt) + }, + }) + + RegisterCommand(Command{ +- Name: "upgrade", +- Short: "Upgrade Caddy (EXPERIMENTAL)", +- Long: ` +-Downloads an updated Caddy binary with the same modules/plugins at the +-latest versions. EXPERIMENTAL: May be changed or removed. +-`, +- CobraFunc: func(cmd *cobra.Command) { +- cmd.Flags().BoolP("keep-backup", "k", false, "Keep the backed up binary, instead of deleting it") +- cmd.RunE = WrapCommandFuncForCobra(cmdUpgrade) +- }, +- }) +- +- RegisterCommand(Command{ +- Name: "add-package", +- Usage: "<packages...>", +- Short: "Adds Caddy packages (EXPERIMENTAL)", +- Long: ` +-Downloads an updated Caddy binary with the specified packages (module/plugin) +-added. Retains existing packages. Returns an error if the any of packages are +-already included. EXPERIMENTAL: May be changed or removed. +-`, +- CobraFunc: func(cmd *cobra.Command) { +- cmd.Flags().BoolP("keep-backup", "k", false, "Keep the backed up binary, instead of deleting it") +- cmd.RunE = WrapCommandFuncForCobra(cmdAddPackage) +- }, +- }) +- +- RegisterCommand(Command{ +- Name: "remove-package", +- Func: cmdRemovePackage, +- Usage: "<packages...>", +- Short: "Removes Caddy packages (EXPERIMENTAL)", +- Long: ` +-Downloads an updated Caddy binaries without the specified packages (module/plugin). +-Returns an error if any of the packages are not included. +-EXPERIMENTAL: May be changed or removed. +-`, +- CobraFunc: func(cmd *cobra.Command) { +- cmd.Flags().BoolP("keep-backup", "k", false, "Keep the backed up binary, instead of deleting it") +- cmd.RunE = WrapCommandFuncForCobra(cmdRemovePackage) +- }, +- }) +- +- RegisterCommand(Command{ + Name: "manpage", + Usage: "--directory <path>", + Short: "Generates the manual pages for Caddy commands", + Long: ` + Generates the manual pages for Caddy commands into the designated directory |