RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1651746 - mod_fcgid sends wrong (or no) PATH_INFO to virtual FcgidWrapper
Summary: mod_fcgid sends wrong (or no) PATH_INFO to virtual FcgidWrapper
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: mod_fcgid
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Luboš Uhliarik
QA Contact: rhel-cs-infra-services-qe
URL:
Whiteboard:
Depends On:
Blocks: 1618477 1620531
TreeView+ depends on / blocked
 
Reported: 2018-11-20 16:42 UTC by Petr Pisar
Modified: 2021-02-01 07:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-01 07:30:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Apache Bugzilla 52710 0 None None None 2019-08-07 14:02:49 UTC

Description Petr Pisar 2018-11-20 16:42:35 UTC
I hit an old bug in mod_fcgid with mod_fcgid-2.3.9-12.el8.x86_64 already reported to upstream <https://bz.apache.org/bugzilla/show_bug.cgi?id=52710> about wrong PATH_INFO FastCGI variable past to a virtual FcgidWrapper script.

If you configure mod_fcgid to pass all requests to /usr/local/bin/psgiwrapper.fcgi FCGI program with following /etc/httpd/conf.d/fcgid.conf httpd configuration:

<Location />
  SetHandler fcgid-script
  Options +ExecCGI
  FcgidWrapper "/usr/local/bin/psgiwrapper.fcgi" virtual
</Location>

and the purpose of /usr/local/bin/psgiwrapper.fcgi is to return all FCGI (and POSIX) environment variables, e.g. with this Perl program (you need FCGI Perl module for that not available in RHEL, compile and install perl-FCGI package from Fedora):

#!/usr/bin/perl
use FCGI ();
my %fenv;
my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%fenv, 0,
        FCGI::FAIL_ACCEPT_ON_INTR);
use Data::Dumper ();
$Data::Dumper::Sortkeys = 1;
while($request->Accept() >= 0) {
        print("Content-Type: text/plain\r\n\r\n");
        print("fenv: " . Data::Dumper::Dumper(\%fenv));
        print("ENV: " . Data::Dumper::Dumper(\%ENV));
}

Then you can try various requests toward localhost to see the FastCGI variables passed from httpd to the /usr/local/bin/psgiwrapper.fcgi script.

E.g. requesting root document shows no PATH_INFO variable and '/' SCRIPT_NAME:

$ wget -S -O - -q http://localhost/
  HTTP/1.1 200 OK
  Date: Tue, 20 Nov 2018 16:15:28 GMT
  Server: Apache/2.4.35 (Red Hat Enterprise Linux) mod_fcgid/2.3.9
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
  Transfer-Encoding: chunked
  Content-Type: text/plain; charset=UTF-8
fenv: $VAR1 = {
          'CONTEXT_DOCUMENT_ROOT' => '/var/www/html',
          'CONTEXT_PREFIX' => '',
          'DOCUMENT_ROOT' => '/var/www/html',
          'FCGI_ROLE' => 'RESPONDER',
          'GATEWAY_INTERFACE' => 'CGI/1.1',
          'HTTP_ACCEPT' => '*/*',
          'HTTP_ACCEPT_ENCODING' => 'identity',
          'HTTP_CONNECTION' => 'close',
          'HTTP_HOST' => 'localhost',
          'HTTP_USER_AGENT' => 'Wget/1.19.5 (linux-gnu)',
          'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin',
          'QUERY_STRING' => '',
          'REMOTE_ADDR' => '::1',
          'REMOTE_PORT' => '37730',
          'REQUEST_METHOD' => 'GET',
          'REQUEST_SCHEME' => 'http',
          'REQUEST_URI' => '/',
          'SCRIPT_FILENAME' => '/var/www/html/',
          'SCRIPT_NAME' => '/',
          'SERVER_ADDR' => '::1',
          'SERVER_ADMIN' => 'root@localhost',
          'SERVER_NAME' => 'localhost',
          'SERVER_PORT' => '80',
          'SERVER_PROTOCOL' => 'HTTP/1.1',
          'SERVER_SIGNATURE' => '',
          'SERVER_SOFTWARE' => 'Apache/2.4.35 (Red Hat Enterprise Linux) mod_fcgid/2.3.9',
          'UNIQUE_ID' => 'W-QzIPCUedqsHkC4H1DVcwAAABA'
        };
ENV: $VAR1 = {
          'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin'
        };

Requesting /foo returns:

          NO PATH_NAME variable and
          'SCRIPT_NAME' => '/foo',

Requesting /foo/ returns:

          'PATH_INFO' => '/',
          'SCRIPT_NAME' => '/foo',

Requesting /foo/bar returns:

          'PATH_INFO' => '/bar',
          'SCRIPT_NAME' => '/foo',

Requesting /foo/bar/ returns:

          'PATH_INFO' => '/bar/',
          'SCRIPT_NAME' => '/foo',

Requesting /foo/bar/baz returns:

          'PATH_INFO' => '/bar/baz',
          'SCRIPT_NAME' => '/foo',

I will repeat requesting / returns:

          NO PATH_NAME variable and
          'SCRIPT_NAME' => '/',

And this is the issue. It seems like PATH_INFO is always missing the fist-level path component except for because httpd thinks it's the SCRIPT_NAME. But virtual wrapper directive <https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidwrapper> means there is no real script. Thus the invoked URI path should go to PATH_INFO and SCRIPT_NAME should be empty.

The meaning of the variables is defined in <https://tools.ietf.org/html/rfc3875>. Apache httpd follows CGI convention for FastCGI (https://bz.apache.org/bugzilla/show_bug.cgi?id=50851).

This bug prevents an FCGI application mounted into the document root ("/") from retrieving the application path properly. From the RFC:

  The PATH_INFO variable specifies a path to be interpreted by the CGI script.

In case of mod_fcgid, the PATH_INFO is missing the first path component and thus provides wrong input to FCGI applications.

Comment 2 Petr Pisar 2020-09-07 11:21:31 UTC
Any progress? I would to see this fixed in RHEL 9.

Comment 5 RHEL Program Management 2021-02-01 07:30:38 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


Note You need to log in before you can comment on or make changes to this bug.