Bug#1014056: apache2: /var/run/apache2 permissions too narrow for cgid
Package: apache2
Version: 2.4.53-1~deb11u1
Severity: minor
Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate ***
Enabling cgid in apache2 (with a2enmod cgid) results in an error when using mpm_event:
[cgid:error] [pid 8943:tid 140189712234240] (22)Invalid argument: [client x.x.x.x:49364] AH01257: unable to connect to cgi daemon after multiple tries: /usr/lib/cgi-bin/xxxxxx
Meanwhile, the user receives a 503 HTTP error, rather than the CGI content.
Upon launch, Apache creates /var/run/apache2/cgisock.PID (where PID is the PID in question), however it does that as the www-data user and root group, who does not have write access to /var/run/apache2 (where only the root user has write permission).
To fix this, chmod g+rwx /var/run/apache2 fixes the issue. Since we're only adding the root group, this likely has a minimal security effect.
Alternately, the default directive of
/etc/apache2/mods-available/cgid.conf: ScriptSock ${APACHE_RUN_DIR}/cgisock
Should not point to a folder that does not have write access by www-data user and a subfolder with more open permission should be created.
-- Package-specific info:
-- System Information:
Debian Release: 11.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 5.10.0-15-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages apache2 depends on:
ii apache2-bin 2.4.53-1~deb11u1
ii apache2-data 2.4.53-1~deb11u1
ii apache2-utils 2.4.53-1~deb11u1
ii dpkg 1.20.10
ii init-system-helpers 1.60
ii lsb-base 11.1.0
ii mime-support 3.66
ii perl 5.32.1-4+deb11u2
ii procps 2:3.3.17-5
Versions of packages apache2 recommends:
ii ssl-cert 1.1.0+nmu1
Versions of packages apache2 suggests:
pn apache2-doc <none>
pn apache2-suexec-pristine | apache2-suexec-custom <none>
pn www-browser <none>
Versions of packages apache2-bin depends on:
ii libapr1 1.7.0-6+deb11u1
ii libaprutil1 1.6.1-5
ii libaprutil1-dbd-sqlite3 1.6.1-5
ii libaprutil1-ldap 1.6.1-5
ii libbrotli1 1.0.9-2+b2
ii libc6 2.31-13+deb11u3
ii libcrypt1 1:4.4.18-4
ii libcurl4 7.74.0-1.3+deb11u1
ii libjansson4 2.13.1-1.1
ii libldap-2.4-2 2.4.57+dfsg-3+deb11u1
ii liblua5.3-0 5.3.3-1.1+b1
ii libnghttp2-14 1.43.0-1
ii libpcre3 2:8.39-13
ii libssl1.1 1.1.1n-0+deb11u3
ii libxml2 2.9.10+dfsg-6.7+deb11u2
ii perl 5.32.1-4+deb11u2
ii zlib1g 1:1.2.11.dfsg-2+deb11u1
Versions of packages apache2-bin suggests:
pn apache2-doc <none>
pn apache2-suexec-pristine | apache2-suexec-custom <none>
pn www-browser <none>
Versions of packages apache2 is related to:
ii apache2 2.4.53-1~deb11u1
ii apache2-bin 2.4.53-1~deb11u1
-- no debconf information
Reply to: