Network Security: Advanced Patterns

Beyond NSGs โ€” Azure Firewall, DDoS Protection, WAF, and Network Watcher for defense-in-depth
๐Ÿ”ด Advanced โฑ 20 Minutes ๐Ÿ“˜ AZ-104 ยท Module 04
Why This Matters

NSGs and routing control which traffic is allowed, but they work at Layer 3 (network). Modern attacks happen at Layer 7 (application) โ€” SQL injection, DDoS, bot attacks. This doc covers the advanced tools that protect above NSGs: Azure Firewall (stateful inspection), DDoS Protection (volumetric attacks), Web Application Firewall (app-level threats), and Network Watcher (diagnostics).

Before You Start

PrerequisitesVNets & Subnets, Network Security Groups, Routing Fundamentals, Hub-Spoke Topology
Time to understand20 minutes
Difficulty๐Ÿ”ด Advanced (builds on all networking concepts)
What you'll learnStateful firewalls, application-level protection, DDoS mitigation, network diagnostics

The Simple Idea: Layers of Network Security

Earlier docs covered Layers 2-3 (NSGs, routing). This doc covers Layers 4-7 (advanced security).

  • Layer 7 (Application): WAF blocks SQL injection, XSS
  • Layer 4 (Transport): DDoS Protection blocks volumetric attacks
  • Layer 3 (Network): Azure Firewall allows/denies by IP/port/protocol
  • Layer 2 (Data Link): NSGs filter by subnet/NIC
Layer 7 (Application) โ† WAF blocks SQL injection, XSS โ†“ Layer 4 (Transport) โ† DDoS Protection blocks volumetric attacks โ†“ Layer 3 (Network) โ† Azure Firewall allows/denies by IP/port/protocol โ†“ Layer 2 (Data Link) โ† NSGs filter by subnet/NIC

When NSGs Aren't Enough

NSG Example

Rule: Allow port 443 from 0.0.0.0/0 โ”œโ”€ Result: Any traffic on port 443 is allowed โ”œโ”€ Includes: Legitimate HTTPS traffic โœ“ โ”œโ”€ Includes: DDoS attack on port 443 โœ— โ”œโ”€ Includes: SQL injection via HTTPS โœ— โ””โ”€ NSG can't see inside the traffic, only the port

Advanced Security Needed

Azure Firewall: โ”œโ”€ Can see the application data โ”œโ”€ Can block SQL injection patterns โœ“ โ”œโ”€ Can block malicious URLs โœ“ โ””โ”€ But adds latency (inspection takes time) DDoS Protection: โ”œโ”€ Detects flood attacks (millions of requests/sec) โ”œโ”€ Automatically rate-limits offenders โœ“ โ””โ”€ Protects infrastructure from being overwhelmed WAF (Web Application Firewall): โ”œโ”€ Sits in front of web apps โ”œโ”€ Blocks OWASP Top 10 attacks (XSS, SQLi, etc.) โ”œโ”€ Can identify legitimate traffic vs. malicious โ””โ”€ Works with Application Gateway or Front Door

Layer 4: DDoS Protection

What Is a DDoS Attack?

DDoS (Distributed Denial of Service) = Overwhelming a service with traffic so legitimate users can't reach it.

Real-World Analogy: Crowded Restaurant

Normal traffic: a customer goes through the waiter to the kitchen and gets food. A DDoS attack is like 1000 fake customers overwhelming the waiter so real customers can't be served. Protection is a bouncer at the door who questions suspicious groups, blocks obvious fakes, and lets real customers through.

Normal Traffic: Customer โ†’ Waiter โ†’ Kitchen โ†’ Food โœ“ DDoS Attack: 1000 fake customers โ†’ Waiter โ†’ Can't serve real customers โœ— Protection: โ”œโ”€ Bouncer at door: "These 1000 people look fake" โ”œโ”€ Asks questions: "Where are you from? Why here?" โ”œโ”€ Blocks obvious fakes โœ“ โ””โ”€ Real customers still get served โœ“

Azure DDoS Protection Tiers

TierCostDetectionMitigationBest For
BasicFreeAzure automatedAutomaticAll subscriptions (always on)
Standard~$3K/month24/7 monitoringAutomatic + manualMission-critical apps

DDoS Basic vs. DDoS Standard

DDoS Basic (Always On, Free)

Included with every Azure subscription: โ”œโ”€ Always monitoring incoming traffic โ”œโ”€ Auto-blocks obvious DDoS attacks (SYN floods, UDP floods) โ”œโ”€ No configuration needed โ”œโ”€ Works at network edge (before traffic reaches your VNet) Limitations: โ”œโ”€ Doesn't monitor application-level attacks โ”œโ”€ Limited visibility (you don't see metrics) โ””โ”€ No custom policies

DDoS Standard (Paid, Enterprise-Grade)

Enable on public IP or VNet: โ”œโ”€ 24/7 dedicated support team โ”œโ”€ Real-time attack analytics โ”œโ”€ Custom mitigation policies โ”œโ”€ Attack simulation (test your defenses) โ”œโ”€ Cost: ~$3000/month (expensive but justified for critical apps) Example Policy: โ”œโ”€ If traffic exceeds 100 Gbps โ†’ Rate-limit to 50 Gbps โ”œโ”€ If SYN flood detected โ†’ Block source IPs โ”œโ”€ If UDP flood detected โ†’ Drop UDP packets โ””โ”€ Legitimate traffic passes through โœ“

When to Use DDoS Standard

Use DDoS Standard if: โ”œโ”€ App is internet-facing (has public IP) โ”œโ”€ App is mission-critical (downtime = lost revenue) โ”œโ”€ Traffic patterns are predictable (can set thresholds) โ”œโ”€ Example: E-commerce site, financial API, public website Don't use if: โ”œโ”€ Internal-only app (not exposed to internet) โ”œโ”€ Testing/development environment โ”œโ”€ Traffic highly variable โ””โ”€ Example: Dev VMs, internal apps, test systems

Layer 3: Azure Firewall (Stateful Inspection)

Stateless vs. Stateful Firewalls

NSG (Stateless)

Rule: Allow port 443 โ”œโ”€ Sees: Source IP, Dest IP, Port, Protocol โ”œโ”€ Decision: Port 443? YES โ†’ Allow โ”œโ”€ Doesn't understand: Is this a legitimate HTTPS connection? โ””โ”€ Can't see: Application data, conversation context

Azure Firewall (Stateful)

Connection: Client โ†’ Server on port 443 โ”œโ”€ Sees: TLS handshake, certificate, domain โ”œโ”€ Understands: "This is HTTPS to example.com" โ”œโ”€ Knows: "Example.com is on the allowed list" โ”œโ”€ Allows: Traffic โœ“ โ”œโ”€ Understands: "This is a complete HTTPS connection" โ””โ”€ Can inspect: Application layer (if configured)

Azure Firewall Capabilities

Network Rules (Layer 4): โ”œโ”€ Allow/deny by IP, Port, Protocol โ”œโ”€ Similar to NSG, but stateful โ”œโ”€ Example: Allow 10.0.0.0/16 to reach 192.168.0.0/16 on port 443 โœ“ Application Rules (Layer 7): โ”œโ”€ Allow/deny by domain name (not just IP) โ”œโ”€ Understands FQDN (fully qualified domain name) โ”œโ”€ Example: Allow outbound to *.microsoft.com (any Microsoft domain) โ”œโ”€ Example: Block *.twitter.com (block all Twitter domains) โ””โ”€ Much more flexible than IP-based filtering โœ“ NAT Rules (Network Address Translation): โ”œโ”€ Redirect inbound traffic โ”œโ”€ Example: Public IP:443 โ†’ Internal VM:8443 โ”œโ”€ Allows internal VMs to receive internet traffic โ””โ”€ Hides internal IPs from internet

Azure Firewall Architecture

Azure Firewall lives in the Hub VNet's AzureFirewallSubnet with its own public IP. The hub routes all internet and on-prem traffic through the firewall, and spoke VNets route their outbound traffic to the hub firewall too โ€” eliminating the need for a firewall per spoke.

Hub VNet (with Firewall) โ”œโ”€โ”€ AzureFirewallSubnet (10.0.2.0/24) โ”‚ โ””โ”€ Azure Firewall instance โ”‚ โ””โ”€ Assigned public IP โ”‚ โ”œโ”€โ”€ Routes to Firewall: โ”‚ โ””โ”€ 0.0.0.0/0 (internet) โ†’ Firewall โ”‚ โ””โ”€ 192.168.0.0/16 (on-prem) โ†’ Firewall โ”‚ โ””โ”€ All internet/on-prem traffic passes through firewall โœ“ Spoke VNet: โ”œโ”€โ”€ Route: 0.0.0.0/0 โ†’ Hub Firewall (10.0.2.4) โ”œโ”€โ”€ Route: 192.168.0.0/16 โ†’ Hub Firewall โ”œโ”€โ”€ Outbound traffic: Automatically inspected โœ“ โ””โ”€ No need for firewall per spoke (cost-effective) โœ“

Firewall Rule Evaluation Order

Traffic arrives at Firewall: โ†“ Check NAT Rules (highest priority) โ””โ”€ If match โ†’ Translate and continue โ†“ Check Network Rules โ””โ”€ If match (allow) โ†’ Forward โœ“ โ””โ”€ If match (deny) โ†’ Drop โœ— โ†“ Check Application Rules โ””โ”€ If match (allow) โ†’ Forward โœ“ โ””โ”€ If match (deny) โ†’ Drop โœ— โ†“ Default: Deny (implicit deny)

Layer 7: Web Application Firewall (WAF)

What Is a WAF?

WAF = Protects web applications from Layer 7 attacks (not network attacks, but web app attacks).

Attacks WAF Protects Against

SQL Injection

Attacker sends: ' OR '1'='1 WAF detects: SQL injection pattern WAF blocks: Request โœ“

Cross-Site Scripting (XSS)

Attacker sends: <script>alert('hacked')</script> WAF detects: JavaScript in form field WAF blocks: Request โœ“

Cross-Site Request Forgery (CSRF)

Attacker sends: Malicious form from external site WAF detects: Request from unexpected origin WAF blocks: Request โœ“

Path Traversal

Attacker sends: ../../../etc/passwd WAF detects: Directory traversal pattern WAF blocks: Request โœ“

WAF Deployment Models

Azure WAF can attach to:

ServiceHowCost
Application GatewaySits in front of web serversCharged for gateway + WAF rules
Azure Front DoorGlobal load balancer + WAFHigher cost, global coverage
CDN (Content Delivery)Via Azure CDN + WAF rulesCheaper, good for static content

WAF Rule Sets (OWASP)

Azure WAF comes with default rule sets covering standard protection (OWASP 3.0: SQL Injection, XSS, Remote Code Execution rules, etc.), plus custom rules you create yourself โ€” such as blocking IPs by geography or behavior pattern, requiring specific headers, or rate-limiting by source IP.

Azure WAF comes with default rule sets: โ”œโ”€โ”€ OWASP 3.0 (standard protection) โ”‚ โ”œโ”€ SQL Injection rules โ”‚ โ”œโ”€ XSS rules โ”‚ โ”œโ”€ Remote Code Execution rules โ”‚ โ””โ”€ etc. โ”‚ โ””โ”€โ”€ Custom Rules (create your own) โ”œโ”€ Block IPs by geography โ”œโ”€ Block IPs by behavior pattern โ”œโ”€ Require specific headers โ””โ”€ Rate-limit by source IP

WAF Example: E-Commerce Site

Architecture: Internet โ†’ Azure Front Door (global) โ†’ WAF (block attacks) โ†’ Application Gateway โ†’ Web servers โ†’ SQL DB Traffic Flow: 1. Attacker sends: SELECT * FROM users; DROP TABLE users; 2. Front Door receives (near attacker's region) 3. WAF rule: SQL Injection pattern detected 4. WAF blocks: Request rejected, attacker gets 403 Forbidden 5. Legitimate customer: Normal shopping request 6. WAF rule: No attack patterns 7. WAF allows: Request passes through to App Gateway 8. App Gateway: Load balances to web servers 9. Web servers: Process legitimate request 10. Result: Site protected from attacks โœ“

Layer 2: Network Watcher (Diagnostics)

What Is Network Watcher?

Network Watcher = Diagnostic tools to monitor, diagnose, and visualize network issues.

Network Watcher Tools

IP Flow Verify

Question: "Can this VM reach that VM?" Input: Source IP, Dest IP, Port, Protocol Output: "YES (allowed by NSG)" or "NO (blocked by NSG)" Use: Debug connectivity issues โœ“ Example: Is the database reachable on port 1433?

Connection Troubleshoot

Question: "Why can't I reach that endpoint?" Input: Source VM, Destination IP/host Output: Detailed hops and where connection fails Use: Diagnose routing and firewall issues โœ“ Example: Find where connection breaks (routing loop? firewall?)

NSG Flow Logs

Records: All traffic allowed/denied by NSG Captures: Source, Dest, Port, Protocol, Allow/Deny Use: Compliance, security audits, understanding traffic โœ“ Storage: Log Analytics, Storage Account, Event Hub Example: "Which IPs are trying to attack my database?"

Packet Capture

Records: Actual packet data (headers and payload) Use: Deep troubleshooting, malware analysis Warning: Can capture sensitive data (passwords, keys) Example: "What data is being sent on this connection?"

Connection Monitor

Monitors: Connectivity from VM to destination Tracks: Latency, packet loss, hop information Use: Continuous health monitoring โœ“ Example: "Is my connection to the database stable?"

NSG Flow Logs Example

Flow Log Entry: { "time": "2024-06-14T10:30:45Z", "systemId": "nic-abc123", "category": "NetworkSecurityGroupFlowEvent", "resourceId": "/subscriptions/.../subnets/web", "operationName": "NetworkSecurityGroupFlowEvents", "properties": { "Version": 2, "flows": [ { "rule": "AllowHTTPSInternet", "flows": [ { "mac": "00:0D:3A:12:34:56", "flowTuples": [ "1623667845,40.88.45.120,10.0.1.5,443,52413,T,O,A,B,," โ†‘ โ†‘ โ†‘ โ†‘ โ†‘ โ†‘ โ†‘ โ†‘ time src-IP dst-IP port port T O A (internet) (vm) C (TCP) (Out)(Allow) ] } ] } ] } } Interpretation: โ”œโ”€ 40.88.45.120 (Internet IP) sent traffic โ”œโ”€ To 10.0.1.5 (Your VM) on port 443 โ”œโ”€ From port 52413 (ephemeral) โ”œโ”€ Protocol: TCP โ”œโ”€ Direction: Outbound (from your perspective) โ”œโ”€ Action: Allowed โ””โ”€ Used by: NSG rule "AllowHTTPSInternet"

Worked Example: Real Scenario

The Scenario

E-Commerce Site (TechCorp):

  • Public website: example.com (handles customer traffic)
  • Backend databases: Sensitive customer data
  • Global users: Need fast access from anywhere
  • Under attack: Getting DDoS attacks (competitors?)

Security Architecture

Internet (users + attackers) โ†“ Azure DDoS Standard (Layer 4) โ”œโ”€ Rate-limits volumetric attacks โ””โ”€ Cost: ~$3000/month but necessary for e-commerce โ†“ Azure Front Door (global) โ”œโ”€ Distributes traffic across regions โ”œโ”€ Caches static content โ””โ”€ Reduces load on backend โ†“ WAF Rules (Layer 7) โ”œโ”€ OWASP rules: Block SQL injection, XSS, CSRF โ”œโ”€ Custom rules: Block suspicious IPs, geo-blocking โ””โ”€ Action: Deny malicious requests โ†“ Azure Firewall (Layer 3-4) โ”œโ”€ Network rules: Allow only known sources โ”œโ”€ Application rules: Allow only example.com domain traffic โ””โ”€ Action: Inspect and allow legitimate traffic โ†“ Application Gateway (Layer 7) โ”œโ”€ Web application firewall (additional layer) โ”œโ”€ SSL/TLS termination โ”œโ”€ Load balancing โ””โ”€ Action: Distribute to backend pools โ†“ Backend Servers (VMs) โ”œโ”€ NSG: Allow only from Application Gateway โ”œโ”€ NSG: Block all unknown sources โ””โ”€ Protected by multiple layers โœ“

Attack Scenarios

Scenario 1: Volumetric DDoS

Attack: 100 Gbps traffic from 50K compromised IoT devices Protection Flow: 1. DDoS Standard detects: Traffic exceeds normal pattern 2. DDoS Standard rate-limits: Drops excess packets 3. Legitimate users: Still able to access โœ“ 4. Attacker: Can't overwhelm the service 5. Result: Service stays online โœ“ Cost: Justifies the $3000/month DDoS Standard subscription

Scenario 2: SQL Injection

Attack: Attacker sends: GET /product?id=1' OR '1'='1-- Protection Flow: 1. Request hits Azure Front Door (Layer 4) 2. Front Door forwards to WAF 3. WAF checks: OWASP SQL Injection rule 4. WAF detects: SQL injection pattern 5. WAF blocks: 403 Forbidden 6. Attacker gets: Error page (not access to data) 7. Backend: Never sees the malicious request โœ“ 8. Result: Database protected โœ“

Scenario 3: DDoS + Application Attack

Attack: 10 Gbps flood of requests from 1000 IPs + SQL injection payloads Protection Layers: Layer 4 (DDoS): Rate-limits volumetric flood โœ“ Layer 7 (WAF): Blocks SQL injection payloads โœ“ Layer 3 (Azure Firewall): Network rules as fallback โœ“ Layer 2 (NSG): Final protection at subnet level โœ“ Result: โ”œโ”€ DDoS attack: Mitigated by rate-limiting โ”œโ”€ SQL injection: Blocked by WAF โ”œโ”€ Legitimate traffic: Passes through all layers โ””โ”€ Site remains available and secure โœ“

Monitoring Attack Flow with Network Watcher

Use Network Watcher: 1. NSG Flow Logs enabled: โ”œโ”€ Captures all traffic (allowed + denied) โ”œโ”€ Shows which IPs are attacking โ””โ”€ Stored in Log Analytics for analysis 2. Query Attack Pattern: โ””โ”€ KQL: NSGFlowLogCommonFields | where FlowStatus == "Deny" | summarize DeniedCount = count() by SourcePublicIP | sort by DeniedCount desc 3. Result: โ”œโ”€ Top attacking IPs identified โ”œโ”€ Patterns visible (which ports, protocols) โ””โ”€ Can create firewall rules to pre-block โœ“ 4. Connection Monitor: โ”œโ”€ Monitors legitimate user access โ”œโ”€ Tracks latency (is site fast enough?) โ”œโ”€ Alerts on degradation โ””โ”€ Ensures customer experience โœ“

Common Mistakes (What NOT to Do)

โŒ Mistake 1: Thinking Firewall Replaces NSGs

Wrong

"We have Azure Firewall, we don't need NSGs" โ”œโ”€ Remove NSG rules โ”œโ”€ Rely only on Firewall โ”œโ”€ Problem: NSGs are still needed at subnet level โ”œโ”€ Result: Defense-in-depth is gone โœ—

Fix

Use both: โ”œโ”€ NSG: Blocks at subnet level (quick, lightweight) โ”œโ”€ Firewall: Inspects at hub level (stateful, deep inspection) โ”œโ”€ Result: Multiple layers of defense โœ“

Why it fails: Firewall and NSGs serve different purposes (stateful inspection vs. subnet isolation).

โŒ Mistake 2: Not Enabling NSG Flow Logs

Wrong

"NSG Flow Logs are expensive, let's skip them" โ”œโ”€ No visibility into denied traffic โ”œโ”€ Can't debug connectivity issues โ”œโ”€ Can't investigate security incidents โ”œโ”€ Result: Blind to attacks โœ—

Fix

Enable NSG Flow Logs: โ”œโ”€ Store in Log Analytics (cheap, queryable) โ”œโ”€ Set retention to 90 days minimum โ”œโ”€ Query for: โ”‚ โ”œโ”€ Denied traffic patterns โ”‚ โ”œโ”€ Unusual port access โ”‚ โ””โ”€ Potential attacks โ””โ”€ Cost: ~$10/month (cheap insurance) โœ“

Why it fails: Flow logs are the audit trail for network security.

โŒ Mistake 3: WAF Too Strict

Wrong

WAF Rule: Block all requests with special characters โ”œโ”€ Legitimate request: "What's the price?" โ”œโ”€ Contains apostrophe (special character) โ”œโ”€ WAF blocks: Legitimate user can't search โ”œโ”€ Result: False positives, broken site โœ—

Fix

WAF Tuning: โ”œโ”€ Start with default OWASP rules โ”œโ”€ Monitor for false positives โ”œโ”€ Exclude specific paths (e.g., file uploads) โ”œโ”€ Adjust sensitivity: "Detection" vs. "Prevention" mode โ”œโ”€ Result: Security without breaking functionality โœ“

Why it fails: Over-blocking legitimate traffic hurts user experience.

โŒ Mistake 4: DDoS Protection Only, Ignoring Application Attacks

Wrong

"We have DDoS Standard, we're protected" โ”œโ”€ DDoS protects Layer 4 (volumetric) โ”œโ”€ Doesn't protect Layer 7 (SQL injection, XSS) โ”œโ”€ Attacker uses targeted SQL injection โ”œโ”€ Database hacked โ”œโ”€ Result: False sense of security โœ—

Fix

Use layered defense: โ”œโ”€ DDoS Standard: Handles volumetric attacks โ”œโ”€ WAF: Handles application-level attacks โ”œโ”€ Azure Firewall: Network-level inspection โ”œโ”€ NSGs: Subnet-level filtering โ””โ”€ Result: Protected at all layers โœ“

Why it fails: DDoS and WAF protect different layers.

Advanced Security Checklist

DDoS Protection

โ–ก DDoS Basic: Always enabled (free) โ–ก DDoS Standard: Enable for public-facing apps โ””โ”€ Cost-benefit: $3000/month vs. downtime cost โ–ก DDoS alerts: Configure to notify SOC

Azure Firewall

โ–ก Deployed in Hub VNet โ–ก Application rules: Define allowed domains โ–ก Network rules: Define allowed IPs/ports โ–ก Routes: All spoke traffic through firewall โ–ก Logging: Enable firewall logs โ–ก Tuning: Monitor allowed vs. denied traffic

WAF (Application Gateway or Front Door)

โ–ก OWASP rules enabled โ–ก Mode: Detection (first), then Prevention (after tuning) โ–ก Custom rules: Add for your app-specific threats โ–ก Exclusions: Configure for file uploads, legitimate patterns โ–ก Logging: Send to Log Analytics for analysis

Network Watcher

โ–ก NSG Flow Logs: Enabled on all NSGs โ–ก Storage: Log Analytics (for querying) โ–ก Retention: 90 days minimum โ–ก Alerts: Set for unusual patterns โ–ก Connection Monitor: Monitor critical connections โ–ก IP Flow Verify: Used for troubleshooting

Incident Response

โ–ก Process: What to do when NSG Flow Logs show attack โ–ก Ownership: Who investigates security incidents? โ–ก Playbook: Steps to block, isolate, remediate โ–ก Communication: How to notify customers/stakeholders

How This Connects to Other Topics

Related to Module 01 (Identity & Governance)

  • RBAC: Only network admins can modify firewall rules
  • Policy: Enforce firewall + WAF for all public-facing apps

Related to Module 02 (Storage)

  • Storage Firewall: Combined with WAF for secure access

Related to Module 05 (Monitor)

  • Log Analytics: Analyze NSG Flow Logs and Firewall logs
  • Alerts: Trigger on suspicious patterns

See It In Action

Associated labs:

Suggested learning sequence:

  1. โœ… Read Hub-Spoke Topology
  2. โœ… Read this doc (Network Security Advanced)
  3. โžก๏ธ Hands-on: Set up Azure Firewall in hub
  4. โžก๏ธ Hands-on: Enable NSG Flow Logs
  5. โžก๏ธ Hands-on: Deploy WAF on Application Gateway

Key Takeaways

๐Ÿ’ก Summary
  • Defense-in-depth: Use multiple security layers (DDoS, Firewall, WAF, NSG)
  • DDoS Standard: Essential for internet-facing critical apps (~$3K/month)
  • Azure Firewall: Stateful inspection, application rules, centralized policy
  • WAF: Protects against Layer 7 attacks (SQL injection, XSS, CSRF)
  • NSG Flow Logs: Visibility into allowed/denied traffic (essential for auditing)
  • Network Watcher: Diagnostic tools for troubleshooting and monitoring
  • Layered approach: Each layer catches different attack types
  • Tuning required: Monitor for false positives, adjust rules as needed

Next Steps

  1. Learn: Read this doc (you're here)
  2. Understand: Which advanced security tools apply to your workloads
  3. Implement: Deploy in order: DDoS โ†’ Firewall โ†’ WAF
  4. Monitor: Enable NSG Flow Logs and set up alerts
  5. Practice: Use Network Watcher to diagnose connectivity
  6. Secure: Test security with network watcher and flow logs