Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1778052

Summary: All api servers running under httpd with wsgi have /icons accessible
Product: Red Hat OpenStack Reporter: Takashi Kajinami <tkajinam>
Component: puppet-openstacklibAssignee: Cédric Jeanneret <cjeanner>
Status: CLOSED ERRATA QA Contact: nlevinki <nlevinki>
Severity: medium Docs Contact:
Priority: medium    
Version: 13.0 (Queens)CC: amoralej, cjeanner, jagee, jjoyce, jschluet, knoha, mburns, nkinder, ramishra, slinaber, tvignaud
Target Milestone: zstreamKeywords: Triaged, ZStream
Target Release: 13.0 (Queens)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: puppet-openstacklib-12.4.0-4.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-10 11:23:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Takashi Kajinami 2019-11-29 07:11:04 UTC
Description of problem:

Currently most of api processes are running under httpd with wsgi frame work,
but all httpd process has valid alias configuration for icons directory,
which enables us to access /icons path.
~~~
[heat-admin@controller-0 ~]$ curl -v -I http://172.17.1.10:8774/icons/
* About to connect() to 172.17.1.10 port 8774 (#0)
*   Trying 172.17.1.10...
* Connected to 172.17.1.10 (172.17.1.10) port 8774 (#0)
> HEAD /icons/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 172.17.1.10:8774
> Accept: */*
> 
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Fri, 29 Nov 2019 07:07:44 GMT
Date: Fri, 29 Nov 2019 07:07:44 GMT
< Server: Apache
Server: Apache
< Content-Type: text/html;charset=UTF-8
Content-Type: text/html;charset=UTF-8

< 
* Connection #0 to host 172.17.1.10 left intact
~~~

Although it does not cause effect on software behaviour, it can bring us some security concern because it makes unnecessary files accessible 

How reproducible:
Always

Steps to Reproduce:
1. Deploy overcloud with director
2. curl http://<IP>:<api port>/icons

Actual results:


Expected results:
200 is returned with some contents

Additional info:
404 is returned

Comment 2 Cédric Jeanneret 2019-12-02 08:05:00 UTC
Hello there,

All is managed in puppet-openstacklib, so hopefully one patch only is needed.

This is probably affecting all of OSP versions though, so it will take some time to do the appropriate backports. In fact, I think we might be able to deactivate the Index option for *all* locations, since we probably want to disallow Directory Listing. Right?

Putting DFG:Security and needinfo() on Nathan to raise their awareness and get some feedback.

Cheers,

C.

Comment 4 Takashi Kajinami 2019-12-02 13:48:55 UTC
Hi Cédric,


Thank you for working about this issue.

I tried the change you proposed in my local, by restarting nova_api after removing Index in /var/lib/config-data/puppet-generated/nova/etc/httpd/conf.d/10-nova_api_wsgi.conf,
but I'm afraid that we still can see the Index page.
After some more investigation about the reson, I found that the index is enabled by /etc/httpd/conf.d/autoindex.conf, which should be also fixed.
You can find a bug about that file filed on bugzilla[1] .
It seems that current puppet-apache expects these configuration files located under /etc/httpd/conf.modules.d,
and we don't have any mechanism to delete these files under /etc/http/conf.d  .

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1729423


In addition, while we don't see index page after removing Index also in autoindex.conf, we still see that we can access to files under icons.

~~~
[heat-admin@controller-0 ~]$ sudo docker restart nova_api
nova_api
[heat-admin@controller-0 ~]$ sudo docker exec -it nova_api cat /etc/httpd/conf.d/autoindex.conf
...
IndexOptions FancyIndexing HTMLTable VersionSort

# We include the /icons/ alias for FancyIndexed directory listings.  If
# you do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/usr/share/httpd/icons/"

<Directory "/usr/share/httpd/icons">
    Options MultiViews FollowSymlinks
    AllowOverride None
    Require all granted
</Directory>

...
[heat-admin@controller-0 ~]$ sudo docker exec -it nova_api cat /etc/httpd/conf.modules.d/alias.conf
<IfModule alias_module>
Alias /icons/ "/usr/share/httpd/icons/"
<Directory "/usr/share/httpd/icons">
    Options None
    AllowOverride None
    Require all granted
</Directory>
</IfModule>
[heat-admin@controller-0 ~]$ curl -I -v http://172.17.1.10:8774/icons/unknown.gif
* About to connect() to 172.17.1.10 port 8774 (#0)
*   Trying 172.17.1.10...
* Connected to 172.17.1.10 (172.17.1.10) port 8774 (#0)
> HEAD /icons/unknown.gif HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 172.17.1.10:8774
> Accept: */*
> 
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
...
< Content-Length: 245
Content-Length: 245
< Content-Type: image/gif
Content-Type: image/gif

...
~~~

I think this is because we have alias configuration in /var/lib/config-data/puppet-generated/nova/etc/httpd/conf.modules.d/alias.conf (which I tried to fix in my patch),
and that autoindex.conf inside docker container.
I believe that we also should fix them because we don't need them exposed.

Please let me know if you find anything wrong with my above findings.

Thank you,
Takashi

Comment 5 Cédric Jeanneret 2019-12-02 14:48:16 UTC
Hello Takashi,

Ah, good finding for the other autoindex.conf thing, I'll investigate that one once my current deploy is over.

Regarding the fact that icons are still available - it's not a real issue imho:
- not really resource-hungry
- if no auto-index, no real way to discover them (nor do some directory structure discovery)
- API are supposed to be consumed by automated tools, not human
- I don't see why having the ability to point to an exact, known name is an issue

On the other hand, if we're wanting to not expose that anymore, it will probably make things more complicated within the whole tripleo templates - not sure of the benefits... ?

I propose we first solve the auto-index issue, since this one is really causing some problems (tree discovery and so on), and if there is a real concern about icon availability, we can try to find an elegant solution. Fact is, static content is supposed to be served by httpd directly - so it shouldn't impact wsgi itself.

Does it sounds like a plan?

Thank you for your feedback!

C.

Comment 6 Takashi Kajinami 2019-12-06 00:01:14 UTC
Hi Cédric,


Sorry for my late reply.

I'm agree with you about the less benefits about disabling the direct access to files under icons
and the plan sounds good to me.
Maybe we can create another independent bug with low priority about direct access.

Thank you,
Takashi

Comment 7 Cédric Jeanneret 2020-01-06 15:48:12 UTC
Update: started upstream backports in // down to Queens. Related links are added here.

Comment 8 Cédric Jeanneret 2020-01-09 14:44:59 UTC
Hello,

OSP-13 backport in the pipes - OSP-15 and OSP-16 should already have the patch available (at least it's listed in their respective downstream branch), no need to create BZ for those two.

If everything goes well, it should be available in the next z-stream for OSP-13.

Cheers,

C.

Comment 12 errata-xmlrpc 2020-03-10 11:23:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0760