Bug 1325741

Summary: cgconfig.aug augeas lens does not handle dperm and fperm in the permissions block
Product: Red Hat Enterprise Linux 7 Reporter: Muhammad Azhar Shaikh <mdshaikh>
Component: augeasAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: xchen, yoguo
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: https://github.com/hercules-team/augeas/commit/ce1ba83fe7ca5b5c9be4c396be8e9e106cfaf0e3
Whiteboard:
Fixed In Version: augeas-1.4.0-5.el7 Doc Type: Bug Fix
Doc Text:
Prior to this update, Augeas was not able to parse the dperm and fperm keys in permissions blocks in the cgroup configuration (/etc/cgconfig.conf). The cgconfig lens of Augeas has been fixed to parse also the dperm and fperm keys. As a result, Augeas now reads /etc/cgconfig.conf also with dperm and fperm keys in permissions blocks.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 09:55:26 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: 1420851    

Description Muhammad Azhar Shaikh 2016-04-11 04:50:54 UTC
augeas fails to parse a cgconfig.conf file with the fperm and dperm keys in the task/admin blocks inside a perm block inside a group block.


Red Hat Enterprise Linux Workstation release 7.2 (Maipo)
kernel-3.10.0-327.4.5.el7.x86_64 
augeas-libs-1.4.0-2.el7.x86_64
python-augeas-0.5.0-2.el7.noarch
ruby-augeas-0.5.0-1.el7.x86_64



Here is a success (not trying to use fperm or dperm):

# cat >/var/tmp/succeeds.aug <<EOM
set /files/etc/cgconfig.conf/group[ .= 'new_group' ] 'new_group'
set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/uid 'root'
set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/gid 'root'
save
EOM

# augtool -f /var/tmp/succeeds.aug -e
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ] 'new_group'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/uid 'root'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/gid 'root'
augtool> save
Saved 1 file(s)




And here is a failure with the augeas error:

# cat >/var/tmp/fails.aug <<EOM
set /files/etc/cgconfig.conf/group[ .= 'new_group' ] 'new_group'
set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/uid 'root'
set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/gid 'root'
set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/fperm '777'
save
errors
EOM


# augtool -f /var/tmp/fails.aug -e
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ] 'new_group'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/uid 'root'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/gid 'root'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/fperm '777'
augtool> save
error: Failed to execute command
saving failed (run 'errors' for details)
augtool> errors
Error in /etc/cgconfig.conf (put_failed)
  Failed to match

(    { /uid|gid/ = /[^\001-\004\t\n #;{}]+/ }
      | { /#comment/ = /[^\001-\004\t\n\r ][^\001-\004\n]*[^\001-\004\t\n\r ]|[^\001-\004\t\n\r ]/ }
      | { })*
  with tree
    { "uid" = "root" } { "gid" = "root" } { "fperm" = "777" }
  Lens: /usr/share/augeas/lenses/dist/cgconfig.aug:51.7-.49:
augtool>

If I modify /usr/share/augeas/lenses/dist/cgconfig.aug and change (uid|gid) to (uid|gid|fperm|dperm) it can save the file.

Comment 5 YongkuiGuo 2017-10-10 07:42:09 UTC
Verified with package:
augeas-1.4.0-5.el7.x86_64

Steps:

1. #yum install libcgroup-tools (there is no /etc/cgconfig.conf by default on rhel7.4 host. so need to install this package)

2. # augtool 
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ] 'new_group'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/uid 'root'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/gid 'root'
augtool> set /files/etc/cgconfig.conf/group[ .= 'new_group' ]/perm/task/fperm '777'
augtool> save
Saved 1 file(s)
augtool>


The save command can be executed successfully. No error occurs. Verified it.

Comment 8 errata-xmlrpc 2018-04-10 09:55:26 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-2018:0684