pan-scm-cli 0.3.2__tar.gz → 0.4.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 (45) hide show
  1. pan_scm_cli-0.4.0/PKG-INFO +710 -0
  2. pan_scm_cli-0.4.0/README.md +692 -0
  3. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/pyproject.toml +11 -11
  4. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/client.py +14 -5
  5. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/commands/README.md +17 -1
  6. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/__init__.cpython-312.pyc +0 -0
  7. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/__init__.cpython-313.pyc +0 -0
  8. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/context.cpython-312.pyc +0 -0
  9. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/deployment.cpython-312.pyc +0 -0
  10. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/deployment.cpython-313.pyc +0 -0
  11. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/network.cpython-312.pyc +0 -0
  12. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/network.cpython-313.pyc +0 -0
  13. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/objects.cpython-312.pyc +0 -0
  14. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/objects.cpython-313.pyc +0 -0
  15. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/security.cpython-312.pyc +0 -0
  16. pan_scm_cli-0.4.0/src/scm_cli/commands/__pycache__/security.cpython-313.pyc +0 -0
  17. pan_scm_cli-0.4.0/src/scm_cli/commands/context.py +352 -0
  18. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/commands/deployment.py +40 -48
  19. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/commands/network.py +183 -130
  20. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/commands/objects.py +815 -702
  21. pan_scm_cli-0.4.0/src/scm_cli/commands/security.py +1820 -0
  22. pan_scm_cli-0.4.0/src/scm_cli/main.py +224 -0
  23. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/__init__.cpython-312.pyc +0 -0
  24. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/__init__.cpython-313.pyc +0 -0
  25. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/config.cpython-312.pyc +0 -0
  26. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/config.cpython-313.pyc +0 -0
  27. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/context.cpython-312.pyc +0 -0
  28. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/sdk_client.cpython-312.pyc +0 -0
  29. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/sdk_client.cpython-313.pyc +0 -0
  30. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/validators.cpython-312.pyc +0 -0
  31. pan_scm_cli-0.4.0/src/scm_cli/utils/__pycache__/validators.cpython-313.pyc +0 -0
  32. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/utils/config.py +21 -43
  33. pan_scm_cli-0.4.0/src/scm_cli/utils/context.py +228 -0
  34. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/utils/sdk_client.py +772 -181
  35. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/utils/validators.py +329 -32
  36. pan_scm_cli-0.3.2/PKG-INFO +0 -779
  37. pan_scm_cli-0.3.2/README.md +0 -761
  38. pan_scm_cli-0.3.2/src/scm_cli/commands/security.py +0 -530
  39. pan_scm_cli-0.3.2/src/scm_cli/main.py +0 -151
  40. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/LICENSE +0 -0
  41. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/__init__.py +0 -0
  42. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/commands/__init__.py +0 -0
  43. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/commands/command-styling.md +0 -0
  44. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/tests/__init__.py +0 -0
  45. {pan_scm_cli-0.3.2 → pan_scm_cli-0.4.0}/src/scm_cli/utils/__init__.py +0 -0
@@ -0,0 +1,710 @@
1
+ Metadata-Version: 2.3
2
+ Name: pan-scm-cli
3
+ Version: 0.4.0
4
+ Summary: CICD and Network Engineer-friendly CLI tool for Palo Alto Networks Strata Cloud Manager
5
+ Author: Calvin Remsburg
6
+ Author-email: dev@cdot.io
7
+ Requires-Python: >=3.12,<3.14
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Requires-Dist: dynaconf (>=3.2.11,<4.0.0)
12
+ Requires-Dist: pan-scm-sdk (==0.3.40)
13
+ Requires-Dist: pydantic (>=2.11.5,<3.0.0)
14
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
15
+ Requires-Dist: typer (>=0.15.4,<0.16.0)
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Strata Cloud Manager CLI
19
+
20
+ [![PyPI version](https://badge.fury.io/py/pan-scm-cli.svg)](https://badge.fury.io/py/pan-scm-cli)
21
+ [![Python versions](https://img.shields.io/pypi/pyversions/pan-scm-cli.svg)](https://pypi.org/project/pan-scm-cli/)
22
+ [![License](https://img.shields.io/github/license/cdot65/pan-scm-cli.svg)](https://github.com/cdot65/pan-scm-cli/blob/main/LICENSE)
23
+
24
+ A command-line interface for managing Palo Alto Networks Strata Cloud Manager (SCM) configurations. This tool simplifies the management of security policies, objects, and configurations through an intuitive CLI.
25
+
26
+ ## Quick Start
27
+
28
+ ```bash
29
+ # Install
30
+ pip install pan-scm-cli
31
+
32
+ # Set credentials
33
+ export SCM_CLIENT_ID="your_client_id"
34
+ export SCM_CLIENT_SECRET="your_client_secret"
35
+ export SCM_TSG_ID="your_tsg_id"
36
+
37
+ # Create an address object
38
+ scm set objects address --folder Texas --name web-server --ip-netmask 10.1.1.100/32 --description "Web server"
39
+
40
+ # List all addresses
41
+ scm show objects address --folder Texas
42
+
43
+ # Create a security rule
44
+ scm set security rule --folder Texas --name allow-web \
45
+ --source-zones trust --destination-zones dmz \
46
+ --source-addresses any --destination-addresses web-server \
47
+ --services any --action allow
48
+ ```
49
+
50
+ ## Table of Contents
51
+
52
+ - [Installation](#installation)
53
+ - [Getting Started](#getting-started)
54
+ - [Common Use Cases](#common-use-cases)
55
+ - [Command Reference](#command-reference)
56
+ - [Advanced Features](#advanced-features)
57
+ - [Troubleshooting](#troubleshooting)
58
+ - [Contributing](#contributing)
59
+
60
+ ## Key Features
61
+
62
+ - **Comprehensive Object Management**: Create, update, and delete security configurations
63
+ - **Bulk Operations**: Import/export configurations using YAML files
64
+ - **Smart Updates**: Automatically handles existing objects without errors
65
+ - **Container Support**: Work with folders, snippets, and devices
66
+ - **Mock Mode**: Test commands without making API calls
67
+ - **Input Validation**: Prevents errors before they reach the API
68
+
69
+ ## Installation
70
+
71
+ ### Requirements
72
+
73
+ - Python 3.10 or higher
74
+ - An active Strata Cloud Manager account
75
+
76
+ ### Install via pip
77
+
78
+ ```bash
79
+ pip install pan-scm-cli
80
+ ```
81
+
82
+ ## Getting Started
83
+
84
+ ### 1. Set Up Authentication
85
+
86
+ Choose one of these methods to configure your credentials:
87
+
88
+ #### Option A: Context-based Authentication (Recommended for Multiple Tenants)
89
+
90
+ ```bash
91
+ # Create a context for each SCM tenant
92
+ $ scm context create production \
93
+ --client-id "prod-app@123456789.iam.panserviceaccount.com" \
94
+ --client-secret "your-secret-key" \
95
+ --tsg-id "123456789"
96
+ ✓ Context 'production' created successfully
97
+ ✓ Context 'production' set as current
98
+
99
+ # Create another context (with custom log level)
100
+ $ scm context create development \
101
+ --client-id "dev-app@987654321.iam.panserviceaccount.com" \
102
+ --client-secret "your-dev-secret" \
103
+ --tsg-id "987654321" \
104
+ --log-level DEBUG
105
+ ✓ Context 'development' created successfully
106
+
107
+ # View all available contexts
108
+ $ scm context list
109
+ SCM Authentication Contexts
110
+ ┏━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
111
+ ┃ Context ┃ Current ┃ Client ID ┃
112
+ ┡━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
113
+ │ production │ ✓ │ prod-app@1...@123456789.iam.panserviceaccount.com │
114
+ │ development │ │ dev-app@98...@987654321.iam.panserviceaccount.com │
115
+ └─────────────┴─────────┴────────────────────────────────────────────────────┘
116
+
117
+ # Show details of a specific context
118
+ $ scm context show production
119
+ Context: production
120
+
121
+ Configuration:
122
+ Client ID: prod-app@123456789.iam.panserviceaccount.com
123
+ TSG ID: 123456789
124
+ Log Level: INFO
125
+ Client Secret: ***** (configured)
126
+
127
+ # Switch between contexts
128
+ $ scm context use development
129
+ ✓ Switched to context 'development'
130
+
131
+ Client ID: dev-app@987654321.iam.panserviceaccount.com
132
+ TSG ID: 987654321
133
+
134
+ # Check current context
135
+ $ scm context current
136
+ Current context: development
137
+
138
+ Client ID: dev-app@987654321.iam.panserviceaccount.com
139
+ TSG ID: 987654321
140
+ ```
141
+
142
+ #### Option B: Environment Variables (For CI/CD and Automation)
143
+
144
+ ```bash
145
+ export SCM_CLIENT_ID="your_client_id"
146
+ export SCM_CLIENT_SECRET="your_client_secret"
147
+ export SCM_TSG_ID="your_tenant_service_group_id"
148
+ ```
149
+
150
+ **Note:** Environment variables take precedence over contexts when both are set.
151
+
152
+ ### 2. Verify Your Setup
153
+
154
+ ```bash
155
+ # Test current context authentication
156
+ $ scm context test
157
+ Testing authentication for context: development
158
+ ✓ Authentication successful!
159
+ Client ID: dev-app@987654321.iam.panserviceaccount.com
160
+ TSG ID: 987654321
161
+ ✓ API connectivity verified (found 42 address objects in Shared folder)
162
+
163
+ # Test a specific context without switching
164
+ $ scm context test production
165
+ Testing authentication for context: production
166
+ ✓ Authentication successful!
167
+ Client ID: prod-app@123456789.iam.panserviceaccount.com
168
+ TSG ID: 123456789
169
+ ✓ API connectivity verified (found 15 address objects in Shared folder)
170
+
171
+ # Test without API calls (mock mode)
172
+ $ scm context test --mock
173
+ Testing authentication for context: development
174
+ ✓ Authentication simulation successful (mock mode)
175
+ Client ID: dev-app@987654321.iam.panserviceaccount.com
176
+ TSG ID: 987654321
177
+ ```
178
+
179
+ ### 3. Try Your First Commands
180
+
181
+ ```bash
182
+ # Create a tag
183
+ scm set objects tag --folder Texas --name production --color Red --comments "Production resources"
184
+
185
+ # Create an address
186
+ scm set objects address --folder Texas --name web-server --ip-netmask 10.1.1.100/32
187
+
188
+ # List all addresses
189
+ scm show objects address --folder Texas
190
+ ```
191
+
192
+ ## Common Use Cases
193
+
194
+ ### Managing Network Objects
195
+
196
+ #### Create Address Objects
197
+
198
+ ```bash
199
+ # Single IP address
200
+ scm set objects address --folder Texas --name web-server-1 --ip-netmask 10.1.1.100/32 --description "Production web server"
201
+
202
+ # Subnet
203
+ scm set objects address --folder Texas --name dmz-subnet --ip-netmask 10.0.0.0/24 --description "DMZ network"
204
+
205
+ # FQDN
206
+ scm set objects address --folder Texas --name external-site --fqdn example.com --description "External website"
207
+ ```
208
+
209
+ #### Create Address Groups
210
+
211
+ ```bash
212
+ # Static group with multiple members
213
+ scm set objects address-group --folder Texas --name web-servers --type static --members "web-server-1,web-server-2"
214
+
215
+ # Dynamic group based on tags
216
+ scm set objects address-group --folder Texas --name dynamic-web-servers --type dynamic --filter "'web' and 'production'"
217
+ ```
218
+
219
+ ### Security Policy Management
220
+
221
+ #### Create Security Zones
222
+
223
+ ```bash
224
+ # Layer 3 zone
225
+ scm set network zone --folder Texas --name dmz --mode layer3
226
+
227
+ # Zone with user ID enabled
228
+ scm set network zone --folder Texas --name trust --mode layer3 --enable-user-id
229
+ ```
230
+
231
+ #### Create Security Rules
232
+
233
+ ```bash
234
+ # Basic allow rule
235
+ scm set security rule --folder Texas --name allow-web-traffic \
236
+ --source-zones trust \
237
+ --destination-zones dmz \
238
+ --source-addresses any \
239
+ --destination-addresses web-servers \
240
+ --services any \
241
+ --action allow \
242
+ --log-end
243
+
244
+ # Application-specific rule
245
+ scm set security rule --folder Texas --name allow-database \
246
+ --source-zones app-zone \
247
+ --destination-zones db-zone \
248
+ --source-addresses app-servers \
249
+ --destination-addresses database-servers \
250
+ --applications "mysql,postgresql" \
251
+ --action allow
252
+ ```
253
+
254
+ ### Service Management
255
+
256
+ #### Create Custom Services
257
+
258
+ ```bash
259
+ # TCP service
260
+ scm set objects service --folder Texas --name custom-web --protocol tcp --port "8080,8443" --description "Custom web ports"
261
+
262
+ # UDP service
263
+ scm set objects service --folder Texas --name custom-dns --protocol udp --port 5353 --description "mDNS"
264
+
265
+ # Service with timeout override
266
+ scm set objects service --folder Texas --name long-running-db --protocol tcp --port 3306 --timeout 7200
267
+ ```
268
+
269
+ #### Service Groups
270
+
271
+ ```bash
272
+ # Group related services
273
+ scm set objects service-group --folder Texas --name web-services --members "http,https,custom-web"
274
+ ```
275
+
276
+ ### Tag Management
277
+
278
+ Tags help organize and categorize your objects:
279
+
280
+ ```bash
281
+ # Environment tags
282
+ scm set objects tag --folder Texas --name production --color Red --comments "Production environment"
283
+ scm set objects tag --folder Texas --name development --color Green --comments "Development environment"
284
+ scm set objects tag --folder Texas --name staging --color Blue --comments "Staging environment"
285
+
286
+ # Category tags
287
+ scm set objects tag --folder Texas --name database --color Orange --comments "Database resources"
288
+ scm set objects tag --folder Texas --name web --color Cyan --comments "Web resources"
289
+ ```
290
+
291
+ ### Bulk Operations
292
+
293
+ Work with multiple objects at once using YAML files:
294
+
295
+ #### Export Configuration
296
+
297
+ ```bash
298
+ # Export all addresses from a folder
299
+ scm backup objects address --folder Texas
300
+ # Creates: address_folder_texas_20250602_143000.yaml
301
+
302
+ # Export with custom filename
303
+ scm backup objects address-group --folder Texas --file my-groups.yaml
304
+
305
+ # Export from different containers
306
+ scm backup objects tag --snippet automation
307
+ scm backup objects service --device austin-01
308
+ ```
309
+
310
+ #### Import Configuration
311
+
312
+ Create a YAML file for bulk import:
313
+
314
+ ```yaml
315
+ # addresses.yaml
316
+ addresses:
317
+ - name: web-01
318
+ description: "Production web server"
319
+ ip_netmask: 10.1.1.10/32
320
+ folder: Texas
321
+ tags:
322
+ - web
323
+ - production
324
+
325
+ - name: web-02
326
+ description: "Production web server"
327
+ ip_netmask: 10.1.1.11/32
328
+ folder: Texas
329
+ tags:
330
+ - web
331
+ - production
332
+
333
+ - name: db-01
334
+ description: "Database server"
335
+ ip_netmask: 10.2.1.10/32
336
+ folder: Texas
337
+ tags:
338
+ - database
339
+ - production
340
+ ```
341
+
342
+ Import the configuration:
343
+
344
+ ```bash
345
+ # Preview changes
346
+ scm load objects address --file addresses.yaml --dry-run
347
+
348
+ # Import to original locations
349
+ scm load objects address --file addresses.yaml
350
+
351
+ # Override location for all objects
352
+ scm load objects address --file addresses.yaml --folder Production
353
+ ```
354
+
355
+ ### Context Management Examples
356
+
357
+ #### Working with Multiple Tenants
358
+
359
+ ```bash
360
+ # Create contexts for different environments
361
+ $ scm context create prod-us \
362
+ --client-id "us-prod@111111111.iam.panserviceaccount.com" \
363
+ --client-secret "prod-secret" \
364
+ --tsg-id "111111111" \
365
+ --log-level WARNING
366
+ ✓ Context 'prod-us' created successfully
367
+
368
+ $ scm context create prod-eu \
369
+ --client-id "eu-prod@222222222.iam.panserviceaccount.com" \
370
+ --client-secret "prod-secret" \
371
+ --tsg-id "222222222" \
372
+ --log-level WARNING
373
+ ✓ Context 'prod-eu' created successfully
374
+
375
+ # List all contexts
376
+ $ scm context list
377
+ SCM Authentication Contexts
378
+ ┏━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
379
+ ┃ Context ┃ Current ┃ Client ID ┃
380
+ ┡━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
381
+ │ production │ │ prod-app@1...@123456789.iam.panserviceaccount.com │
382
+ │ development │ ✓ │ dev-app@98...@987654321.iam.panserviceaccount.com │
383
+ │ prod-us │ │ us-prod@11...@111111111.iam.panserviceaccount.com │
384
+ │ prod-eu │ │ eu-prod@22...@222222222.iam.panserviceaccount.com │
385
+ └─────────────┴─────────┴────────────────────────────────────────────────────┘
386
+
387
+ # Work with US production
388
+ $ scm context use prod-us
389
+ ✓ Switched to context 'prod-us'
390
+
391
+ $ scm show objects address --folder Texas
392
+ [INFO] Using authentication context: prod-us
393
+ Addresses in folder 'Texas':
394
+ ...
395
+
396
+ # Switch to EU production
397
+ $ scm context use prod-eu
398
+ ✓ Switched to context 'prod-eu'
399
+
400
+ $ scm show objects address --folder London
401
+ [INFO] Using authentication context: prod-eu
402
+ Addresses in folder 'London':
403
+ ...
404
+
405
+ # Delete a context you no longer need
406
+ $ scm context delete old-dev
407
+ Are you sure you want to delete context 'old-dev'? [y/N]: y
408
+ ✓ Context 'old-dev' deleted
409
+ ```
410
+
411
+ ### Docker Container Support
412
+
413
+ The SCM CLI is available as a Docker image, providing a consistent environment across different platforms. The Docker image integrates seamlessly with the context management system:
414
+
415
+ #### Running with Contexts
416
+
417
+ ```bash
418
+ # Pull the official image
419
+ docker pull ghcr.io/cdot65/pan-scm-cli:latest
420
+
421
+ # Run with context volume mounting
422
+ docker run -d \
423
+ --name pan-scm \
424
+ -v ~/.scm-cli:/home/scmuser/.scm-cli \
425
+ ghcr.io/cdot65/pan-scm-cli:latest
426
+
427
+ # Your contexts are now available in the container
428
+ docker exec pan-scm scm context list
429
+
430
+ # Switch contexts in the container
431
+ docker exec pan-scm scm context use production
432
+
433
+ # Run commands with the active context
434
+ docker exec pan-scm scm show objects address --folder Texas
435
+ ```
436
+
437
+ #### Benefits of Docker with Contexts
438
+
439
+ 1. **Consistent Environment**: Same CLI version and dependencies across all systems
440
+ 2. **Context Portability**: Your contexts work identically on host and in containers
441
+ 3. **Security**: Credentials stay on the host, never baked into images
442
+ 4. **Multi-tenant Isolation**: Run multiple containers with different contexts simultaneously
443
+ 5. **CI/CD Ready**: Perfect for automated workflows with environment variable overrides
444
+
445
+ #### Multi-tenant Example
446
+
447
+ ```bash
448
+ # Run containers for different environments
449
+ docker run -d --name scm-prod -v ~/.scm-cli:/home/scmuser/.scm-cli ghcr.io/cdot65/pan-scm-cli:latest
450
+ docker run -d --name scm-dev -v ~/.scm-cli:/home/scmuser/.scm-cli ghcr.io/cdot65/pan-scm-cli:latest
451
+
452
+ # Use different contexts in each container
453
+ docker exec scm-prod scm context use production
454
+ docker exec scm-dev scm context use development
455
+
456
+ # Now each container operates on different tenants
457
+ docker exec scm-prod scm show objects address --folder Production
458
+ docker exec scm-dev scm show objects address --folder Development
459
+ ```
460
+
461
+ ### Complete Workflow Example
462
+
463
+ Here's a complete example of setting up a web application security policy:
464
+
465
+ ```bash
466
+ # Step 1: Create tags
467
+ scm set objects tag --folder Texas --name web --color Cyan --comments "Web resources"
468
+ scm set objects tag --folder Texas --name database --color Orange --comments "Database resources"
469
+ scm set objects tag --folder Texas --name production --color Red --comments "Production environment"
470
+
471
+ # Step 2: Create addresses
472
+ scm set objects address --folder Texas --name web-01 --ip-netmask 10.1.1.10/32 --tag web,production
473
+ scm set objects address --folder Texas --name web-02 --ip-netmask 10.1.1.11/32 --tag web,production
474
+ scm set objects address --folder Texas --name db-01 --ip-netmask 10.2.1.10/32 --tag database,production
475
+
476
+ # Step 3: Create address groups
477
+ scm set objects address-group --folder Texas --name web-servers-group --type static --members "web-01,web-02"
478
+ scm set objects address-group --folder Texas --name database-servers --type static --members "db-01"
479
+
480
+ # Step 4: Create custom services
481
+ scm set objects service --folder Texas --name custom-web --protocol tcp --port 443
482
+ scm set objects service --folder Texas --name custom-db --protocol tcp --port 3306
483
+
484
+ # Step 5: Create service group
485
+ scm set objects service-group --folder Texas --name app-services --members "custom-web,custom-db"
486
+
487
+ # Step 6: Create security zones
488
+ scm set network zone --folder Texas --name trust --mode layer3
489
+ scm set network zone --folder Texas --name dmz --mode layer3
490
+ scm set network zone --folder Texas --name database --mode layer3
491
+
492
+ # Step 7: Create security rule
493
+ scm set security rule --folder Texas --name allow-web-to-db \
494
+ --source-zones dmz \
495
+ --destination-zones database \
496
+ --source-addresses web-servers-group \
497
+ --destination-addresses database-servers \
498
+ --services custom-db \
499
+ --action allow \
500
+ --log-end \
501
+ --description "Allow web servers to access database"
502
+
503
+ # Step 8: Verify configuration
504
+ scm show security rule --folder Texas --name allow-web-to-db
505
+ ```
506
+
507
+ ## Command Reference
508
+
509
+ ### Basic Command Structure
510
+
511
+ ```
512
+ scm <action> <object-type> <object> [options]
513
+ ```
514
+
515
+ ### Actions
516
+
517
+ - **set**: Create or update an object
518
+ - **show**: Display objects (lists all by default, use --name for specific object)
519
+ - **delete**: Remove an object
520
+ - **load**: Import from YAML file
521
+ - **backup**: Export to YAML file
522
+ - **context**: Manage authentication contexts
523
+
524
+ ### Object Types
525
+
526
+ - **objects**: Address, service, tag, application configurations
527
+ - **network**: Security zones
528
+ - **security**: Security rules and profiles
529
+ - **deployment**: Bandwidth allocations
530
+
531
+ ### Common Options
532
+
533
+ - `--folder`: Specify folder location (default: "Shared")
534
+ - `--snippet`: Use snippet instead of folder
535
+ - `--device`: Use device instead of folder
536
+ - `--mock`: Run without API calls
537
+ - `--help`: Show command help
538
+
539
+ ## Advanced Features
540
+
541
+ ### External Dynamic Lists (EDLs)
542
+
543
+ Integrate threat intelligence feeds:
544
+
545
+ ```bash
546
+ # Palo Alto Networks predefined lists
547
+ scm set objects external-dynamic-list --folder Texas \
548
+ --name bulletproof-ips --type predefined_ip \
549
+ --url "panw-bulletproof-ip-list"
550
+
551
+ # Custom threat feed with hourly updates
552
+ scm set objects external-dynamic-list --folder Texas \
553
+ --name threat-feed --type ip \
554
+ --url "https://example.com/threats.txt" \
555
+ --recurring hourly
556
+
557
+ # Domain blocklist with authentication
558
+ scm set objects external-dynamic-list --folder Texas \
559
+ --name malicious-domains --type domain \
560
+ --url "https://secure.example.com/domains.txt" \
561
+ --username api_user --password secure_pass \
562
+ --recurring daily --hour 3
563
+ ```
564
+
565
+ ### Application Management
566
+
567
+ Define custom applications:
568
+
569
+ ```bash
570
+ # Create custom application
571
+ scm set objects application --folder Texas --name internal-portal \
572
+ --category business-systems --subcategory general-business \
573
+ --technology browser-based --risk 2 \
574
+ --ports "tcp/443" --description "Internal employee portal"
575
+
576
+ # High-risk application filter
577
+ scm set objects application-filter --folder Texas --name high-risk-apps \
578
+ --category "file-sharing,peer-to-peer" --risk 4 --risk 5 \
579
+ --has-known-vulnerabilities
580
+ ```
581
+
582
+ ### HIP (Host Information Profile) Compliance
583
+
584
+ Enforce endpoint compliance:
585
+
586
+ ```bash
587
+ # Windows compliance check
588
+ scm set objects hip-object --folder Texas --name windows-compliance \
589
+ --description "Windows security requirements" \
590
+ --host-info-os Microsoft --host-info-os-value All \
591
+ --host-info-managed \
592
+ --disk-encryption-enabled \
593
+ --patch-management-enabled
594
+
595
+ # Create HIP profile
596
+ scm set objects hip-profile --folder Texas --name secure-endpoints \
597
+ --match '{"windows-compliance": {"is": true}}' \
598
+ --description "Require compliant Windows endpoints"
599
+ ```
600
+
601
+ ### Log Forwarding
602
+
603
+ Configure log collection:
604
+
605
+ ```bash
606
+ # Syslog server profile
607
+ scm set objects syslog-server-profile --folder Texas --name central-syslog \
608
+ --servers '[{"name": "primary", "server": "10.0.1.50", "port": 514, "transport": "TCP", "format": "BSD", "facility": "LOG_USER"}]'
609
+
610
+ # HTTP server profile for SIEM
611
+ scm set objects http-server-profile --folder Texas --name splunk-hec \
612
+ --servers '[{"name": "splunk", "address": "10.0.1.100", "protocol": "HTTPS", "port": 8088, "http_method": "POST"}]'
613
+
614
+ # Log forwarding profile
615
+ scm set objects log-forwarding-profile --folder Texas --name security-logs \
616
+ --match-list '[{"name": "threats", "log_type": "threat", "send_to_panorama": true}]'
617
+ ```
618
+
619
+ ## Troubleshooting
620
+
621
+ ### Common Issues
622
+
623
+ #### Authentication Errors
624
+
625
+ ```bash
626
+ # Check current authentication
627
+ scm context test
628
+
629
+ # If fails, verify credentials
630
+ echo $SCM_CLIENT_ID
631
+ echo $SCM_CLIENT_SECRET
632
+ echo $SCM_TSG_ID
633
+ ```
634
+
635
+ #### Object Already Exists
636
+
637
+ The CLI handles existing objects gracefully:
638
+
639
+ ```bash
640
+ # This will update if exists, create if not
641
+ scm set objects address --folder Texas --name server --ip-netmask 10.1.1.1/32
642
+ ```
643
+
644
+ #### Rate Limiting
645
+
646
+ If you encounter rate limits:
647
+
648
+ ```bash
649
+ # Use mock mode for testing
650
+ scm set objects address --folder Texas --name test --ip-netmask 10.1.1.1/32 --mock
651
+
652
+ # Or add delays in scripts
653
+ sleep 1
654
+ ```
655
+
656
+ ### Debug Mode
657
+
658
+ For detailed logging:
659
+
660
+ ```bash
661
+ # Set log level
662
+ export SCM_LOG_LEVEL=DEBUG
663
+
664
+ # Run command
665
+ scm show objects address --folder Texas
666
+ ```
667
+
668
+ ## Examples Directory
669
+
670
+ The `examples/` directory contains ready-to-use templates:
671
+
672
+ - `addresses.yml` - Common address objects
673
+ - `rfc1918-addresses.yml` - Private IP ranges
674
+ - `security-rules.yml` - Security policy examples
675
+ - `tags.yml` - Tag organization system
676
+ - `services.yml` - Custom service definitions
677
+ - `hip-objects.yml` - HIP compliance configurations
678
+
679
+ ## Contributing
680
+
681
+ We welcome contributions! Please see our [Contributing Guide](./docs/about/contributing.md) for details.
682
+
683
+ ### Development Setup
684
+
685
+ ```bash
686
+ # Clone repository
687
+ git clone https://github.com/cdot65/pan-scm-cli.git
688
+ cd pan-scm-cli
689
+
690
+ # Install dependencies
691
+ make setup
692
+
693
+ # Run tests
694
+ make tests
695
+
696
+ # Check code quality
697
+ make quality
698
+ ```
699
+
700
+ ## License
701
+
702
+ Apache 2.0 - see [LICENSE](./LICENSE) for details.
703
+
704
+ ## Resources
705
+
706
+ - [Documentation](https://cdot65.github.io/pan-scm-cli/)
707
+ - [GitHub Issues](https://github.com/cdot65/pan-scm-cli/issues)
708
+ - [Examples](./examples/)
709
+ - [Release Notes](https://github.com/cdot65/pan-scm-cli/releases)
710
+