mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
small rules adjustments
This commit is contained in:
parent
e55faec870
commit
5523dfc6ae
1 changed files with 15 additions and 4 deletions
|
|
@ -9,11 +9,15 @@ frontend http
|
|||
mode http
|
||||
bind :2375
|
||||
http-request deny unless { src 127.0.0.1 } || { src ::1 } || { src NC_IPV4_PLACEHOLDER } || { src NC_IPV6_PLACEHOLDER }
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+/((json)|(start)|(stop)) } METH_GET
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+ } METH_DELETE
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+/((json)) } METH_GET
|
||||
# container inspect: GET containers/%s/json
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+/json } METH_GET
|
||||
# container start/stop: POST containers/%s/start containers/%s/stop
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+/((start)|(stop)) } METH_POST
|
||||
# container rm: DELETE containers/%s
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+ } METH_DELETE
|
||||
|
||||
|
||||
# container create: POST containers/create?name=%s
|
||||
# ACL to restrict container name to nc_app_[a-zA-Z0-9_.-]+
|
||||
acl nc_app_container_name url_param(name) -m reg -i "^nc_app_[a-zA-Z0-9_.-]+"
|
||||
|
||||
|
|
@ -30,10 +34,17 @@ frontend http
|
|||
# ACL to allow mount volume with strict pattern for name: nc_app_[a-zA-Z0-9_.-]+_data
|
||||
acl nc_app_volume_data_only req.body -m reg -i "\"Mounts\":\s?\[\s?{[^}]*\"Source\":\s?\"nc_app_[a-zA-Z0-9_.-]+_data\""
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/create } nc_app_container_name no_privileged_flag nc_app_volume_data_only METH_POST
|
||||
# end of container create
|
||||
|
||||
# volume create: POST volumes/create
|
||||
# restrict name
|
||||
acl nc_app_volume_data req.body -m reg -i "\"Name\":\s?\"nc_app_[a-zA-Z0-9_.-]+_data\""
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/volumes/create } nc_app_volume_data METH_POST
|
||||
# do not allow to use "device" word e.g., "--opt device=:/path/to/dir"
|
||||
acl volume_no_device req.body -m reg -i "\"device\""
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/volumes/create } nc_app_volume_data !volume_no_device METH_POST
|
||||
# volume rm: DELETE volumes/%s
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/volumes/nc_app_[a-zA-Z0-9_.-]+_data } METH_DELETE
|
||||
# image pull: POST images/create?fromImage=%s
|
||||
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/images/create } METH_POST
|
||||
http-request deny
|
||||
default_backend dockerbackend
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue