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 1466242 - Unable to change permissions of hostconfig.json and config.v2.json
Summary: Unable to change permissions of hostconfig.json and config.v2.json
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Antonio Murdaca
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-29 10:32 UTC by Suhaas Bhat
Modified: 2020-12-14 08:58 UTC (History)
4 users (show)

Fixed In Version: docker-2:1.12.6-50.git0fdc778
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-05 10:35:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2599 0 normal SHIPPED_LIVE docker bug fix and enhancement update 2017-09-05 14:32:57 UTC

Description Suhaas Bhat 2017-06-29 10:32:28 UTC
Description of problem:
We are unable to change the permissions of these two json files inside /var/lib/docker/containers/<container ID>/ whenever any container is created.
If we change the permissions once, they get automatically changed if we start/stop the container or restart the docker service.

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 7.3 (Maipo)
docker-1.12.6-28.git1398f24.el7.x86_64

How reproducible:
Fully 

Steps to Reproduce:
1.chmod 755 /var/lib/docker/containers/<container-id>/config.v2.json
2.docker start/stop <container-id>
3.Permission changed to -rw-rw-rw- (not changeable)

Actual results:
Permissions do not change and get back to original ones i.e 666 (world writeable)


Expected results:
Should have changed to 755

Additional info:

Comment 2 Daniel Walsh 2017-06-29 12:35:05 UTC
I don't see any files with this permissions running docker-1.13?

Comment 3 Daniel Walsh 2017-06-29 12:37:02 UTC
This is not a big security problme since not privileged users can get access to these files, but I have no idea why this is happening.

Comment 4 Suhaas Bhat 2017-06-29 12:54:39 UTC
Yes, Docker-latest package allows to change those files permissions.

Comment 5 Antonio Murdaca 2017-06-29 13:39:28 UTC
docker-latest seems to have the same "issue" - not sure what's happening in docker since the only things docker does with that file is opening it, reading it and writing it. I can't see any code path setting/changing perms on it.

Just curious, what's the use case of changing perms of this file? I wouldn't say this is a bug...

Comment 6 Antonio Murdaca 2017-06-29 13:40:55 UTC
alright, I found what changed - this happens when writing the hostconfig file. But I still want to hear why should we support this use case.

Comment 7 Antonio Murdaca 2017-06-29 13:42:06 UTC
The change between 1.12 and 1.13 is this:

  1 tree 0b61f8fbfe6e4d6402e140c31b4c34ad99df3eb1
  2 parent bf16fa47b7fcf5133818cd12bab1c2f60ba8d363
  3 author epeterso <epeterson> Tue Nov 1 16:00:17 2016 -0400
  4 committer epeterso <epeterson> Tue Nov 1 16:18:15 2016 -0400
  5
  6 remove world/group writable perms
  7
  8 change files from being written with group and world writable permissions.
  9
 10 Signed-off-by: epeterso <epeterson>
 11
 12 diff --git a/container/container.go b/container/container.go
 13 index dc08cebba..722271be9 100644
 14 --- a/container/container.go
 15 +++ b/container/container.go
 16 @@ -147,7 +147,7 @@ func (container *Container) ToDisk() error {
 17                 return err
 18         }
 19
 20 -       jsonSource, err := ioutils.NewAtomicFileWriter(pth, 0666)
 21 +       jsonSource, err := ioutils.NewAtomicFileWriter(pth, 0644)
 22         if err != nil {
 23                 return err
 24         }
 25 @@ -207,7 +207,7 @@ func (container *Container) WriteHostConfig() error {
 26                 return err
 27         }
 28
 29 -       f, err := ioutils.NewAtomicFileWriter(pth, 0666)
 30 +       f, err := ioutils.NewAtomicFileWriter(pth, 0644)
 31         if err != nil {
 32                 return err
 33         }

Comment 8 Daniel Walsh 2017-06-29 13:50:11 UTC
That looks correct.  We should back port this.

Comment 9 Daniel Walsh 2017-06-30 13:59:44 UTC
Antonio, people have tools that search the file system for world writable content and then mark the systems as unsafe.  Even though a non privilege user can't get to the file.  Fixing this issue, will make people scanning systems happier.

Comment 10 Antonio Murdaca 2017-06-30 14:33:22 UTC
alright, I've backported the patch to 1.12.6

Comment 12 Luwen Su 2017-08-25 08:11:41 UTC
Verified in docker-1.12.6-55.gitc4618fb.el7.x86_64

Comment 14 errata-xmlrpc 2017-09-05 10:35:14 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-2017:2599


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