Scripts and CSV templates for converting Cisco Identity Services Engine (ISE) TrustSec components and matrix to Cisco Meraki Adaptive Policy.
These scripts assume the use of Cisco ISE and Meraki REST APIs using Python.
-
Clone this repository:
git clone https://github.com/1homas/Cisco_ISE_Meraki_TrustSec_Scripts.git cd Cisco_ISE_Meraki_TrustSec_Scripts
-
Create your Python environment:
pipenv install pipenv install -r requirements.txt # install required Python packages (`pip freeze > requirements.txt`) pipenv shell
-
Export your ISE credentials into your terminal environment
export ISE_HOSTNAME=ise.securitydemo.net # ISE PAN for configuration export ISE_USERNAME=admin export ISE_PASSWORD=ISEisC00L export ISE_VERIFY=False export ISE_DEBUG=False export MERAKI_KEY='abcdef1234567890abcdef1234567890abcdef12' export MERAKI_ORG_NAME=example_org export MERAKI_NET_NAME=example_net
π‘ Add one or more spaces before the
export
commands to prevent these commands with your secrets from being saved to your shell historyYou may also edit and source these variables from a file in your
~/.secrets
directory :source ~/.secrets/ise.sh source ~/.secrets/meraki.sh
-
Verify ISE and Meraki API connectivity:
ise_api_enabled.py meraki_api_enabled.py
-
Run an script:
ise_version.py ise_trustsec_export.py meraki_trustsec_export.py
Enable the ISE ERS and OpenAPIs.
ise_api_enabled.py
:
β
ISE Open APIs Enabled
β
ISE ERS APIs Enabled
Returns the ISE version
Example output:
> ise_version.py
build: '383'
maintenance: '0'
major: '3'
minor: '3'
patch: '0'
version: 3.3.0.383
Exports the ISE TrustSec configurations using ISE REST APIs to your terminal as tables and to local files in the directory prefixed with ise_trustsec
by default:
ise_trustsec_matrix.xlsx
: a Microsoft Excel workbook with tabs for the matrix, SGACLs, and SGTs.ise_trustsec_matrix.csv
: a CSV export of the TrustSec matrix, compatible with the ISE CSV import/export.ise_trustsec_sgacls.csv
: a CSV export of the SGACLs. ISE does not support CSV import/export of the SGACLs however it is very nice to have a text dump of the SGACLs!ise_trustsec_sgts.csv
: a CSV export of the TrustSec SGTs, compatible with the ISE CSV import/export.
You may change the default ise_trustsec
prefix using the -f/--filename {prefix}
option.
> ise_trustsec_export.py
β SGTs:
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ¬ββββββββββ¬βββββββββββββββββ¬ββββββββββββββββββββ
β name β description β value β generationId β propogateToApic β
ββββββββββββββββββββΌββββββββββββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β TrustSec_Devices β TrustSec Devices Security Group β 2 β 82 β False β
ββββββββββββββββββββΌββββββββββββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Unknown β Unknown Security Group β 0 β 82 β False β
ββββββββββββββββββββΌββββββββββββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β ANY β ANY β 65535 β 0 β False β
ββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββ΄ββββββββββ΄βββββββββββββββββ΄ββββββββββββββββββββ
β SGACLs:
βββββββββββββββββ¬βββββββββββββββββββββββββ¬βββββββββββββββββ¬ββββββββββββββββ
β name β description β generationId β aclcontent β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Deny IP β Deny IP SGACL β 0 β deny ip β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Deny_IP_Log β Deny IP with logging β 0 β deny ip log β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Permit IP β Permit IP SGACL β 0 β permit ip β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Permit_IP_Log β Permit IP with logging β 0 β permit ip log β
βββββββββββββββββ΄βββββββββββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββββ
β Policies:
βββββββββββ¬ββββββββββββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬ββββββββββββββββ
β Name β Description β Status β SrcSGT β DstSGT β SGACLs β DefaultRule β
βββββββββββΌββββββββββββββββββββββΌβββββββββββΌβββββββββββΌβββββββββββΌβββββββββββΌββββββββββββββββ€
β ANY-ANY β Default egress rule β ENABLED β ANY β ANY β Deny IP β DENY_IP β
βββββββββββ΄ββββββββββββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄ββββββββββββββββ
β Matrix:
ββββββββββββββββββββ¬ββββββββββ¬ββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββ¬ββββββββββββ
β SGT β Value β Description β TrustSec_Devices β Unknown β
ββββββββββββββββββββΌββββββββββΌββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββΌββββββββββββ€
β TrustSec_Devices β 2 β TrustSec Devices Security Group β β β
ββββββββββββββββββββΌββββββββββΌββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββΌββββββββββββ€
β Unknown β 0 β Unknown Security Group β β β
ββββββββββββββββββββ΄ββββββββββ΄ββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββ΄ββββββββββββ
Deletes all SGTs, SGACLs, and Egress Matrix Cells from the ISE deployment.
You will see errors when it tries to delete reserved SGTs (Unknown
, TrustSec_Devices
) and SGACLs (Deny IP
, Deny_IP_Log
,Permit IP
, Permit_IP_Log
).
> ise_trustsec_clear.py
β« 204 da9ad00d-0b9f-42b9-bbac-80979a04edf8
β« 204 7b311821-b0f6-4c61-93af-94a47b6f688d
β« 204 aba5dbe0-eee2-4aa4-b539-b02684721b04
β« 204 4fa15703-0c02-428c-8a2d-8f5d0020be6e
β« 204 98323647-073f-4e3f-bb89-2f8d0fdf1c20
β« 204 3ea6d69c-c023-45bd-9fe7-3d2034b7663f
β« 204 c9f61c26-7313-407d-ae16-539a7c44854d
β« 204 f6448013-2682-4e7b-b42e-0598d5ff6d06
β« 204 6bcef4ef-589c-4fa0-9f36-494aa0d996f7
β« 204 8bbeebbc-6a12-40af-b49a-77aa8b93c434
β« 204 2e2183c7-a1ed-4395-8016-84757347044f
β« 204 35b586a2-bf38-4af4-bc3b-d753e789e5b3
β« 204 45fcd70a-3139-4775-8e93-4f4abd7af958
β« 204 a5fe8a07-2c7e-478e-a69a-eb36b14c6ff9
β 500 Security group TrustSec_Devices is currently in use. References to this security group must be removed before it can be deleted.
β 400 Deletion of security group Unknown is forbidden and has been blocked!
β 500 Deletion of security group ACL Deny IP is forbidden and has been blocked (read only object).
β 500 Deletion of security group ACL Deny_IP_Log is forbidden and has been blocked (read only object).
β 500 Deletion of security group ACL Permit IP is forbidden and has been blocked (read only object).
β 500 Deletion of security group ACL Permit_IP_Log is forbidden and has been blocked (read only object).
β 400 can not delete default egress policy matrix rule .
Load a TrustSec matrix from an Excel workbook into ISE using REST APIs. The default Excel workbook name is ise_trustsec_matrix.xlsx
which is the default from ise_trustsec_export.py
. The default ISE TrustSec matrix is provided in ise_trustsec_matrix_default.xlsx
.
Load the default ISE TrustSec matrix from ise_trustsec_matrix_default.xlsx
:
> excel_trustsec_matrix_to_ise.py ise_trustsec_matrix_default.xlsx
β« 204 0eb228da-7a4b-414c-a738-9d5df68ecb66
β« 204 e12aa794-f212-42b6-a1b6-dea31dd299aa
β« 204 3b765a1b-32ec-457a-8a10-89e8c36fb738
β« 204 65a78800-6172-4113-8474-7e89a7785f2f
β« 204 422c32e3-a576-4a42-b82c-eabfb638f1b0
β« 204 53935ce8-55c7-4632-927b-bcd046e0e23c
β« 204 7abdd089-60bc-42c6-a434-742c7233e7f2
β« 204 2a2e2b43-814e-499b-b5d1-9d2266cb8eb3
β« 204 a8007749-2d95-4f77-9a4e-62e09628f413
β« 204 a5b0aa3a-3da4-4288-82b2-5ee6c1913afb
β« 204 a044f345-73bd-4f66-aab3-e3b5d9f151fd
β« 204 3d97773f-d1f7-42cc-aa0d-cc82ae34fb77
β« 204 f89b0543-16d0-405c-9c0e-0d043b148e4c
β« 204 337811b5-554b-485b-a87a-3c2770e9d7ab
β 500 Security group TrustSec_Devices is currently in use. References to this security group must be removed before it can be deleted.
β 400 Deletion of security group Unknown is forbidden and has been blocked!
β 500 Deletion of security group ACL Deny IP is forbidden and has been blocked (read only object).
β 500 Deletion of security group ACL Deny_IP_Log is forbidden and has been blocked (read only object).
β 500 Deletion of security group ACL Permit IP is forbidden and has been blocked (read only object).
β 500 Deletion of security group ACL Permit_IP_Log is forbidden and has been blocked (read only object).
β 400 can not delete default egress policy matrix rule .
π 201 Auditors
π 201 BYOD
π 201 Contractors
π 201 Developers
π 201 Development_Servers
π 201 Employees
π 201 Guests
π 201 Network_Services
π 201 PCI_Servers
π 201 Point_of_Sale_Systems
π 201 Production_Servers
π 201 Production_Users
π 201 Quarantined_Systems
π 201 Test_Servers
β SGTs:
βββββββββββββββββββββββββ¬ββββββββββ¬βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββ¬ββββββββββββββββββββ
β name β value β description β generationId β propogateToApic β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Auditors β 9 β Auditor Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β BYOD β 15 β BYOD Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Contractors β 5 β Contractor Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Developers β 8 β Developer Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Development_Servers β 12 β Development Servers Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Employees β 4 β Employee Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Guests β 6 β Guest Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Network_Services β 3 β Network Services Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β PCI_Servers β 14 β PCI Servers Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Point_of_Sale_Systems β 10 β Point of Sale Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Production_Servers β 11 β Production Servers Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Production_Users β 7 β Production User Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Quarantined_Systems β 255 β Quarantine Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Test_Servers β 13 β Test Servers Security Group β 0 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β TrustSec_Devices β 2 β TrustSec Devices Security Group β 82 β False β
βββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββ€
β Unknown β 0 β Unknown Security Group β 82 β False β
βββββββββββββββββββββββββ΄ββββββββββ΄βββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββββββββ
β SGACLs:
βββββββββββββββββ¬βββββββββββββββββββββββββ¬βββββββββββββββββ¬ββββββββββββββββ
β name β description β generationId β aclcontent β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Deny IP β Deny IP SGACL β 0 β deny ip β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Deny_IP_Log β Deny IP with logging β 0 β deny ip log β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Permit IP β Permit IP SGACL β 0 β permit ip β
βββββββββββββββββΌβββββββββββββββββββββββββΌβββββββββββββββββΌββββββββββββββββ€
β Permit_IP_Log β Permit IP with logging β 0 β permit ip log β
βββββββββββββββββ΄βββββββββββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββββ```
> meraki_api_enabled.py
β Organizations (1)
ββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββ
β name β api β management β
ββββββββββΌββββββββββββββββββββΌββββββββββββββββββ€
β 1homas β {'enabled': True} β {'details': []} β
ββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββ
β Networks (3)
βββββββββββββββββ¬βββββββββ¬ββββββββββββββββββββββββββββ
β name β tags β isBoundToConfigTemplate β
βββββββββββββββββΌβββββββββΌββββββββββββββββββββββββββββ€
β Lab-MX68 β [] β False β
βββββββββββββββββΌβββββββββΌββββββββββββββββββββββββββββ€
β hobo-employee β [] β False β
βββββββββββββββββΌβββββββββΌββββββββββββββββββββββββββββ€
β hobo-thomas β [] β False β
βββββββββββββββββ΄βββββββββ΄ββββββββββββββββββββββββββββ
β Devices (2)
βββββββββββββββ¬βββββββββββββ¬ββββββββββββββββββ
β name β model β firmware β
βββββββββββββββΌβββββββββββββΌββββββββββββββββββ€
β lab-mr46-1 β MR46 β wireless-29-5-1 β
βββββββββββββββΌβββββββββββββΌββββββββββββββββββ€
β lab-ms390-1 β MS390-48UX β cs-15-21-1 β
βββββββββββββββ΄βββββββββββββ΄ββββββββββββββββββ
This repository is licensed under the MIT License.