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

Use server_trusted_agents in v4 catalog endpoint #756

Merged
merged 1 commit into from
Aug 5, 2020

Conversation

alexjfisher
Copy link
Contributor

No description provided.

@@ -12,7 +12,7 @@ authorization: {
type: regex
method: [get, post]
}
allow: <%= @server_trusted_agents << '$1' %>
allow: <%= @server_trusted_agents + ['$1'] %>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not just in this template that server_trusted_agents was being mutated, but in the catalog itself. So much for puppet variables being immutable! I guess in irb, you can accidentally abuse this. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, 'naming things is hard'. Maybe I should have called it trusted_compile_clients or something instead.

deny: "*"
<%- else -%>
allow: <%= @server_trusted_agents %>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also would have liked to introduce a new parameter so that certificate extensions could have been used as well as just a list of certnames. irb instead of the old way (removed in #615) makes it more difficult though. If I just append a hash to the server_trusted_agents array the outputted string isn't valid hocon. Valid configuration would look a bit like...

allow: [
        "cert1",
        "cert2",
        {
            extensions: {
                pp_authorization: "catalog"
            }
        }
    ]

I might try to figure out a nice way of generating this in a separate PR.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, PE rule has additional restriction for v4 catalog query-params: {}, I presume for security reasons

here is the code snippet:

        {
            "allow": [
                "puppet.chepkov.lan",
                {
                    "rbac": {
                        "permission": "puppetserver:compile_catalog:*"
                    }
                }
            ],
            "match-request": {
                "method": "post",
                "path": "^/puppet/v4/catalog/?$",
                "query-params": {},
                "type": "regex"
            },
            "name": "puppetlabs v4 catalog",
            "sort-order": 500
        }
    ,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't hurt. Don't think it does much either though. The body of the post is json containing all the input data. I think any query parameters would just be ignored? https://puppet.com/docs/puppetserver/latest/puppet-api/v4/catalog.html

@ekohl
Copy link
Member

ekohl commented Aug 5, 2020

I guessed this is an enhancement, or is it a bugfix?

@alexjfisher
Copy link
Contributor Author

It should have probably been part of #689?? Not sure whether I'd call that a bug though?

@alexjfisher
Copy link
Contributor Author

It doesn't fix a regression, so probably enhancement is fine.

@ekohl ekohl merged commit ed78b93 into theforeman:master Aug 5, 2020
@wbclark wbclark mentioned this pull request Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants