turbot/kubernetes_compliance

Query: statefulset_container_privilege_port_mapped

Usage

powerpipe query kubernetes_compliance.query.statefulset_container_privilege_port_mapped

Steampipe Tables

SQL

select
case
when source_type = 'deployed' then c ->> 'name'
else concat(path, ':', start_line)
end as resource,
case
when p ->> 'name' is null then 'skip'
when cast(p ->> 'containerPort' as integer) <= 1024 then 'alarm'
else 'ok'
end as status,
case
when p ->> 'name' is null then 'No port mapped.'
when cast(p ->> 'containerPort' as integer) <= 1024 then p ->> 'name' || ' mapped with a privileged port.'
else p ->> 'name' || ' not mapped with a privileged port.'
end as reason,
name as stateful_set_name
, coalesce(context_name, '') as context_name, namespace, source_type, coalesce(path || ':' || start_line || '-' || end_line, '') as path
from
kubernetes_stateful_set,
jsonb_array_elements(template -> 'spec' -> 'containers') as c,
jsonb_array_elements(c -> 'ports') as p;

Controls

The query is being used by the following controls: