diff --git a/udica/parse.py b/udica/parse.py index bc8e59a..699382e 100644 --- a/udica/parse.py +++ b/udica/parse.py @@ -96,8 +96,10 @@ def get_ports(self, data): ports = [] for key, value in data[0]["NetworkSettings"]["Ports"].items(): container_port = str(key).split("/") - host_port = value[0]["HostPort"] - new_port = {"hostPort": int(host_port), "protocol": container_port[1]} + new_port = { + "portNumber": int(container_port[0]), + "protocol": container_port[1], + } ports.append(new_port) return ports diff --git a/udica/policy.py b/udica/policy.py index 2f21c37..e9e94d6 100644 --- a/udica/policy.py +++ b/udica/policy.py @@ -148,10 +148,10 @@ def create_policy(opts, capabilities, mounts, ports, append_rules, inspect_forma # ports for item in ports: - if "hostPort" in item: + if "portNumber" in item: policy.write( " (allow process " - + list_ports(item["hostPort"], item["protocol"]) + + list_ports(item["portNumber"], item["protocol"]) + " ( " + perms.socket[item["protocol"]] + " ( name_bind ))) \n"