Skip to content

Augeas 1.4 is still broken (doesn't like mod_rewrite and regular expressions) #1202

Closed

Description

@erebus2

I've identified another issue with augeas.

I already know about #981 and I was able to patch my own system to avoid that issue; However, it seems that even the new httpd lens fails when a config file includes regular expressions.

I have 11 config files in my folder, and augeas reports “syntax errors” for exactly those files which make use of mod_rewrite. mod_rewrite is an apache module which uses regular expressions for configuration.

At this point, I would suggest that we patch the lens ourselves as we wouldn't want to wait for a new version of augeas.

Activity

  1. jdkasten commented on Oct 29, 2015

    @jdkasten
    Contributor

    Thanks for the report @erebus2. We should report this upstream https://github.com/hercules-team/augeas

    I believe that 1.2 handles regular expressions (version I am using) :(

  2. erebus2 commented on Oct 29, 2015

    @erebus2
    Author

    @jdkasten : Huh? That would mean that they fixed #981 and broke something else at the same time...

    Maybe we should consider not to report this upstream. They might add yet another issue when this one is fixed.


    WARNING: The preceding comment contains irony. It MAY provide amusement but SHOULD NOT be taken seriously.

  3. jdkasten commented on Oct 29, 2015

    @jdkasten
    Contributor

    Can you post the file that it breaks on? We have tested and added our own rewrite rules, so it can't be universal.

    Clarification: Rewrite rules which contain regexp

  4. pde commented on Oct 30, 2015

    @pde
    Member

    If possible please send us all of the breaking conf files, so that we can make test cases out of them :)

  5. added this to the 1.0 for launch milestone on Oct 30, 2015
  6. chriscroome commented on Nov 3, 2015

    @chriscroome

    There appears to be another issue with the use of less than in <IfVersion> in default Debian Apache config files, see:

    The bug for regular expressions is here hercules-team/augeas#307

  7. owenhayman commented on Nov 3, 2015

    @owenhayman

    @chriscroome Indeed. It seems that Augeas in general is breaking when special chars are included in the directives. E.g. using logic operators such as ">" and "<" in the tags (if I'm correct) causes Augeas to break. Check replies to #1264 for extra info.

  8. pde commented on Nov 6, 2015

    @pde
    Member

    I did some testing on this... I was able to reproduce the mod_rewrite problem on some systems (but not all... it may depend on minor versions of Augeas 1.2...) by adding the following to an Apache config file:

        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule ^(.+?(this|that+))$ https://%{HTTP_HOST}%{REQUEST_URI}/$1 [L,R,NE]
    
        RewriteRule "^/?path/([^/]+)/([^/]+)" "/path?$1=$2" [PT]
            RewriteCond "%{QUERY_STRING}" "(.*(?:^|&))mykey=([^&]*)&?(.*)&?$"
        RewriteCond "%2" !=not-so-secret-value 
        RewriteRule "(.*)" - [F]
        RewriteCond "%{QUERY_STRING}" "(.*(?:^|&))mykey=([^&]*)&?(.*)&?$"
        RewriteRule "(.*)" "$1/products/%2/?" [PT]
        # Remove mykey=???
        RewriteCond "%{QUERY_STRING}" "(.*(?:^|&))mykey=([^&]*)&?(.*)&?$"
        RewriteRule "(.*)" "$1?%1%3"
    
        RewriteCond "/var/www/my_blog/%{REQUEST_FILENAME}" !-f
        RewriteCond "/var/www/my_blog/%{REQUEST_FILENAME}" !-d
        RewriteRule "^" "index.php" [PT]
        RedirectMatch "^/$" "http://example.com/about/"
    

    However, once #1291 was merged the mod_rewrite problem seems to have been solved.

  9. pde commented on Nov 6, 2015

    @pde
    Member

    For the record, I could repro on ubuntu 14.04 with libaugeas0 at 1.2.0-0ubuntu1.1; I could not repro on debian sid with libaugeas0 at 1.2.0-0.2. Quite mysterious.

  10. pde commented on Nov 6, 2015

    @pde
    Member

    Regexps in apache If conditionals also work fine (now):

        <If "! reqenv('PATH') =~ /.*b[a-z]+in?/">
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule ^(.+?(this|that+))$ https://%{HTTP_HOST}%{REQUEST_URI}/$1 [L,R,NE]
        </If>
    

    So closing this bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions