@@ -41,7 +41,7 @@ frontend docker_engine
41
41
http-request auth realm AppAPI unless valid_credentials
42
42
43
43
# 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
45
45
# container inspect: GET containers/%s/json
46
46
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/nc_app_[a-zA-Z0-9_.-]+/json } METH_GET
47
47
# container inspect: GET containers/%s/logs
@@ -66,19 +66,19 @@ frontend docker_engine
66
66
# ACL to deny if there are any binds
67
67
acl binds_present req.body -m reg -i "\"HostConfig\"\s*:.*\"Binds\"\s*:"
68
68
# 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+\"[^\]]*)+\]"
70
70
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
71
71
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\""
74
74
# 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\""
76
76
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
77
77
# end of container create
78
78
79
79
# volume create: POST volumes/create
80
80
# 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\""
82
82
# do not allow to use "device" word e.g., "--opt device=:/path/to/dir"
83
83
acl volume_no_device req.body -m reg -i "\"device\""
84
84
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