PaloAltoNetworks / terraform-provider-prismacloudcompute

Terraform provider for Prisma Cloud Compute
https://registry.terraform.io/providers/PaloAltoNetworks/prismacloudcompute/latest
Mozilla Public License 2.0
24 stars 28 forks source link

Fix Typo in Runtime Host Policy #36

Closed hi-artem closed 2 years ago

hi-artem commented 2 years ago

Description

I noticed that applying policy containing file_integrity_rule is causing unexpected crash with v0.2.0. I fixed the typo that seems to cause an issue, but haven't tested to confirm it works just yet.

Motivation and Context

Fix the bug

How Has This Been Tested?

Tested v0.2.0 with the following template is causing crash:

resource "prismacloudcompute_host_runtime_policy" "ruleset" {
  rule {
    collections = [
      "All",
    ]
    disabled = true
    name     = "Host Security Policy"
    notes    = "Host Security Policy covers FIM rules, Egress Allow list and has anti-malware rules to prevent system abuse/misuse"

    activities {
      disabled                   = false
      docker_enabled             = true
      readonly_docker_enabled    = true
      service_activities_enabled = false
      sshd_enabled               = true
      sudo_enabled               = true
    }

    antimalware {
      allowed_processes = [
        "/var/spool/anacron/cron.daily",
        "/var/spool/anacron/cron.weekly",
        "/var/spool/anacron/cron.monthly",
      ]
      crypto_miners                    = "prevent"
      custom_feed                      = "alert"
      detect_compiler_generated_binary = false
      encrypted_binaries               = "alert"
      execution_flow_hijack            = "alert"
      intelligence_feed                = "alert"
      reverse_shell                    = "alert"
      service_unknown_origin_binary    = "alert"
      skip_ssh_tracking                = false
      suspicious_elf_headers           = "alert"
      temp_filesystem_processes        = "alert"
      user_unknown_origin_binary       = "alert"
      webshell                         = "alert"
      wildfire_analysis                = "alert"

      denied_processes {
        effect = "prevent"
        paths = [
          "yersinia",
        ]
      }
    }

    dns {
      allowed = [
        "*.datadoghq.com",

      ]
      denied            = []
      deny_effect       = "prevent"
      intelligence_feed = "prevent"
    }

    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/etc"
      read              = false
      recursive         = true
      write             = true
    }
    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/sbin"
      read              = false
      recursive         = true
      write             = true
    }
    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/usr/local"
      read              = false
      recursive         = true
      write             = true
    }
    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/bin"
      read              = false
      recursive         = true
      write             = true
    }
    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/usr/sbin"
      read              = false
      recursive         = true
      write             = true
    }
    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/home/*/.ssh/*"
      read              = false
      recursive         = true
      write             = true
    }
    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/usr/bin"
      read              = false
      recursive         = true
      write             = true
    }
    file_integrity_rule {
      allowed_processes = []
      excluded_files    = []
      metadata          = false
      path              = "/boot"
      read              = false
      recursive         = true
      write             = true
    }

    network {
      allowed_outbound_ips = []
      custom_feed          = "alert"
      denied_outbound_ips  = []
      deny_effect          = "alert"
      intelligence_feed    = "alert"
    }
  }
  rule {
    collections = [
      "All",
    ]
    disabled = true
    name     = "Default - alert on suspicious runtime behavior"

    activities {
      disabled                   = false
      docker_enabled             = false
      readonly_docker_enabled    = false
      service_activities_enabled = false
      sshd_enabled               = false
      sudo_enabled               = false
    }

    antimalware {
      allowed_processes                = []
      crypto_miners                    = "alert"
      custom_feed                      = "alert"
      detect_compiler_generated_binary = false
      encrypted_binaries               = "alert"
      execution_flow_hijack            = "alert"
      intelligence_feed                = "alert"
      reverse_shell                    = "alert"
      service_unknown_origin_binary    = "alert"
      skip_ssh_tracking                = false
      suspicious_elf_headers           = "alert"
      temp_filesystem_processes        = "alert"
      user_unknown_origin_binary       = "alert"
      webshell                         = "alert"
      wildfire_analysis                = "alert"

      denied_processes {
        effect = "alert"
        paths  = []
      }
    }

    dns {
      allowed           = []
      denied            = []
      deny_effect       = "disable"
      intelligence_feed = "disable"
    }

    network {
      allowed_outbound_ips = []
      custom_feed          = "alert"
      denied_outbound_ips  = []
      deny_effect          = "alert"
      intelligence_feed    = "alert"
    }
  }
}

Types of changes

Checklist

hi-artem commented 2 years ago

Confirmed that changes work as expected