Bug 62567 - httpd-policy.conf.in contains HTML garbage and perhaps missing quotes for SetOutputFilter
Summary: httpd-policy.conf.in contains HTML garbage and perhaps missing quotes for Set...
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.5-HEAD
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2018-07-24 16:11 UTC by Michal Karm Babacek
Modified: 2018-08-09 11:30 UTC (History)
1 user (show)



Attachments
Fixes the policy module conf for Linux, not Windows (4.46 KB, patch)
2018-07-26 15:58 UTC, Michal Karm Babacek
Details | Diff
Fixes policy module for Linux and Windows CMake build (5.16 KB, patch)
2018-07-30 15:08 UTC, Michal Karm Babacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Karm Babacek 2018-07-24 16:11:05 UTC
Hello,

After the resolution of [1] and [2] enabled the CMake Windows build of trunk [3] for me, the smoke test that starts httpd and accesses HTTP on 80 and HTTPS on 443 *and* checks for errors in the log kept failing on syntax errors in httpd-policy.conf and:

> [Tue Jul 24 08:39:47.440977 2018] [core:error] [pid 1468:tid 3676] [client ::1:56088] 
> AH00082: an unknown filter was not added: 
> POLICY_TYPEPOLICY_LENGTHPOLICY_KEEPALIVEPOLICY_VARYPOLICY_VALIDATIONPOLICY_CONDITIONALPOLICY_NOCACHEPOLICY_MAXAGE

I tried with this patch [4], but as you can see, the CI keeps failing [5]:

>[Tue Jul 24 09:04:53.657743 2018] [core:error] [pid 1684:tid 3672] [client ::1:56123] 
> AH00082: an unknown filter was not added: 
> POLICY_TYPEPOLICY_LENGTHPOLICY_KEEPALIVEPOLICY_VARYPOLICY_VALIDATIONPOLICY_CONDITIONALPOLICY_NOCACHEPOLICY_MAXAGE
>[Tue Jul 24 09:04:53.660706 2018] [core:error] [pid 1684:tid 3672] [client ::1:56123] 
> AH00082: an unknown filter was not added: 
> POLICY_TYPEPOLICY_LENGTHPOLICY_KEEPALIVEPOLICY_VARYPOLICY_VALIDATIONPOLICY_CONDITIONALPOLICY_NOCACHEPOLICY_MAXAGE

What is the intended syntax for SetOutputFilter? Should the file or the parser be fixed?

Cheers
K.

--

Accessing https://ci.modcluster.io requires an *arbitrary* GitHub account, it keeps the silliest bots away, but I can attach anything to this BZ if anybody would like me to.

[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=62557#c11
[2] https://bz.apache.org/bugzilla/show_bug.cgi?id=62563#c3
[3] https://ci.modcluster.io/job/httpd-trunk-windows/
[4] https://raw.githubusercontent.com/modcluster/ci.modcluster.io/master/windows/httpd/httpd-policy.conf.in.patch
[5] https://ci.modcluster.io/job/httpd-trunk-windows/20/label=w2k12r2/consoleText
Comment 1 Michal Karm Babacek 2018-07-26 15:58:57 UTC
Created attachment 36050 [details]
Fixes the policy module conf for Linux, not Windows
Comment 2 Michal Karm Babacek 2018-07-26 16:05:37 UTC
Weird thing is that if I build on Fedora, with attachment 36050 [details] patch in place as:

> ./buildconf;CFLAGS="-O2" ./configure --enable-http2 --enable-policy  --enable-load-all-modules --prefix=/home/karm/Projects/MOD_CLUSTER/httpd-trunk-build;make;make install

And start httpd, send some requests to /, I can see HTTP 502 and the policy module in action, complaining:

> AH03042: mod_policy: violation, rejecting request: 
>   Response has no explicit freshness lifetime (s-maxage, max-age or Expires/Date), uri: /index.html
> AH03042: mod_policy: violation, rejecting request: 
>   Etag and Last Modified missing, uri: /error/HTTP_BAD_GATEWAY.html.var
> AH03042: mod_policy: violation, rejecting request: 
>   Response has no explicit freshness lifetime (s-maxage, max-age or Expires/Date), uri: /error/HTTP_BAD_GATEWAY.html.var

Whereas Windows dies on parsing the httpd-policy.conf:

> AH00082: an unknown filter was not added: POLICY_TYPEPOLICY_LENGTHPOLICY_KEEPALIVEPOLICY_VARYPOLICY_VALIDATIONPOLICY_CONDITIONALPOLICY_NOCACHEPOLICY_MAXAGE

Could it be a ':' vs. ';' PATH delimiter thing on Linux vs Windows? Gonna look into the module...
Comment 4 Michal Karm Babacek 2018-07-30 14:11:24 UTC
The problem is actually around here [1], the CMake list used as such probably eats the semicolons in the files [2]. 

[1] https://github.com/apache/httpd/blob/trunk/CMakeLists.txt#L984
[2] https://cmake.org/pipermail/cmake/2016-January/062594.html
Comment 5 Michal Karm Babacek 2018-07-30 15:08:35 UTC
Created attachment 36057 [details]
Fixes policy module for Linux and Windows CMake build

Hi guys, ASF-BZ-62567.patch fixes the glitch. Could it be merged into trunk?

Linux works
===========

> $ patch -p1 -i ASF-BZ-62567.patch
> patching file CMakeLists.txt
> patching file docs/conf/extra/httpd-policy.conf.in
> patching file configure.in
> patching file docs/conf/httpd.conf.in

> CFLAGS="-O2" ./configure --enable-http2 --enable-policy  --enable-load-all-modules --prefix=/home/karm/Projects/MOD_CLUSTER/httpd-trunk-build;make;make install

> sed -i 's/LogLevel warn/LogLevel debug/g' ../conf/httpd.conf
> sed -i 's/#Include /Include /g' ../conf/httpd.conf

> [Mon Jul 30 14:58:23.147221 2018] [policy:error] [pid 23055:tid 140216748517120] 
>     [client 127.0.0.1:44016] AH03042: mod_policy: violation, rejecting request: 
>     Etag and Last Modified missing, uri: /error/HTTP_BAD_GATEWAY.html.var
> [Mon Jul 30 14:58:23.147253 2018] [policy:error] [pid 23055:tid 140216748517120] 
>     [client 127.0.0.1:44016] AH03042: mod_policy: violation, rejecting request: 
>     Response has no explicit freshness lifetime (s-maxage, max-age or Expires/Date), uri: /error/HTTP_BAD_GATEWAY.html.var

Windows works
=============

> [Mon Jul 30 07:58:30.409709 2018] [mpm_winnt:notice] [pid 5332:tid 500]
>      AH00354: Child: Starting 150 worker threads.
> [Mon Jul 30 07:58:31.337382 2018] [policy:error] [pid 5332:tid 3680]
>      [client ::1:56621] AH03042: mod_policy: violation, rejecting request: 
>      Response has no explicit freshness lifetime (s-maxage, max-age or Expires/Date), uri: /index.html
> [Mon Jul 30 07:58:31.339390 2018] [policy:error] [pid 5332:tid 3680]
>      [client ::1:56621] AH03042: mod_policy: violation, rejecting request: 
>      Etag and Last Modified missing, uri: /error/HTTP_BAD_GATEWAY.html.var
> [Mon Jul 30 07:58:31.339390 2018] [policy:error] [pid 5332:tid 3680]
>      [client ::1:56621] AH03042: mod_policy: violation, rejecting request: 
>      Response has no explicit freshness lifetime (s-maxage, max-age or Expires/Date), uri: /error/HTTP_BAD_GATEWAY.html.var
Comment 6 Michal Karm Babacek 2018-07-30 16:35:40 UTC
Successfully built and smoke tested httpd trunk artifacts:
https://ci.modcluster.io/job/httpd-trunk-windows/label=w2k12r2/32/

Build log: https://ci.modcluster.io/job/httpd-trunk-windows/label=w2k12r2/32/consoleText

(It requires one to have an arbitrary GitHub account (or a GitHub app token with cURL), keeps the silliest bots away...)
Comment 7 Jim Jagielski 2018-08-09 11:30:46 UTC
Committed r1837717

Thx!