mcpField
I
implementing-network-access-control

implementing-network-access-control

github.com/mukul975セキュリティ35.2k173 回インストール8 週間前に更新
リポジトリ

implementing-network-access-control について

ネットワークおよびセキュリティエンジニア向けのネットワークアクセス制御導入ガイドです。802.1X、RADIUS、動的 VLAN 割り当て、端末の状態確認、導入検証と重要インフラ向けのフォールバックを扱います。

主な機能

  1. 01FreeRADIUS 認証の設定
  2. 02ID に基づく動的 VLAN 割り当て
  3. 03スイッチへの 802.1X 導入
  4. 04PacketFence による端末状態確認
  5. 05端末サプリカントの設定
  6. 06NAC とフォールバック動作の検証

活用シーン

  1. 01ユーザーや端末の ID によるアクセス制御
  2. 02非準拠端末の制限ネットワークへの隔離
  3. 03BYOD 端末への限定アクセス提供
  4. 04病院ネットワークでの NAC 導入と検証

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill implementing-network-access-control

インストール後、Claude Code で/implementing-network-access-controlを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
references/
api-reference.md
scripts/
agent.py

詳細

ネットワークアクセス制御の実装

使用する場面

  • 認証済みで準拠しているデバイスのみがネットワークに接続できる、ID ベースのネットワークアクセスを適用する場合
  • ユーザーの役割に応じた動的な VLAN 割り当てにより、アクセスレイヤーでゼロトラストネットワークを実装する場合
  • エンドポイントのポスチャチェックに失敗した(パッチが不足している、ウイルス対策が無効になっている)非準拠デバイスを隔離する場合
  • ネットワークアクセス制御に関するコンプライアンス要件(PCI-DSS、HIPAA、SOC 2)を満たす場合
  • 自動プロビジョニングと制限付きネットワークアクセスを利用して BYOD デバイスを登録する場合

補完的な制御なしに単独のセキュリティソリューションとして使用する場合、802.1X サプリカントをサポートしないデバイスがあるネットワークで使用する場合、または重要インフラ向けの適切なフォールバック機構がない場合は、使用しないでください。

前提条件

  • ユーザー/デバイス認証を設定した RADIUS サーバー(FreeRADIUS、Microsoft NPS、または Cisco ISE)
  • 802.1X ポートベース認証をサポートする管理対象スイッチ
  • EAP-TLS 証明書の配布に使用する認証局(任意ですが、推奨)
  • ポスチャ評価と修復のための PacketFence または同等の NAC プラットフォーム
  • ユーザー認証を一元管理するための Active Directory または LDAP ディレクトリ
  • VLAN ごとの動的 IP 割り当てに対応する DHCP サーバー連携

ワークフロー

ステップ 1:FreeRADIUS をインストールして設定する
# Install FreeRADIUS
sudo apt install -y freeradius freeradius-utils freeradius-ldap

# Configure RADIUS clients (switches that authenticate against RADIUS)
sudo tee /etc/freeradius/3.0/clients.conf << 'EOF'
client switch-core-01 {
    ipaddr = 10.10.100.1
    secret = R4d1u5_S3cr3t_K3y!
    shortname = core-switch
    nastype = cisco
}

client switch-access-01 {
    ipaddr = 10.10.100.10
    secret = R4d1u5_S3cr3t_K3y!
    shortname = access-switch-01
    nastype = cisco
}

client switch-access-02 {
    ipaddr = 10.10.100.11
    secret = R4d1u5_S3cr3t_K3y!
    shortname = access-switch-02
    nastype = cisco
}
EOF

# Configure LDAP module for Active Directory integration
sudo tee /etc/freeradius/3.0/mods-available/ldap << 'EOF'
ldap {
    server = 'ldap://dc01.corp.example.com'
    identity = 'CN=radius-svc,OU=Service Accounts,DC=corp,DC=example,DC=com'
    password = 'ServiceAccountPassword123!'
    base_dn = 'DC=corp,DC=example,DC=com'

    user {
        base_dn = "${..base_dn}"
        filter = "(sAMAccountName=%{%{Stripped-User-Name}:-%{User-Name}})"
    }

    group {
        base_dn = "${..base_dn}"
        filter = "(objectClass=group)"
        membership_attribute = 'memberOf'
    }
}
EOF

sudo ln -s /etc/freeradius/3.0/mods-available/ldap /etc/freeradius/3.0/mods-enabled/ldap
ステップ 2:VLAN 割り当てポリシーを設定する
# Configure authorization policies for dynamic VLAN assignment
sudo tee /etc/freeradius/3.0/policy.d/vlan-assignment << 'EOF'
# VLAN assignment based on group membership
vlan_assignment {
    if (&LDAP-Group[*] == "CN=IT-Staff,OU=Groups,DC=corp,DC=example,DC=com") {
        update reply {
            Tunnel-Type = VLAN
            Tunnel-Medium-Type = IEEE-802
            Tunnel-Private-Group-ID = "10"
        }
    }
    elsif (&LDAP-Group[*] == "CN=Developers,OU=Groups,DC=corp,DC=example,DC=com") {
        update reply {
            Tunnel-Type = VLAN
            Tunnel-Medium-Type = IEEE-802
            Tunnel-Private-Group-ID = "15"
        }
    }
    elsif (&LDAP-Group[*] == "CN=Finance,OU=Groups,DC=corp,DC=example,DC=com") {
        update reply {
            Tunnel-Type = VLAN
            Tunnel-Medium-Type = IEEE-802
            Tunnel-Private-Group-ID = "20"
        }
    }
    else {
        # Default: Guest VLAN for unknown users
        update reply {
            Tunnel-Type = VLAN
            Tunnel-Medium-Type = IEEE-802
            Tunnel-Private-Group-ID = "40"
        }
    }
}
EOF

# Add vlan_assignment to the authorize section
# Edit /etc/freeradius/3.0/sites-enabled/default
# In the authorize section, add: vlan_assignment

# Configure EAP for 802.1X authentication
sudo tee /etc/freeradius/3.0/mods-available/eap << 'EAPEOF'
eap {
    default_eap_type = peap
    timer_expire = 60
    max_sessions = 4096

    tls-config tls-common {
        private_key_file = /etc/freeradius/3.0/certs/server.key
        certificate_file = /etc/freeradius/3.0/certs/server.pem
        ca_file = /etc/freeradius/3.0/certs/ca.pem
        dh_file = /etc/freeradius/3.0/certs/dh
        cipher_list = "HIGH:!aNULL:!MD5"
        tls_min_version = "1.2"
    }

    peap {
        tls = tls-common
        default_eap_type = mschapv2
        virtual_server = inner-tunnel
    }

    tls {
        tls = tls-common
    }
}
EAPEOF

# Start FreeRADIUS in debug mode for testing
sudo freeradius -X

# Test authentication
radtest testuser TestPassword123 localhost 0 testing123
ステップ 3:Cisco スイッチで 802.1X を設定する
! Enable AAA on the switch
enable
configure terminal

aaa new-model
aaa authentication dot1x default group radius
aaa authorization network default group radius
aaa accounting dot1x default start-stop group radius

! Configure RADIUS server
radius server FREERADIUS
  address ipv4 10.10.100.200 auth-port 1812 acct-port 1813
  key R4d1u5_S3cr3t_K3y!
  exit

! Enable 802.1X globally
dot1x system-auth-control

! Configure access ports for 802.1X
interface range GigabitEthernet1/0/1-24
  switchport mode access
  switchport access vlan 999
  authentication port-control auto
  authentication order dot1x mab
  authentication priority dot1x mab
  dot1x pae authenticator
  dot1x timeout tx-period 10
  mab
  authentication event fail action authorize vlan 999
  authentication event no-response action authorize vlan 40
  authentication host-mode multi-auth
  spanning-tree portfast
  exit

! Configure MAB (MAC Authentication Bypass) for devices without 802.1X
! Devices like printers, IP phones that cannot run a supplicant
interface range GigabitEthernet1/0/25-36
  switchport mode access
  switchport access vlan 999
  authentication port-control auto
  authentication order mab
  mab
  authentication event fail action authorize vlan 999
  authentication host-mode single-host
  spanning-tree portfast
  exit

! Configure guest VLAN for unauthenticated devices
interface range GigabitEthernet1/0/1-24
  authentication event no-response action authorize vlan 40
  authentication event fail action authorize vlan 999
  exit

! Configure critical VLAN for RADIUS server unavailability
interface range GigabitEthernet1/0/1-36
  authentication event server dead action authorize vlan 10
  authentication event server alive action reinitialize
  exit
ステップ 4:ポスチャ評価用に PacketFence NAC を導入する
# Install PacketFence
curl -fsSL https://inverse.ca/downloads/GPG_PUBLIC_KEY | sudo gpg --dearmor -o /etc/apt/keyrings/inverse.gpg
echo "deb [signed-by=/etc/apt/keyrings/inverse.gpg] https://inverse.ca/downloads/PacketFence/debian bookworm bookworm" | \
  sudo tee /etc/apt/sources.list.d/packetfence.list
sudo apt update && sudo apt install -y packetfence

# Run the PacketFence configurator
sudo /usr/local/pf/bin/pfcmd configreload

# Access web admin: https://<packetfence-ip>:1443

# Configure PacketFence connection profiles
# Admin UI: Configuration > Policies and Access Control > Connection Profiles

# Create compliance check (Windows Update status)
# Admin UI: Configuration > Compliance > Scan Engines
# Add: Windows Update compliance check
# Remediation VLAN: 999 (quarantine)

# Configure RADIUS integration
# PacketFence acts as a RADIUS proxy, receiving requests from switches
# and enforcing posture-based VLAN assignment

# Edit /usr/local/pf/conf/switches.conf
sudo tee -a /usr/local/pf/conf/switches.conf << 'EOF'
[10.10.100.10]
description=Access Switch 01
type=Cisco::Catalyst_2960
mode=production
radiusSecret=R4d1u5_S3cr3t_K3y!
SNMPVersion=2c
SNMPCommunityRead=public
SNMPCommunityWrite=private
VlanMap=Y
registrationVlan=40
isolationVlan=999
normalVlan=10
EOF
ステップ 5:エンドポイントでサプリカントを設定する
# Windows Group Policy for 802.1X configuration
# Computer Configuration > Policies > Windows Settings > Security Settings
# > System Services > Wired AutoConfig: Automatic
# > Network Policies:
#   Authentication method: Microsoft: Protected EAP (PEAP)
#   Inner method: EAP-MSCHAPv2
#   Trusted Root CA: Corporate CA

# Linux 802.1X configuration with wpa_supplicant
sudo tee /etc/wpa_supplicant/wpa_supplicant-wired.conf << 'EOF'
ctrl_interface=/var/run/wpa_supplicant
ap_scan=0

network={
    key_mgmt=IEEE8021X
    eap=PEAP
    identity="[email protected]"
    password="UserPassword123"
    ca_cert="/etc/ssl/certs/corporate-ca.pem"
    phase2="auth=MSCHAPV2"
}
EOF

# Start wpa_supplicant for wired 802.1X
sudo wpa_supplicant -i eth0 -D wired -c /etc/wpa_supplicant/wpa_supplicant-wired.conf -B

# Verify authentication status
wpa_cli -i eth0 status

# macOS: System Preferences > Network > Ethernet > 802.1X
# Configure with PEAP and corporate credentials
ステップ 6:NAC の導入をテストして検証する
# Test 1: Authenticated device gets correct VLAN
# Connect a corporate laptop with 802.1X configured
# Verify VLAN assignment on the switch:
# show authentication sessions interface Gi1/0/1

# Expected:
# Session ID: 0A0A0A01000000010001
# Status: Authorized
# Domain: DATA
# Oper host mode: multi-auth
# Oper control dir: both
# Authorized By: Authentication Server
# Vlan Policy: 10

# Test 2: Unauthenticated device goes to guest VLAN
# Connect a device without 802.1X supplicant
# show authentication sessions interface Gi1/0/2
# Expected: Vlan Policy: 40 (Guest)

# Test 3: Failed authentication goes to quarantine
# Attempt authentication with wrong credentials
# Expected: Vlan Policy: 999 (Quarantine)

# Test 4: RADIUS server failure - critical VLAN
# Stop FreeRADIUS temporarily
# Connect a new device
# Expected: Vlan Policy: 10 (Critical/failover)

# Test 5: MAC Authentication Bypass
# Connect a printer (no supplicant)
# MAB should authenticate based on MAC address in RADIUS
# show authentication sessions interface Gi1/0/25

# Generate authentication report
# show authentication sessions | include Auth
# show dot1x all summary

主な概念

用語定義
802.1XEAP と RADIUS を介してネットワークアクセスを許可する前にデバイスを認証する、ポートベースのネットワークアクセス制御に関する IEEE 標準です
RADIUSネットワークデバイスがユーザーを認証し、認可属性(VLAN、ACL)を受け取るために使用する Remote Authentication Dial-In User Service プロトコルです
MAB(MAC Authentication Bypass)802.1X サプリカントを実行できないデバイスに対し、デバイスの MAC アドレスを認証情報として使用するフォールバック認証方式です
EAP-PEAPEAP を TLS トンネルでラップする Protected Extensible Authentication Protocol で、ユーザー名/パスワード認証には MSCHAPv2 と組み合わせて使用されることが一般的です
ポスチャ評価フルネットワークアクセスを許可する前に、エンドポイントの準拠状況(OS パッチ、ウイルス対策、暗号化)を評価することです
動的 VLAN 割り当てユーザー ID、グループメンバーシップ、またはデバイスの種類に基づき、RADIUS によって VLAN を自動的に割り当てることで、ポートベースの静的な VLAN 設定を不要にします

ツールとシステム

  • FreeRADIUS:EAP-TLS、PEAP、LDAP 連携、動的 VLAN 割り当てをサポートするオープンソースの RADIUS サーバーです
  • PacketFence:802.1X 連携、ポスチャ評価、キャプティブポータル、デバイス登録を提供するオープンソースの NAC ソリューションです
  • Cisco ISE:プロファイリング、ポスチャ、ゲスト管理、TrustSec 連携を備えたエンタープライズ向け NAC プラットフォームです
  • wpa_supplicant:EAP-TLS、PEAP、TTLS をサポートする、Linux および組み込みシステム向けのオープンソース 802.1X サプリカントです
  • Microsoft NPS:802.1X 認証のために Active Directory とネイティブに連携する、Windows Server の RADIUS 実装です

一般的なシナリオ

シナリオ:病院ネットワークへの802.1X NACの導入

コンテキスト:病院では、HIPAAの要件を満たすためにネットワークアクセス制御を適用する必要があります。ネットワークには、臨床用ワークステーション(ドメイン参加済み)、医療機器(802.1X非対応)、医師のBYOD端末、ゲストWiFiが含まれます。RADIUSサーバーが利用できなくなった場合でも、患者の診療に支障が出ないように導入する必要があります。

アプローチ:

  1. ユーザー認証とグループベースのVLAN割り当てのため、Active Directoryと連携したFreeRADIUSを導入する
  2. グループポリシーと自動登録を使用して、ドメイン参加済みワークステーションにEAP-PEAPを設定する
  3. 医療機器(輸液ポンプ、モニター)を、RADIUSデータベースにMACアドレスを登録してMAB認証に対応させる
  4. dot1x、次にmabの順で認証するようにスイッチを設定し、RADIUSに到達できない場合はクリティカルVLANから臨床用VLANにフォールバックするようにする
  5. 限定アクセスVLANを使用した医師のBYOD端末のオンボーディング用に、PacketFenceキャプティブポータルを導入する
  6. 完全なアクセスにWindows Updateの準拠とBitLocker暗号化を必須とするポスチャチェックを設定する
  7. RADIUSを停止してフェイルオーバーのシナリオをテストし、デバイスが支障なくクリティカルVLANに留まることを確認する

落とし穴:

  • クリティカルVLANへのフォールバックを設定しないと、RADIUSが利用できない場合にデバイスがネットワークにアクセスできなくなる
  • 医療機器の交換や移動に伴い、MABのMACアドレスデータベースが古くなる
  • 802.1Xのタイムアウトにより、ワークステーションのログインが遅延する。特にRADIUSの応答が遅い場合に発生しやすい
  • IP電話とワークステーションが数珠つなぎになっているポートで、マルチホストモードをテストしない

出力形式

## NAC Deployment Report

**RADIUS Server**: freeradius-01 (10.10.100.200)
**NAC Platform**: PacketFence 13.1
**Switches Configured**: 12 access switches
**Total Ports**: 576 access ports

### Authentication Summary (24-hour)

| Auth Type | Success | Failure | Total |
|-----------|---------|---------|-------|
| 802.1X (PEAP) | 342 | 12 | 354 |
| MAB | 87 | 3 | 90 |
| Guest Portal | 23 | 5 | 28 |

### VLAN Assignment Distribution

| VLAN | Name | Assigned Devices |
|------|------|------------------|
| 10 | Corporate | 245 |
| 15 | Development | 67 |
| 20 | Finance | 30 |
| 40 | Guest | 23 |
| 50 | Medical Devices | 87 |
| 999 | Quarantine | 15 (posture fail) |

### Compliance Status
- 802.1X coverage: 100% of access ports
- Posture pass rate: 95.8% (15 devices quarantined for missing patches)
- RADIUS failover tested: Successful (critical VLAN activated in 3 seconds)

コメント