Bug 1380020

Summary: apache plugin should collect all config files
Product: Red Hat Satellite Reporter: Julio Entrena Perez <jentrena>
Component: Foreman DebugAssignee: Lukas Zapletal <lzap>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.2CC: agk, bkearney, bmr, gavin, plambri, sbradley
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-29 21:39:48 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:
Bug Depends On:    
Bug Blocks: 1115190    

Description Julio Entrena Perez 2016-09-28 13:19:59 UTC
Description of problem:
Apache plugin should collect all config files for httpd.
The following config files are currently collected:

     35         self.add_copy_spec([
     36             "/etc/httpd/conf/httpd.conf",
     37             "/etc/httpd/conf.d/*.conf",
     38             "/etc/httpd/conf.modules.d/*.conf"
     39         ])

In case there are further subdirectories in /etc/httpd/conf.d/ which also contain config files, those are not collected.
For example, in a Satellite 6 server:

  # pwd
  /etc/httpd/conf.d
  
  # ls -gG
  total 52
  -rw-r--r--. 1 1240 Aug  9 17:51 03-crane.conf
  -rw-r--r--. 1 2285 Aug  9 17:52 05-foreman.conf
  drwxr-xr-x. 2   25 Aug  9 17:54 05-foreman.d          <--
  -rw-r--r--. 1 2741 Aug  9 17:52 05-foreman-ssl.conf
  drwxr-xr-x. 2   25 Aug  9 17:54 05-foreman-ssl.d      <--
  -rw-r--r--. 1  697 Aug  9 17:51 15-default.conf
  -rw-r--r--. 1 1894 Aug  9 17:52 25-puppet.conf
  -rw-r--r--. 1  747 May 22 21:48 passenger.conf
  -rw-r--r--. 1 1238 Aug  9 17:52 pulp.conf
  -rw-r--r--. 1  747 Aug  9 17:52 pulp_content.conf
  -rw-r--r--. 1  645 Jul 12 16:01 pulp_docker.conf
  -rw-r--r--. 1 1802 Jul 12 15:52 pulp_puppet.conf
  -rw-r--r--. 1 1855 Aug  9 17:52 pulp_rpm.conf
  -rw-r--r--. 1 2451 Aug  9 17:52 pulp_streamer.conf

  # ls -gG 05-foreman.d 05-foreman-ssl.d
  05-foreman.d:
  total 4
  -rw-r--r--. 1 376 Aug  9 17:54 katello.conf
  
  05-foreman-ssl.d:
  total 4
  -rw-r--r--. 1 1114 Aug  9 17:54 katello.conf

But apache plugin currently misses those:

  # ls -gG /var/tmp/sosreport-jentrena.00000000-20160928134518/etc/httpd/conf.d/
  total 52
  -rw-r--r--. 1 1240 Aug  9 17:51 03-crane.conf
  -rw-r--r--. 1 2285 Aug  9 17:52 05-foreman.conf
  -rw-r--r--. 1 2741 Aug  9 17:52 05-foreman-ssl.conf
  -rw-r--r--. 1  697 Aug  9 17:51 15-default.conf
  -rw-r--r--. 1 1894 Aug  9 17:52 25-puppet.conf
  -rw-r--r--. 1  747 May 22 21:48 passenger.conf
  -rw-r--r--. 1 1238 Aug  9 17:52 pulp.conf
  -rw-r--r--. 1  747 Aug  9 17:52 pulp_content.conf
  -rw-r--r--. 1  645 Jul 12 16:01 pulp_docker.conf
  -rw-r--r--. 1 1802 Jul 12 15:52 pulp_puppet.conf
  -rw-r--r--. 1 1855 Aug  9 17:52 pulp_rpm.conf
  -rw-r--r--. 1 2451 Aug  9 17:52 pulp_streamer.conf

Either parsing config files for Include / IncludeOptional statements or (easier) just include any *.d directory present in /etc/httpd/conf.d .

Version-Release number of selected component (if applicable):
sos-3.2-35.el7_2.3

How reproducible:
Always

Steps to Reproduce:
1. Create example.d subdirectory in directory /etc/httpd/conf.d
2. Run sosreport
3. Extract the tarball

Actual results:
Subdirectories in directory /etc/httpd/conf.d (and the config files that those subdirectories contain) are not collected.

Expected results:
Subdirectories in directory /etc/httpd/conf.d which a name ending in "*.d" (and the config files that those subdirectories contain) are collected.

Additional info:

Comment 1 Bryn M. Reeves 2016-09-28 13:40:26 UTC
This belongs to crane:
  -rw-r--r--. 1 1240 Aug  9 17:51 03-crane.conf


These belong to foreman:
  -rw-r--r--. 1 2285 Aug  9 17:52 05-foreman.conf
  drwxr-xr-x. 2   25 Aug  9 17:54 05-foreman.d          <--
  -rw-r--r--. 1 2741 Aug  9 17:52 05-foreman-ssl.conf
  drwxr-xr-x. 2   25 Aug  9 17:54 05-foreman-ssl.d      <--

No idea where this came from, but not an httpd RPM afaik:
  -rw-r--r--. 1  697 Aug  9 17:51 15-default.conf

Puppet:
  -rw-r--r--. 1 1894 Aug  9 17:52 25-puppet.conf

Passenger(?):
  -rw-r--r--. 1  747 May 22 21:48 passenger.conf

Pulp, pulp, pulp, pulp, pulp:
  -rw-r--r--. 1 1238 Aug  9 17:52 pulp.conf
  -rw-r--r--. 1  747 Aug  9 17:52 pulp_content.conf
  -rw-r--r--. 1  645 Jul 12 16:01 pulp_docker.conf
  -rw-r--r--. 1 1802 Jul 12 15:52 pulp_puppet.conf
  -rw-r--r--. 1 1855 Aug  9 17:52 pulp_rpm.conf
  -rw-r--r--. 1 2451 Aug  9 17:52 pulp_streamer.conf

The purpose of httpd.conf.d is to allow additional packages to simply drop a configuration file into the Apache set up (without modifying any existing file).

These packages are taking advantage of this feature, and the relevant plugins for those packages are where collection of these files belong.

We cannot collect everything in this path since files here can contain arbitrary secrets that we cannot cleanly elide.

> Either parsing config files for Include / IncludeOptional statements or 
> (easier) just include any *.d directory present in /etc/httpd/conf.d .

> Subdirectories in directory /etc/httpd/conf.d which a name ending in "*.d" 
> (and the config files that those subdirectories contain) are collected.

Nack: all the mentioned files belong to some identifiable component, most of which we already have plugins to support, and should be handled by enhancing or creating those plugins rather than making the Apache into a monster.

Comment 2 Julio Entrena Perez 2016-09-28 14:43:47 UTC
Since apache plugin of sosreport does not seem to be the correct place to collect /etc/httpd/conf.d/*.d/*.conf files (see above), could you please ensure that these files are collected by foreman-debug?

If that's not possible, could you please liaise with sos and make sure that GSS has a way of getting these files in sosreports?

Comment 4 Bryan Kearney 2016-09-29 21:39:48 UTC
This is already present in satellite 6.2. Based on 

http://projects.theforeman.org/issues/11149

Foreman collects the following files:

/etc/{httpd,apache2}/conf/*
/etc/{httpd,apache2}/conf.d/*
 /etc/{httpd,apache2}/conf.d/*/*