vmware-nsx-security 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. vmware_nsx_security-1.3.0/.gitignore +13 -0
  2. vmware_nsx_security-1.3.0/Dockerfile +13 -0
  3. vmware_nsx_security-1.3.0/PKG-INFO +124 -0
  4. vmware_nsx_security-1.3.0/README-CN.md +103 -0
  5. vmware_nsx_security-1.3.0/README.md +103 -0
  6. vmware_nsx_security-1.3.0/RELEASE_NOTES.md +26 -0
  7. vmware_nsx_security-1.3.0/config.example.yaml +21 -0
  8. vmware_nsx_security-1.3.0/docker-compose.yml +8 -0
  9. vmware_nsx_security-1.3.0/examples/mcp-configs/claude-code.json +10 -0
  10. vmware_nsx_security-1.3.0/examples/mcp-configs/cursor.json +10 -0
  11. vmware_nsx_security-1.3.0/examples/mcp-configs/goose.json +10 -0
  12. vmware_nsx_security-1.3.0/mcp_server/__init__.py +1 -0
  13. vmware_nsx_security-1.3.0/mcp_server/__main__.py +5 -0
  14. vmware_nsx_security-1.3.0/mcp_server/server.py +675 -0
  15. vmware_nsx_security-1.3.0/pyproject.toml +39 -0
  16. vmware_nsx_security-1.3.0/server.json +21 -0
  17. vmware_nsx_security-1.3.0/skills/vmware-nsx-security/SKILL.md +275 -0
  18. vmware_nsx_security-1.3.0/skills/vmware-nsx-security/references/capabilities.md +101 -0
  19. vmware_nsx_security-1.3.0/skills/vmware-nsx-security/references/cli-reference.md +209 -0
  20. vmware_nsx_security-1.3.0/skills/vmware-nsx-security/references/setup-guide.md +175 -0
  21. vmware_nsx_security-1.3.0/tests/__init__.py +0 -0
  22. vmware_nsx_security-1.3.0/tests/test_sanitize.py +147 -0
  23. vmware_nsx_security-1.3.0/vmware_nsx_security/__init__.py +3 -0
  24. vmware_nsx_security-1.3.0/vmware_nsx_security/cli.py +531 -0
  25. vmware_nsx_security-1.3.0/vmware_nsx_security/config.py +123 -0
  26. vmware_nsx_security-1.3.0/vmware_nsx_security/connection.py +192 -0
  27. vmware_nsx_security-1.3.0/vmware_nsx_security/doctor.py +147 -0
  28. vmware_nsx_security-1.3.0/vmware_nsx_security/notify/__init__.py +0 -0
  29. vmware_nsx_security-1.3.0/vmware_nsx_security/notify/audit.py +115 -0
  30. vmware_nsx_security-1.3.0/vmware_nsx_security/ops/__init__.py +1 -0
  31. vmware_nsx_security-1.3.0/vmware_nsx_security/ops/dfw_policy.py +272 -0
  32. vmware_nsx_security-1.3.0/vmware_nsx_security/ops/dfw_rules.py +257 -0
  33. vmware_nsx_security-1.3.0/vmware_nsx_security/ops/idps.py +116 -0
  34. vmware_nsx_security-1.3.0/vmware_nsx_security/ops/security_group.py +248 -0
  35. vmware_nsx_security-1.3.0/vmware_nsx_security/ops/tags.py +162 -0
  36. vmware_nsx_security-1.3.0/vmware_nsx_security/ops/traceflow.py +211 -0
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ .env
9
+ *.log
10
+ .DS_Store
11
+ .venv/
12
+ .mcpregistry_*
13
+ mcp-publisher
@@ -0,0 +1,13 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ RUN pip install --no-cache-dir uv
6
+
7
+ COPY pyproject.toml .
8
+ COPY vmware_nsx_security/ vmware_nsx_security/
9
+ COPY mcp_server/ mcp_server/
10
+
11
+ RUN uv pip install --system .
12
+
13
+ CMD ["python", "-m", "mcp_server"]
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: vmware-nsx-security
3
+ Version: 1.3.0
4
+ Summary: VMware NSX DFW microsegmentation and security: distributed firewall, security groups, tags, traceflow, IDPS
5
+ Author: zw008
6
+ License-Expression: MIT
7
+ Keywords: ai-ops,dfw,firewall,mcp,microsegmentation,nsx,nsx-t,vmware
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Security
12
+ Classifier: Topic :: System :: Networking
13
+ Requires-Python: >=3.10
14
+ Requires-Dist: httpx<1.0,>=0.27
15
+ Requires-Dist: mcp[cli]<2.0,>=1.0
16
+ Requires-Dist: python-dotenv<2.0,>=1.0
17
+ Requires-Dist: pyyaml<7.0,>=6.0
18
+ Requires-Dist: rich<15.0,>=13.0
19
+ Requires-Dist: typer<1.0,>=0.12
20
+ Description-Content-Type: text/markdown
21
+
22
+ # VMware NSX Security
23
+
24
+ VMware NSX DFW microsegmentation and security MCP skill — 20 tools for distributed firewall policies/rules, security groups, VM tags, Traceflow packet tracing, and IDPS.
25
+
26
+ > **Companion skills**: [vmware-nsx](https://github.com/zw008/VMware-NSX) (networking), [vmware-aiops](https://github.com/zw008/VMware-AIops) (VM lifecycle), [vmware-monitor](https://github.com/zw008/VMware-Monitor) (monitoring)
27
+
28
+ ## Quick Start
29
+
30
+ ```bash
31
+ uv tool install vmware-nsx-security
32
+
33
+ mkdir -p ~/.vmware-nsx-security
34
+ cp config.example.yaml ~/.vmware-nsx-security/config.yaml
35
+ # Edit config.yaml with your NSX Manager host
36
+
37
+ echo "VMWARE_NSX_SECURITY_NSX_PROD_PASSWORD=your_password" > ~/.vmware-nsx-security/.env
38
+ chmod 600 ~/.vmware-nsx-security/.env
39
+
40
+ vmware-nsx-security doctor
41
+ ```
42
+
43
+ ## What It Does
44
+
45
+ | Category | Tools |
46
+ |----------|-------|
47
+ | DFW Policy | list, get, create, update, delete, list rules |
48
+ | DFW Rules | create, update, delete, stats |
49
+ | Security Groups | list, get, create, delete |
50
+ | VM Tags | list tags, apply tag |
51
+ | Traceflow | run trace, get result |
52
+ | IDPS | list profiles, engine status |
53
+
54
+ **Total: 20 MCP tools** (10 read-only + 10 write)
55
+
56
+ ## MCP Server Setup
57
+
58
+ Add to `~/.claude.json`:
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "vmware-nsx-security": {
64
+ "command": "vmware-nsx-security-mcp",
65
+ "env": {
66
+ "VMWARE_NSX_SECURITY_CONFIG": "~/.vmware-nsx-security/config.yaml"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Common Workflows
74
+
75
+ ### Microsegment an Application
76
+
77
+ ```bash
78
+ # 1. Create groups by tag
79
+ vmware-nsx-security group create web-vms --name "Web VMs" --tag-scope tier --tag-value web
80
+ vmware-nsx-security group create app-vms --name "App VMs" --tag-scope tier --tag-value app
81
+
82
+ # 2. Create DFW policy
83
+ vmware-nsx-security policy create web-app-policy --name "Web to App" --category Application
84
+ ```
85
+
86
+ ### Tag a VM
87
+
88
+ ```bash
89
+ # Find VM and its external ID
90
+ vmware-nsx-security tag list my-vm-01
91
+
92
+ # Apply tag using the external ID
93
+ vmware-nsx-security tag apply <external-id> --scope tier --value web
94
+ ```
95
+
96
+ ### Trace a Packet
97
+
98
+ ```bash
99
+ vmware-nsx-security traceflow run <src-lport-id> \
100
+ --src-ip 10.0.1.5 --dst-ip 10.0.2.10 --proto TCP --dst-port 443
101
+ ```
102
+
103
+ ## Safety
104
+
105
+ - **Dependency checks**: Cannot delete a policy with active rules, or a group referenced by DFW rules
106
+ - **Audit logging**: All write ops logged to `~/.vmware-nsx-security/audit.log`
107
+ - **Input validation**: IDs validated; all API text sanitized against prompt injection
108
+ - **Dry-run mode**: All CLI write commands support `--dry-run`
109
+ - **Credential safety**: Passwords only from env vars, never in config files
110
+
111
+ ## Companion Skills
112
+
113
+ | Skill | Purpose |
114
+ |-------|---------|
115
+ | **vmware-nsx** | Segments, gateways, NAT, routing, IPAM |
116
+ | **vmware-nsx-security** | DFW, security groups, tags, traceflow, IDPS ← this |
117
+ | **vmware-aiops** | VM lifecycle, deployment, guest ops |
118
+ | **vmware-monitor** | vSphere monitoring, alarms, events |
119
+ | **vmware-storage** | iSCSI, vSAN, datastores |
120
+ | **vmware-vks** | Tanzu Kubernetes |
121
+
122
+ ## License
123
+
124
+ MIT
@@ -0,0 +1,103 @@
1
+ # VMware NSX Security
2
+
3
+ VMware NSX DFW 微分段与安全管理 MCP skill — 20 个工具,涵盖分布式防火墙策略与规则、安全组、VM 标签、Traceflow 数据包追踪和 IDPS。
4
+
5
+ > **配套 skill**:[vmware-nsx](https://github.com/zw008/VMware-NSX)(网络)、[vmware-aiops](https://github.com/zw008/VMware-AIops)(VM 生命周期)、[vmware-monitor](https://github.com/zw008/VMware-Monitor)(监控)
6
+
7
+ ## 快速开始
8
+
9
+ ```bash
10
+ uv tool install vmware-nsx-security
11
+
12
+ mkdir -p ~/.vmware-nsx-security
13
+ cp config.example.yaml ~/.vmware-nsx-security/config.yaml
14
+ # 编辑 config.yaml,填写 NSX Manager 地址
15
+
16
+ echo "VMWARE_NSX_SECURITY_NSX_PROD_PASSWORD=your_password" > ~/.vmware-nsx-security/.env
17
+ chmod 600 ~/.vmware-nsx-security/.env
18
+
19
+ vmware-nsx-security doctor
20
+ ```
21
+
22
+ ## 功能
23
+
24
+ | 类别 | 工具数 |
25
+ |------|--------|
26
+ | DFW 策略 | 列出、获取、创建、更新、删除、列出规则(6 个) |
27
+ | DFW 规则 | 创建、更新、删除、统计(4 个) |
28
+ | 安全组 | 列出、获取、创建、删除(4 个) |
29
+ | VM 标签 | 列出标签、应用标签(2 个) |
30
+ | Traceflow | 运行追踪、获取结果(2 个) |
31
+ | IDPS | 列出 Profile、获取状态(2 个) |
32
+
33
+ **共 20 个 MCP 工具**(10 只读 + 10 写入)
34
+
35
+ ## MCP 服务器配置
36
+
37
+ 添加到 `~/.claude.json`:
38
+
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "vmware-nsx-security": {
43
+ "command": "vmware-nsx-security-mcp",
44
+ "env": {
45
+ "VMWARE_NSX_SECURITY_CONFIG": "~/.vmware-nsx-security/config.yaml"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## 常见操作
53
+
54
+ ### 对应用进行微分段
55
+
56
+ ```bash
57
+ # 1. 按标签创建安全组
58
+ vmware-nsx-security group create web-vms --name "Web VMs" --tag-scope tier --tag-value web
59
+ vmware-nsx-security group create app-vms --name "App VMs" --tag-scope tier --tag-value app
60
+
61
+ # 2. 创建 DFW 策略
62
+ vmware-nsx-security policy create web-app-policy --name "Web to App" --category Application
63
+ ```
64
+
65
+ ### 为 VM 打标签
66
+
67
+ ```bash
68
+ # 查询 VM 及其 external ID
69
+ vmware-nsx-security tag list my-vm-01
70
+
71
+ # 使用 external ID 应用标签
72
+ vmware-nsx-security tag apply <external-id> --scope tier --value web
73
+ ```
74
+
75
+ ### 追踪数据包路径
76
+
77
+ ```bash
78
+ vmware-nsx-security traceflow run <src-lport-id> \
79
+ --src-ip 10.0.1.5 --dst-ip 10.0.2.10 --proto TCP --dst-port 443
80
+ ```
81
+
82
+ ## 安全性
83
+
84
+ - **依赖检查**:有活跃规则时不允许删除策略;被 DFW 规则引用的安全组不允许删除
85
+ - **审计日志**:所有写操作记录到 `~/.vmware-nsx-security/audit.log`(JSON Lines 格式)
86
+ - **输入验证**:ID 字符集校验;API 返回文本经过 `_sanitize()` 清洗,防止提示注入
87
+ - **Dry-run 模式**:CLI 写命令均支持 `--dry-run` 预览
88
+ - **凭据安全**:密码仅从环境变量读取,永不写入 config.yaml
89
+
90
+ ## 配套 Skill
91
+
92
+ | Skill | 用途 |
93
+ |-------|------|
94
+ | **vmware-nsx** | 网段、网关、NAT、路由、IPAM |
95
+ | **vmware-nsx-security** | DFW、安全组、标签、Traceflow、IDPS ← 本 skill |
96
+ | **vmware-aiops** | VM 生命周期、部署、Guest 操作 |
97
+ | **vmware-monitor** | vSphere 监控、告警、事件 |
98
+ | **vmware-storage** | iSCSI、vSAN、数据存储 |
99
+ | **vmware-vks** | Tanzu Kubernetes |
100
+
101
+ ## 许可证
102
+
103
+ MIT
@@ -0,0 +1,103 @@
1
+ # VMware NSX Security
2
+
3
+ VMware NSX DFW microsegmentation and security MCP skill — 20 tools for distributed firewall policies/rules, security groups, VM tags, Traceflow packet tracing, and IDPS.
4
+
5
+ > **Companion skills**: [vmware-nsx](https://github.com/zw008/VMware-NSX) (networking), [vmware-aiops](https://github.com/zw008/VMware-AIops) (VM lifecycle), [vmware-monitor](https://github.com/zw008/VMware-Monitor) (monitoring)
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ uv tool install vmware-nsx-security
11
+
12
+ mkdir -p ~/.vmware-nsx-security
13
+ cp config.example.yaml ~/.vmware-nsx-security/config.yaml
14
+ # Edit config.yaml with your NSX Manager host
15
+
16
+ echo "VMWARE_NSX_SECURITY_NSX_PROD_PASSWORD=your_password" > ~/.vmware-nsx-security/.env
17
+ chmod 600 ~/.vmware-nsx-security/.env
18
+
19
+ vmware-nsx-security doctor
20
+ ```
21
+
22
+ ## What It Does
23
+
24
+ | Category | Tools |
25
+ |----------|-------|
26
+ | DFW Policy | list, get, create, update, delete, list rules |
27
+ | DFW Rules | create, update, delete, stats |
28
+ | Security Groups | list, get, create, delete |
29
+ | VM Tags | list tags, apply tag |
30
+ | Traceflow | run trace, get result |
31
+ | IDPS | list profiles, engine status |
32
+
33
+ **Total: 20 MCP tools** (10 read-only + 10 write)
34
+
35
+ ## MCP Server Setup
36
+
37
+ Add to `~/.claude.json`:
38
+
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "vmware-nsx-security": {
43
+ "command": "vmware-nsx-security-mcp",
44
+ "env": {
45
+ "VMWARE_NSX_SECURITY_CONFIG": "~/.vmware-nsx-security/config.yaml"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## Common Workflows
53
+
54
+ ### Microsegment an Application
55
+
56
+ ```bash
57
+ # 1. Create groups by tag
58
+ vmware-nsx-security group create web-vms --name "Web VMs" --tag-scope tier --tag-value web
59
+ vmware-nsx-security group create app-vms --name "App VMs" --tag-scope tier --tag-value app
60
+
61
+ # 2. Create DFW policy
62
+ vmware-nsx-security policy create web-app-policy --name "Web to App" --category Application
63
+ ```
64
+
65
+ ### Tag a VM
66
+
67
+ ```bash
68
+ # Find VM and its external ID
69
+ vmware-nsx-security tag list my-vm-01
70
+
71
+ # Apply tag using the external ID
72
+ vmware-nsx-security tag apply <external-id> --scope tier --value web
73
+ ```
74
+
75
+ ### Trace a Packet
76
+
77
+ ```bash
78
+ vmware-nsx-security traceflow run <src-lport-id> \
79
+ --src-ip 10.0.1.5 --dst-ip 10.0.2.10 --proto TCP --dst-port 443
80
+ ```
81
+
82
+ ## Safety
83
+
84
+ - **Dependency checks**: Cannot delete a policy with active rules, or a group referenced by DFW rules
85
+ - **Audit logging**: All write ops logged to `~/.vmware-nsx-security/audit.log`
86
+ - **Input validation**: IDs validated; all API text sanitized against prompt injection
87
+ - **Dry-run mode**: All CLI write commands support `--dry-run`
88
+ - **Credential safety**: Passwords only from env vars, never in config files
89
+
90
+ ## Companion Skills
91
+
92
+ | Skill | Purpose |
93
+ |-------|---------|
94
+ | **vmware-nsx** | Segments, gateways, NAT, routing, IPAM |
95
+ | **vmware-nsx-security** | DFW, security groups, tags, traceflow, IDPS ← this |
96
+ | **vmware-aiops** | VM lifecycle, deployment, guest ops |
97
+ | **vmware-monitor** | vSphere monitoring, alarms, events |
98
+ | **vmware-storage** | iSCSI, vSAN, datastores |
99
+ | **vmware-vks** | Tanzu Kubernetes |
100
+
101
+ ## License
102
+
103
+ MIT
@@ -0,0 +1,26 @@
1
+ # Release Notes
2
+
3
+ ---
4
+
5
+ ## v1.3.0 — 2026-03-27
6
+
7
+ ### Initial release
8
+
9
+ - 20 MCP tools: 10 read-only + 10 write operations
10
+ - DFW: security policy CRUD (6 tools) + rule CRUD + rule stats (4 tools)
11
+ - Security groups: list, get, create, delete with dependency checks (4 tools)
12
+ - VM Tags: list VM tags, apply tag (2 tools)
13
+ - Traceflow: run trace with polling + get result (2 tools)
14
+ - IDPS: list profiles, get engine status (2 tools)
15
+ - Safety: `delete_dfw_policy` blocks if active rules exist; `delete_group` blocks if DFW-referenced
16
+ - SKILL.md with progressive disclosure (Anthropic best practices)
17
+ - CLI (`vmware-nsx-security`) with typer — policy/rule/group/tag/traceflow/idps subcommands
18
+ - MCP server (20 tools) via stdio transport
19
+ - Docker one-command launch
20
+ - `vmware-nsx-security doctor` — 8-check environment diagnostics
21
+ - Audit logging (JSON Lines) for all write operations
22
+ - `references/`: cli-reference.md, capabilities.md, setup-guide.md
23
+ - `examples/mcp-configs/`: 3 agent config templates (Claude Code, Cursor, Goose)
24
+ - README.md and README-CN.md with companion skills, workflows, troubleshooting
25
+
26
+ **PyPI**: `uv tool install vmware-nsx-security==1.3.0`
@@ -0,0 +1,21 @@
1
+ # VMware NSX Security Configuration
2
+ # Copy to ~/.vmware-nsx-security/config.yaml and edit
3
+
4
+ targets:
5
+ nsx-prod:
6
+ host: nsx-manager.example.com
7
+ username: admin
8
+ port: 443
9
+ verify_ssl: true
10
+ nsx-lab:
11
+ host: 10.0.0.50
12
+ username: admin
13
+ port: 443
14
+ verify_ssl: false
15
+
16
+ default_target: nsx-prod
17
+
18
+ # Passwords are loaded from environment variables:
19
+ # VMWARE_NSX_SECURITY_NSX_PROD_PASSWORD=xxx
20
+ # VMWARE_NSX_SECURITY_NSX_LAB_PASSWORD=xxx
21
+ # Or from ~/.vmware-nsx-security/.env file
@@ -0,0 +1,8 @@
1
+ services:
2
+ vmware-nsx-security-mcp:
3
+ build: .
4
+ volumes:
5
+ - ~/.vmware-nsx-security:/root/.vmware-nsx-security:ro
6
+ environment:
7
+ - VMWARE_NSX_SECURITY_CONFIG=/root/.vmware-nsx-security/config.yaml
8
+ stdin_open: true
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "vmware-nsx-security": {
4
+ "command": "vmware-nsx-security-mcp",
5
+ "env": {
6
+ "VMWARE_NSX_SECURITY_CONFIG": "~/.vmware-nsx-security/config.yaml"
7
+ }
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "vmware-nsx-security": {
4
+ "command": "vmware-nsx-security-mcp",
5
+ "env": {
6
+ "VMWARE_NSX_SECURITY_CONFIG": "${HOME}/.vmware-nsx-security/config.yaml"
7
+ }
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "vmware-nsx-security": {
4
+ "command": "vmware-nsx-security-mcp",
5
+ "env": {
6
+ "VMWARE_NSX_SECURITY_CONFIG": "~/.vmware-nsx-security/config.yaml"
7
+ }
8
+ }
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ """VMware NSX Security MCP server."""
@@ -0,0 +1,5 @@
1
+ """Allow running as `python -m mcp_server`."""
2
+
3
+ from mcp_server.server import main
4
+
5
+ main()