Control: 2.14 Ensure containers are restricted from acquiring new privileges
Description
By default you should restrict containers from acquiring additional privileges via suid or sgid.
Usage
Run the control in your terminal:
powerpipe control run docker_compliance.control.cis_v160_2_14
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run docker_compliance.control.cis_v160_2_14 --share
SQL
This control uses a named query:
with hostname as ( select btrim(stdout_output, E' \n\r\t') as host, _ctx ->> 'connection_name' as host_conn, _ctx from exec_command where command = 'hostname'),
command_output as ( select stdout_output, _ctx ->> 'connection_name' as conn from exec_command where command = 'ps -ef | grep dockerd')select host as resource, case when o.stdout_output like '%--no-new-privileges=false%' then 'alarm' when o.stdout_output not like '%--no-new-privileges%' then 'alarm' else 'ok' end as status, case when o.stdout_output like '%--no-new-privileges=false%' then host || ' no new privileges is disabled.' when o.stdout_output not like '%--no-new-privileges%' then host || ' no new privileges not set.' else host || ' no new privilege is enabled.' end as reason , h._ctx ->> 'connection_name' as connection_namefrom hostname as h, command_output as owhere h.host_conn = o.conn;