Skip to content

AirForceFive/Hardening-NSGs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Hardening Network Security Groups (NSGs) in Azure

Introduction

Azure Network Security Groups (NSGs) provide a layer of security that acts as a virtual firewall for controlling inbound and outbound traffic to network interfaces (NICs), VMs, and subnets. In this project, we will walk through steps to harden NSGs and enhance the security of our Azure resources.

Initial NSG Configuration

Our initial NSG has the following rules set up:

  • Allow all inbound traffic from any source.
  • Allow all outbound traffic to any destination.

This is a vulnerable setup since it exposes our Azure resources to potential threats.

Hardening Steps

1. Deny All Inbound and Outbound Traffic by Default

  • Set the default inbound and outbound rules to Deny.
  • This ensures that only traffic we explicitly allow can reach our resources.

2. Allow Necessary Traffic Only

  • Permit inbound traffic only from trusted IP addresses or IP ranges.
  • Allow only required outbound traffic based on the specific needs of your application.

3. Avoid Opening Common Vulnerable Ports

  • Avoid opening ports such as 22 (SSH), 3389 (RDP), and 1433 (SQL) to the entire internet.
  • If these ports need to be opened, restrict them to specific IPs.

4. Use Application Security Groups (ASGs)

  • ASGs allow you to group VMs with similar roles and define NSG rules based on those roles.
  • This provides a more granular control over traffic between application layers.

5. Regularly Review and Audit NSG Rules

  • Periodically review the NSG rules to ensure no unnecessary ports are open.
  • Monitor the traffic logs to detect and respond to any suspicious activity.

NSG Configuration After Hardening

  • Default inbound and outbound rules are set to Deny.
  • Inbound traffic is allowed only from a list of trusted IP addresses.
  • Outbound traffic to the internet is restricted, but traffic within the VNet is allowed.
  • Common vulnerable ports are restricted to known IPs.

Benefits of Hardening NSGs

  1. Reduced Attack Surface: By limiting the traffic to what's necessary, the potential attack vectors are minimized.
  2. Enhanced Data Protection: With strict outbound rules, the risk of data exfiltration is reduced.
  3. Granular Control: With the use of ASGs, we can have fine-grained control over the traffic between different application layers.

Conclusion

NSGs are a fundamental component of Azure network security. A properly hardened NSG ensures that Azure resources are protected from unauthorized access and potential threats. Regular monitoring and auditing of NSG rules are essential to maintain a robust security posture.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published