Repository navigation
Conversation
|
This would be great. I'd definitely like to enable more granularity in Portainer, and unfortunately right now you must grant blanket POST, even if you want some minor functionality like stop/kill/restart! |
| # errorfile 400 /usr/local/etc/haproxy/errors/400.http | ||
| # errorfile 403 /usr/local/etc/haproxy/errors/403.http | ||
| # errorfile 408 /usr/local/etc/haproxy/errors/408.http | ||
| # errorfile 500 /usr/local/etc/haproxy/errors/500.http | ||
| # errorfile 502 /usr/local/etc/haproxy/errors/502.http | ||
| # errorfile 503 /usr/local/etc/haproxy/errors/503.http | ||
| # errorfile 504 /usr/local/etc/haproxy/errors/504.http |
There was a problem hiding this comment.
Not sure, maybe by accident. I'll revert this :)
| bind :2375 | ||
| http-request deny unless METH_GET || { env(POST) -m bool } | ||
| http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/[a-zA-Z0-9_.-]+/((stop)|(restart)|(kill)) } { env(ALLOW_RESTARTS) -m bool } | ||
| http-request deny unless METH_GET || METH_POST { env(POST) -m bool } || METH_DELETE { env(DELETE) -m bool } |
There was a problem hiding this comment.
I don't see the DELETE env variable in the README or the Dockerfile.
Also if POST=0 DELETE=0, this will be denied now and won't continue evaluating any more rules, right? Then all new rules should exist before this one.
| http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/version } { env(VERSION) -m bool } | ||
| http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/volumes } { env(VOLUMES) -m bool } | ||
| # POST requests | ||
| http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/create } { env(CONTAINERS_CREATE) -m bool } |
There was a problem hiding this comment.
You probably need this in all these rules:
| http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/create } { env(CONTAINERS_CREATE) -m bool } | |
| http-request allow if METH_POST { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/create } { env(CONTAINERS_CREATE) -m bool } |
Also, you should modify the README explaining that the POST variable is global, while the other ones in the table are specific and can still allow POST requests when POST=0
|
Hi! Sorry for my silence. This is a pretty old PR, so I'm out of the context now, let me check if I can address your comments :) |
|
So I have pushed some trivial fixes, but it's not enough to address your comments. Right now I don't recall how to config haproxy, so while all your feedback is right to the point, it seems that I couldn't address it. Is it possible to convert this PR to a feature request, maybe? |
|
Yes, of course. Closing, then. |
This PR adds variables to control /containers, /networks and /volumes POST & DELETE endpoints granularly.
If formatting variables in a table is a bad idea, or I need to update README further – please let me know!
Also, maybe I should mark security sensitive endpoints in a more explicit fashion? Not sure if current
POST is security-criticalis enough.