Skip to content

bad NSG - #5

Open
tjcorr wants to merge 5 commits into
mainfrom
badnsg
Open

bad NSG#5
tjcorr wants to merge 5 commits into
mainfrom
badnsg

Conversation

@tjcorr

@tjcorr tjcorr commented Oct 27, 2022

Copy link
Copy Markdown
Owner

No description provided.

@github-actions

Copy link
Copy Markdown

Terraform Plan Output

Click to expand
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_network_security_group.nsg-fail will be created
  + resource "azurerm_network_security_group" "nsg-fail" {
      + id                  = (known after apply)
      + location            = "eastus"
      + name                = "insecureNSG"
      + resource_group_name = "rg-terraform-github-actions"
      + security_rule       = [
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "*"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "badrule"
              + priority                                   = 100
              + protocol                                   = "*"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.

@github-actions

Copy link
Copy Markdown

Terraform Plan Output

Click to expand
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_network_security_group.nsg-fail will be created
  + resource "azurerm_network_security_group" "nsg-fail" {
      + id                  = (known after apply)
      + location            = "eastus"
      + name                = "insecureNSG"
      + resource_group_name = "rg-terraform-github-actions"
      + security_rule       = [
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "*"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "badrule"
              + priority                                   = 100
              + protocol                                   = "*"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.

@github-actions

Copy link
Copy Markdown

Terraform Plan Output

Click to expand
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_network_security_group.nsg-fail will be created
  + resource "azurerm_network_security_group" "nsg-fail" {
      + id                  = (known after apply)
      + location            = "eastus"
      + name                = "insecureNSG"
      + resource_group_name = "rg-terraform-github-actions"
      + security_rule       = [
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "*"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "badrule"
              + priority                                   = 100
              + protocol                                   = "*"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.

@github-actions

Copy link
Copy Markdown

Terraform Plan Output

Click to expand
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_network_security_group.nsg-fail will be created
  + resource "azurerm_network_security_group" "nsg-fail" {
      + id                  = (known after apply)
      + location            = "eastus"
      + name                = "insecureNSG"
      + resource_group_name = "rg-terraform-github-actions"
      + security_rule       = [
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "*"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "badrule"
              + priority                                   = 100
              + protocol                                   = "*"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.

@github-actions

Copy link
Copy Markdown

Terraform Plan Output

Click to expand
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_network_security_group.nsg-fail will be created
  + resource "azurerm_network_security_group" "nsg-fail" {
      + id                  = (known after apply)
      + location            = "eastus"
      + name                = "insecureNSG"
      + resource_group_name = "rg-terraform-github-actions"
      + security_rule       = [
          + {
              + access                                     = "Allow"
              + description                                = ""
              + destination_address_prefix                 = "*"
              + destination_address_prefixes               = []
              + destination_application_security_group_ids = []
              + destination_port_range                     = "*"
              + destination_port_ranges                    = []
              + direction                                  = "Inbound"
              + name                                       = "badrule"
              + priority                                   = 100
              + protocol                                   = "*"
              + source_address_prefix                      = "*"
              + source_address_prefixes                    = []
              + source_application_security_group_ids      = []
              + source_port_range                          = "*"
              + source_port_ranges                         = []
            },
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Comment thread main.tf
Comment on lines +31 to +47
resource "azurerm_network_security_group" "nsg-fail" {
name = "insecureNSG"
location = azurerm_resource_group.rg-aks.location
resource_group_name = azurerm_resource_group.rg-aks.name

security_rule {
name = "badrule"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "*"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

Check failure

Code scanning / checkov

Ensure that SSH access is restricted from the internet

Ensure that SSH access is restricted from the internet
Comment thread main.tf
Comment on lines +31 to +47
resource "azurerm_network_security_group" "nsg-fail" {
name = "insecureNSG"
location = azurerm_resource_group.rg-aks.location
resource_group_name = azurerm_resource_group.rg-aks.name

security_rule {
name = "badrule"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "*"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

Check failure

Code scanning / checkov

Ensure that RDP access is restricted from the internet

Ensure that RDP access is restricted from the internet
Comment thread main.tf
Comment on lines +31 to +47
resource "azurerm_network_security_group" "nsg-fail" {
name = "insecureNSG"
location = azurerm_resource_group.rg-aks.location
resource_group_name = azurerm_resource_group.rg-aks.name

security_rule {
name = "badrule"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "*"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}

Check failure

Code scanning / checkov

Ensure that HTTP (port 80) access is restricted from the internet

Ensure that HTTP (port 80) access is restricted from the internet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants