Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx: Support semicolons in values #566

Closed
rgm3 opened this issue Jun 12, 2018 · 3 comments
Closed

nginx: Support semicolons in values #566

rgm3 opened this issue Jun 12, 2018 · 3 comments

Comments

@rgm3
Copy link

rgm3 commented Jun 12, 2018

I would like to use augtool to parse an nginx.conf file that contains:

add_header X-XSS-Protection "1; mode=block" always;

Unfortunately, I have not as yet been able to appropriately modify the nginx.aug lens to redefine the statement terminator as "semicolons at the end of the line that are not within double quotes."

@rgm3 rgm3 changed the title (nginx lens) Support semicolons in values nginx: Support semicolons in values Jun 12, 2018
lutter added a commit to lutter/augeas that referenced this issue Jun 13, 2018
…ives

The 'argument' to a simple directive can now be made up of any number of
bare words (not containing quotes) and quoted strings. Semicolons are
allowed within quoted strings.

Fixes hercules-team#566
@lutter
Copy link
Member

lutter commented Jun 13, 2018

Have a look at PR #567 - that should do what you want. Please let me know if that works for you.

I am not familiar with Nginx syntax - if there are other kinds of directives that need this treatment, please let me know, too.

lutter added a commit to lutter/augeas that referenced this issue Jun 14, 2018
…ives

The 'argument' to a simple directive can now be made up of any number of
bare words (not containing quotes) and quoted strings. Semicolons are
allowed within quoted strings.

Fixes hercules-team#566
@rgm3
Copy link
Author

rgm3 commented Jun 14, 2018

Not sure if it counts as "this kind of treatment" but the "location" directive supports an internal key word that does not currently parse, so I have excluded it from my configuration. I can open a separate ticket for that or we can re-word this ticket to "nginx improvements".

location /foo {
  root /var/www/html;
  internal;  # only valid in location blocks
}

Related to the internal keyword, the single-word break; directive is valid in server, context, and if blocks, although it's perhaps good enough to simply support any single-word directive from a whitelist anywhere in the tree as a first step.

lutter added a commit to lutter/augeas that referenced this issue Jun 15, 2018
The 'argument' to a simple directive can now be made up of any number of
bare words (not containing quotes) and quoted strings. Semicolons are
allowed within quoted strings.

Also, allow simple directives without arguments (like 'internal' for
location)

Fixes hercules-team#566
@lutter
Copy link
Member

lutter commented Jun 15, 2018

I've changed the PR so that the lens now accepts simple directives like 'internal'; there's no whitelist for such entries though, it'll accept 'joey;' just the same as a directive.

lutter added a commit to lutter/augeas that referenced this issue Jun 26, 2018
The 'argument' to a simple directive can now be made up of any number of
bare words (not containing quotes) and quoted strings. Semicolons are
allowed within quoted strings.

Also, allow simple directives without arguments (like 'internal' for
location)

Fixes hercules-team#566
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants