From f5b159cd06c953a2f631c50416c934db94c1cd47 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 22:14:16 +0100 Subject: [PATCH] set valid user and group in fcgiwrap.service for apache and nginx in openmamba [release 1.1.0-2mamba;Sun Aug 13 2023] --- README.md | 2 + fcgiwrap-1.1.0-service-user-group.patch | 13 +++++ fcgiwrap-1.1.0-systemd.patch | 26 +++++++++ fcgiwrap-1.1.0-upstream-bugfix.patch | 22 ++++++++ fcgiwrap.spec | 72 +++++++++++++++++++++++++ 5 files changed, 135 insertions(+) create mode 100644 fcgiwrap-1.1.0-service-user-group.patch create mode 100644 fcgiwrap-1.1.0-systemd.patch create mode 100644 fcgiwrap-1.1.0-upstream-bugfix.patch create mode 100644 fcgiwrap.spec diff --git a/README.md b/README.md index eba4dff..ac7e063 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # fcgiwrap +Simple FastCGI wrapper for CGI scripts. + diff --git a/fcgiwrap-1.1.0-service-user-group.patch b/fcgiwrap-1.1.0-service-user-group.patch new file mode 100644 index 0000000..2519d4f --- /dev/null +++ b/fcgiwrap-1.1.0-service-user-group.patch @@ -0,0 +1,13 @@ +--- fcgiwrap-1.1.0/systemd/fcgiwrap.service.orig 2023-08-13 01:58:26.805337286 +0200 ++++ fcgiwrap-1.1.0/systemd/fcgiwrap.service 2023-08-13 01:58:33.904359976 +0200 +@@ -4,8 +4,8 @@ + + [Service] + ExecStart=/usr/sbin/fcgiwrap +-User=http +-Group=http ++User=nobody ++Group=nobody + + [Install] + Also=fcgiwrap.socket diff --git a/fcgiwrap-1.1.0-systemd.patch b/fcgiwrap-1.1.0-systemd.patch new file mode 100644 index 0000000..b40f899 --- /dev/null +++ b/fcgiwrap-1.1.0-systemd.patch @@ -0,0 +1,26 @@ +From e621d6acb538d717d6767429e3f85190019a887d Mon Sep 17 00:00:00 2001 +From: Thomas Claveirole +Date: Mon, 18 Jul 2016 15:06:59 +0200 +Subject: [PATCH] configure.ac: Check for libsystemd, not libsystemd-daemon. + +Newer versions of systemd do not provide libsystemd-daemon anymore. +Therefore, use libsystemd instead. + +Signed-off-by: Thomas Claveirole +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index bb3674e..2b02ef4 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -28,7 +28,7 @@ AC_ARG_WITH([systemd], + [], [with_systemd=check]) + have_systemd=no + if test "x$with_systemd" != "xno"; then +- PKG_CHECK_MODULES(systemd, [libsystemd-daemon], ++ PKG_CHECK_MODULES(systemd, [libsystemd], + [AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is available]) + have_systemd=yes], + have_systemd=no) diff --git a/fcgiwrap-1.1.0-upstream-bugfix.patch b/fcgiwrap-1.1.0-upstream-bugfix.patch new file mode 100644 index 0000000..de187a3 --- /dev/null +++ b/fcgiwrap-1.1.0-upstream-bugfix.patch @@ -0,0 +1,22 @@ +From dc0c3b14f0d7bb014a9a4c6c17eb55a123496365 Mon Sep 17 00:00:00 2001 +From: "D.pz" +Date: Mon, 28 Aug 2017 23:54:08 +0800 +Subject: [PATCH] 1.fix: kill() parameter sequence wrong + +--- + fcgiwrap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fcgiwrap.c b/fcgiwrap.c +index b44d8aa..bfd9a90 100644 +--- a/fcgiwrap.c ++++ b/fcgiwrap.c +@@ -205,7 +205,7 @@ static void fcgi_finish(struct fcgi_context *fc, const char* msg) + if (fc->fd_stderr >= 0) close(fc->fd_stderr); + + if (fc->cgi_pid) +- kill(SIGTERM, fc->cgi_pid); ++ kill(fc->cgi_pid, SIGTERM); + } + + static const char * fcgi_pass_fd(struct fcgi_context *fc, int *fdp, FCGI_FILE *ffp, char *buf, size_t bufsize) diff --git a/fcgiwrap.spec b/fcgiwrap.spec new file mode 100644 index 0000000..c72084f --- /dev/null +++ b/fcgiwrap.spec @@ -0,0 +1,72 @@ +Name: fcgiwrap +Version: 1.1.0 +Release: 2mamba +Summary: Simple FastCGI wrapper for CGI scripts +Group: System/Servers +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://github.com/gnosek/fcgiwrap +Source: https://github.com/gnosek/fcgiwrap.git/%{version}/fcgiwrap-%{version}.tar.bz2 +Patch0: fcgiwrap-1.1.0-upstream-bugfix.patch +Patch1: fcgiwrap-1.1.0-systemd.patch +Patch2: fcgiwrap-1.1.0-service-user-group.patch +License: MIT +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libfcgi-devel +BuildRequires: libsystemd-devel +## AUTOBUILDREQ-END + +%description +Simple FastCGI wrapper for CGI scripts. + +%debug_package + +%prep +%setup -q +%patch0 -p1 -b .upstream-bugfix +%patch1 -p1 -b .systemd +%patch2 -p1 + +autoreconf -f -i + +%build +%configure \ + --prefix=/ \ + CFLAGS='%{optflags} -Wno-error=implicit-fallthrough' + +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +%post +%systemd_post fcgiwrap.socket +: + +%preun +%systemd_preun fcgiwrap.socket +: + +%postun +%systemd_postun_with_restart fcgiwrap.socket +: + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%{_sbindir}/fcgiwrap +%{_unitdir}/fcgiwrap.service +%{_unitdir}/fcgiwrap.socket +%{_mandir}/man8/fcgiwrap.8* + +%changelog +* Sun Aug 13 2023 Silvan Calarco 1.1.0-2mamba +- set valid user and group in fcgiwrap.service for apache and nginx in openmamba + +* Sat Aug 12 2023 Silvan Calarco 1.1.0-1mamba +- package created using the webbuild interface