SASE
A cloud-based framework integrating networking and security: provides SD-WAN, ZTNA, CASB, and SWG on a single platform
A cloud-based framework integrating networking and security: provides SD-WAN, ZTNA, CASB, and SWG on a single platform
SASE (Secure Access Service Edge, pronounced "sassy") is a concept defined by Gartner in 2019: a framework that integrates previously separate networking (WAN) and network security functions into a single cloud-based service. It emerged as the spread of remote work, growing use of cloud applications, and the ubiquity of mobile devices pushed traditional data-center-centric security architecture to its limits.
SASE's core components are broadly divided into network services and security services. On the network side, SD-WAN (Software-Defined WAN) provides multi-path optimization and application-aware routing. On the security side, ZTNA (Zero Trust Network Access) provides fine-grained access control per user and device, CASB (Cloud Access Security Broker) handles SaaS security, SWG (Secure Web Gateway) handles web traffic filtering, and FWaaS (Firewall as a Service) provides cloud firewall functions.
SASE's biggest advantage is that it can apply consistent security policies "anywhere, on any device." Whether the user is at headquarters, a branch office, at home, or in a cafe, they pass the same security inspection through the nearest SASE PoP (Point of Presence) and reach applications over an optimized path. This solves the backhaul traffic problem of the traditional VPN approach and greatly improves the user experience.
Major SASE vendors include Zscaler, Palo Alto Networks (Prisma Access), Cisco (Umbrella + Viptela), Cloudflare (Cloudflare One), and Netskope. When adopting SASE, you should comprehensively review compatibility with existing network equipment, legacy application support, data residency requirements, and vendor lock-in risk. A full SASE transition usually takes 2-3 years, and phased migration is recommended.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SASE Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Users/Devices SASE Cloud Platform β
β βββββββββββββ βββββββββββββββββββ β
β β
β [Remote Worker] βββββββ βββββββββββββββββββββββββββββββ β
β β β Network Services β β
β [Branch Office] βββββββΌβββββββββΊβ β’ SD-WAN β β
β β β β’ WAN Optimization β β
β [Mobile User] βββββββββΌββββββββββ β’ Global PoP Network β β
β β βββββββββββββββββββββββββββββββ β
β [IoT Device] ββββββββββ€ β β
β β βΌ β
β [HQ Office] βββββββββββ βββββββββββββββββββββββββββββββ β
β β Security Services (SSE) β β
β β β’ ZTNA (Zero Trust Access) β β
β β β’ SWG (Web Gateway) β β
β β β’ CASB (Cloud Security) β β
β β β’ FWaaS (Cloud Firewall) β β
β β β’ DLP (Data Loss Prevent) β β
β βββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββ β
β β Destinations β β
β β β’ SaaS (M365, Salesforce) β β
β β β’ IaaS (AWS, Azure, GCP) β β
β β β’ Private Apps (DC) β β
β β β’ Internet β β
β βββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# providers.tf
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
}
provider "cloudflare" {
api_token = var.cloudflare_api_token
}
# variables.tf
variable "cloudflare_api_token" {
type = string
sensitive = true
}
variable "cloudflare_account_id" {
type = string
}
variable "tunnel_secret" {
type = string
sensitive = true
}
# Zero Trust Access Application μ μ
resource "cloudflare_access_application" "internal_app" {
account_id = var.cloudflare_account_id
name = "Internal Dashboard"
domain = "dashboard.internal.example.com"
type = "self_hosted"
session_duration = "24h"
# νμ©λ IdP λͺ©λ‘
allowed_idps = [cloudflare_access_identity_provider.okta.id]
# μλ 리λ€μ΄λ νΈ λΉνμ±ν (API μ κ·Όμ©)
auto_redirect_to_identity = false
# CORS μ€μ
cors_headers {
allowed_methods = ["GET", "POST", "PUT", "DELETE"]
allowed_origins = ["https://dashboard.internal.example.com"]
allow_credentials = true
max_age = 600
}
}
# Access Policy - λκ° μ κ·Όν μ μλμ§ μ μ
resource "cloudflare_access_policy" "internal_app_policy" {
account_id = var.cloudflare_account_id
application_id = cloudflare_access_application.internal_app.id
name = "Allow Engineering Team"
precedence = 1
decision = "allow"
# 쑰건: νΉμ κ·Έλ£Ή + κΈ°κΈ° μν νμΈ
include {
group = [cloudflare_access_group.engineering.id]
}
require {
# λλ°μ΄μ€ ν¬μ€μ² νμΈ (νμ)
device_posture = [cloudflare_device_posture_rule.corporate_device.id]
}
}
# Access Group μ μ
resource "cloudflare_access_group" "engineering" {
account_id = var.cloudflare_account_id
name = "Engineering Team"
include {
email_domain = ["example.com"]
}
include {
okta {
name = "Engineering"
identity_provider_id = cloudflare_access_identity_provider.okta.id
}
}
}
# Device Posture Rule - κΈ°κΈ° 보μ μν νμΈ
resource "cloudflare_device_posture_rule" "corporate_device" {
account_id = var.cloudflare_account_id
name = "Corporate Device Check"
type = "file"
match {
platform = "mac"
}
input {
id = "corporate_cert"
path = "/Library/Security/corporate-root-ca.pem"
exists = true
sha256 = "abc123..." # μΈμ¦μ ν΄μ
}
}
# Cloudflare Tunnel (private network μ°κ²°)
resource "cloudflare_tunnel" "internal_network" {
account_id = var.cloudflare_account_id
name = "internal-network-tunnel"
secret = base64encode(var.tunnel_secret)
}
resource "cloudflare_tunnel_config" "internal_network_config" {
account_id = var.cloudflare_account_id
tunnel_id = cloudflare_tunnel.internal_network.id
config {
ingress_rule {
hostname = "dashboard.internal.example.com"
service = "http://10.0.1.100:8080"
origin_request {
connect_timeout = "30s"
no_tls_verify = false
}
}
ingress_rule {
hostname = "api.internal.example.com"
service = "http://10.0.1.200:3000"
}
# Catch-all rule (required)
ingress_rule {
service = "http_status:404"
}
}
}
# Gateway Policy - SWG μΉ νν°λ§
resource "cloudflare_teams_rule" "block_malware_sites" {
account_id = var.cloudflare_account_id
name = "Block Malware Sites"
description = "Block access to known malware domains"
precedence = 1
action = "block"
enabled = true
traffic = "any(dns.security_category[*] in {117 118 119 120})"
rule_settings {
block_page_enabled = true
block_page_reason = "This site has been blocked due to security risks."
}
}
# DLP Policy - λ―Όκ° λ°μ΄ν° μ μΆ λ°©μ§
resource "cloudflare_teams_rule" "dlp_credit_card" {
account_id = var.cloudflare_account_id
name = "Block Credit Card Data"
description = "Prevent credit card numbers from being uploaded"
precedence = 2
action = "block"
enabled = true
traffic = "http.request.body.mime == 'application/json' and any(http.request.body.json[*] matches '\\d{4}[- ]?\\d{4}[- ]?\\d{4}[- ]?\\d{4}')"
rule_settings {
block_page_enabled = true
block_page_reason = "Uploading credit card information is prohibited."
}
}
"""
SASE μ μ±
κ΄λ¦¬ λ° λͺ¨λν°λ§ μ€ν¬λ¦½νΈ
λ€μν SASE λ²€λ APIμ ν΅ν©νμ¬ μ€μ μ§μ€μ κ΄λ¦¬
"""
import requests
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Optional
import json
@dataclass
class AccessPolicy:
"""μ κ·Ό μ μ±
λ°μ΄ν° λͺ¨λΈ"""
name: str
users: list[str]
groups: list[str]
applications: list[str]
conditions: dict
action: str # allow, block, isolate
class SASEProvider(ABC):
"""SASE λ²€λ μΆμ ν΄λμ€"""
@abstractmethod
def create_access_policy(self, policy: AccessPolicy) -> dict:
pass
@abstractmethod
def list_users(self) -> list[dict]:
pass
@abstractmethod
def get_security_events(self, hours: int = 24) -> list[dict]:
pass
class ZscalerClient(SASEProvider):
"""Zscaler ZPA/ZIA API ν΄λΌμ΄μΈνΈ"""
def __init__(self, client_id: str, client_secret: str, cloud: str = "zscaler"):
self.base_url = f"https://config.{cloud}.net/api/v1"
self.client_id = client_id
self.client_secret = client_secret
self.token = None
def _authenticate(self):
"""API μΈμ¦"""
response = requests.post(
f"{self.base_url}/auth/login",
json={
"clientId": self.client_id,
"clientSecret": self.client_secret
}
)
response.raise_for_status()
self.token = response.json().get("token")
def _headers(self):
if not self.token:
self._authenticate()
return {
"Authorization": f"Bearer {self.token}",
"Content-Type": "application/json"
}
def create_access_policy(self, policy: AccessPolicy) -> dict:
"""ZPA μ κ·Ό μ μ±
μμ±"""
payload = {
"name": policy.name,
"rule_order": "1",
"action": policy.action.upper(),
"conditions": [
{
"operands": [
{"object_type": "APP", "values": policy.applications}
]
},
{
"operands": [
{"object_type": "SCIM_GROUP", "values": policy.groups}
]
}
]
}
response = requests.post(
f"{self.base_url}/policySet/rules",
headers=self._headers(),
json=payload
)
response.raise_for_status()
return response.json()
def list_users(self) -> list[dict]:
"""μ¬μ©μ λͺ©λ‘ μ‘°ν"""
response = requests.get(
f"{self.base_url}/users",
headers=self._headers()
)
response.raise_for_status()
return response.json().get("users", [])
def get_security_events(self, hours: int = 24) -> list[dict]:
"""보μ μ΄λ²€νΈ μ‘°ν (ZIA)"""
response = requests.get(
f"{self.base_url}/security/events",
headers=self._headers(),
params={"hours": hours}
)
response.raise_for_status()
return response.json().get("events", [])
class CloudflareZeroTrustClient(SASEProvider):
"""Cloudflare Zero Trust API ν΄λΌμ΄μΈνΈ"""
def __init__(self, api_token: str, account_id: str):
self.base_url = f"https://api.cloudflare.com/client/v4/accounts/{account_id}"
self.headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
def create_access_policy(self, policy: AccessPolicy) -> dict:
"""Access Policy μμ±"""
# λ¨Όμ Application νμΈ νμ
payload = {
"name": policy.name,
"decision": policy.action,
"include": [
{"group": {"id": g}} for g in policy.groups
],
"require": []
}
if policy.conditions.get("device_posture"):
payload["require"].append({
"device_posture": {"integration_uid": policy.conditions["device_posture"]}
})
response = requests.post(
f"{self.base_url}/access/apps/{policy.applications[0]}/policies",
headers=self.headers,
json=payload
)
response.raise_for_status()
return response.json().get("result", {})
def list_users(self) -> list[dict]:
"""Access μ¬μ©μ λͺ©λ‘"""
response = requests.get(
f"{self.base_url}/access/users",
headers=self.headers
)
response.raise_for_status()
return response.json().get("result", [])
def get_security_events(self, hours: int = 24) -> list[dict]:
"""Gateway λ‘κ·Έ μ‘°ν"""
response = requests.get(
f"{self.base_url}/gateway/audit_logs",
headers=self.headers,
params={"per_page": 1000}
)
response.raise_for_status()
return response.json().get("result", [])
def create_gateway_rule(self, name: str, traffic_filter: str, action: str):
"""Gateway μ μ±
μμ± (SWG/DNS νν°λ§)"""
payload = {
"name": name,
"enabled": True,
"action": action,
"traffic": traffic_filter,
"rule_settings": {
"block_page_enabled": True
}
}
response = requests.post(
f"{self.base_url}/gateway/rules",
headers=self.headers,
json=payload
)
response.raise_for_status()
return response.json().get("result", {})
class SASEPolicyManager:
"""λ©ν° λ²€λ SASE μ μ±
ν΅ν© κ΄λ¦¬"""
def __init__(self):
self.providers: dict[str, SASEProvider] = {}
def register_provider(self, name: str, provider: SASEProvider):
self.providers[name] = provider
def deploy_policy_to_all(self, policy: AccessPolicy):
"""λͺ¨λ SASE νλ«νΌμ λμΌ μ μ±
λ°°ν¬"""
results = {}
for name, provider in self.providers.items():
try:
result = provider.create_access_policy(policy)
results[name] = {"status": "success", "data": result}
except Exception as e:
results[name] = {"status": "error", "message": str(e)}
return results
def aggregate_security_events(self, hours: int = 24) -> list[dict]:
"""λͺ¨λ νλ«νΌμ 보μ μ΄λ²€νΈ ν΅ν©"""
all_events = []
for name, provider in self.providers.items():
events = provider.get_security_events(hours)
for event in events:
event["source_provider"] = name
all_events.extend(events)
return sorted(all_events, key=lambda x: x.get("timestamp", ""), reverse=True)
# μ¬μ© μμ
if __name__ == "__main__":
# λ§€λμ μ΄κΈ°ν
manager = SASEPolicyManager()
# Cloudflare λ±λ‘
cf_client = CloudflareZeroTrustClient(
api_token="your-api-token",
account_id="your-account-id"
)
manager.register_provider("cloudflare", cf_client)
# μ μ±
μ μ
engineering_access = AccessPolicy(
name="Engineering Internal Access",
users=["user1@example.com", "user2@example.com"],
groups=["engineering-team"],
applications=["internal-dashboard-app-id"],
conditions={
"device_posture": "corporate-device-rule-id",
"location": ["US", "KR"]
},
action="allow"
)
# μ μ±
λ°°ν¬
results = manager.deploy_policy_to_all(engineering_access)
print(json.dumps(results, indent=2))
# 보μ μ΄λ²€νΈ μ‘°ν
events = manager.aggregate_security_events(hours=24)
print(f"Total security events: {len(events)}")
Take a mock interview on this topic β WIA SOOM AI Interview Β· Start for free