@@ -41,7 +41,7 @@ frontend docker_engine
4141 http-request auth realm AppAPI unless valid_credentials
4242
4343 # docker system _ping
44- http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/_ping } METH_GET
44+ http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/_ping$ } METH_GET
4545 # container inspect: GET containers/%s/json
4646 http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+/json } METH_GET
4747 # container inspect: GET containers/%s/logs
@@ -66,19 +66,19 @@ frontend docker_engine
6666 # ACL to deny if there are any binds
6767 acl binds_present req.body -m reg -i "\"HostConfig\"\s*:.*\"Binds\"\s*:"
6868 # ACL to restrict the type of Mounts to volume
69- acl type_not_volume req.body -m reg -i "\"Mounts\":\s*\[[^\]]*(\"Type\":\s*\"(?!volume\b)\w+\"[^\]]*)+\]"
69+ acl type_not_volume req.body -m reg -i "\"Mounts\"\s* :\s*\[[^\]]*(\"Type\"\s* :\s*\"(?!volume\b)\w+\"[^\]]*)+\]"
7070 http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/create } nc_app_container_name !one_mount_volume binds_present type_not_volume METH_POST
7171
72- # ACL to restrict container creation, that it has HostConfig.Privileged not set
73- acl no_privileged_flag req.body -m reg -i "\"HostConfig\":\s?{[^}]*\" Privileged\""
72+ # ACL to restrict container creation, that it has HostConfig.Privileged(by searching for "Privileged" word in all payload)
73+ acl no_privileged_flag req.body -m reg -i "\"Privileged\""
7474 # ACL to allow mount volume with strict pattern for name: nc_app_[a-zA-Z0-9_.-]+_data
75- acl nc_app_volume_data_only req.body -m reg -i "\"Mounts\":\s? \[\s? {[^}]*\"Source\":\s? \"nc_app_[a-zA-Z0-9_.-]+_data\""
75+ acl nc_app_volume_data_only req.body -m reg -i "\"Mounts\"\s* :\s* \[\s* {[^}]*\"Source\"\s* :\s* \"nc_app_[a-zA-Z0-9_.-]+_data\""
7676 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
7777 # end of container create
7878
7979 # volume create: POST volumes/create
8080 # restrict name
81- acl nc_app_volume_data req.body -m reg -i "\"Name\":\s? \"nc_app_[a-zA-Z0-9_.-]+_data\""
81+ acl nc_app_volume_data req.body -m reg -i "\"Name\"\s* :\s* \"nc_app_[a-zA-Z0-9_.-]+_data\""
8282 # do not allow to use "device" word e.g., "--opt device=:/path/to/dir"
8383 acl volume_no_device req.body -m reg -i "\"device\""
8484 http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/volumes/create } nc_app_volume_data !volume_no_device METH_POST
0 commit comments