Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3481

Regex problem with an SELinux context type with a dash

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 2.7.23
    • Fix Version/s: PUP 4.0.0
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:

      Description

      I have a file on the system with the following SELinux context

      [root@sut ~]# matchpathcon /etc/my-app/my-config.cfg
      /etc/my-app/my-config.cfg    system_u:object_r:my-app_config_t:s0
      

      I also have a File["/etc/my-app/my-config.cfg"] resource defined in my manifests, which doesn't call out the seltype attribute, so according the documentation , it should get the type from matchpathcon, and set it to "my-app_config_t".

      However, it's setting it to "my" instead.

      Oct 16 13:13:43 src@sut puppet-agent[902]: (/File[/etc/my-app/my-config/cfg]/seltype) seltype changed 'etc_t' to 'my'
      

      I think I've tracked this down to the regex in parse_selinux_context() in utils/selinux.rb, where the 'type' section of the regexp stops accepting characters at the dash in the "my-app_config_t"

      I think it would be better if the regexp were something more lenient , like

      /^([^:]+):([^:]+):([^:]+)(?::([a-zA-Z0-9:,._-]+))?/
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jude Jude N
                QA Contact:
                Eric Thompson
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support