netbox-cisco-ise 0.1.0__py3-none-any.whl
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.
- netbox_cisco_ise/__init__.py +57 -0
- netbox_cisco_ise/ise_client.py +457 -0
- netbox_cisco_ise/navigation.py +22 -0
- netbox_cisco_ise/urls.py +12 -0
- netbox_cisco_ise/views.py +251 -0
- netbox_cisco_ise-0.1.0.dist-info/METADATA +279 -0
- netbox_cisco_ise-0.1.0.dist-info/RECORD +10 -0
- netbox_cisco_ise-0.1.0.dist-info/WHEEL +5 -0
- netbox_cisco_ise-0.1.0.dist-info/licenses/LICENSE +190 -0
- netbox_cisco_ise-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
NetBox Cisco ISE Plugin
|
|
3
|
+
|
|
4
|
+
Display Cisco Identity Services Engine (ISE) endpoint and NAD information in Device detail pages.
|
|
5
|
+
Shows endpoint identity, profiling data, active session status, and network access device details.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from netbox.plugins import PluginConfig
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CiscoISEConfig(PluginConfig):
|
|
14
|
+
"""Plugin configuration for NetBox Cisco ISE integration."""
|
|
15
|
+
|
|
16
|
+
name = "netbox_cisco_ise"
|
|
17
|
+
verbose_name = "Cisco ISE"
|
|
18
|
+
description = "Display Cisco ISE endpoint and NAD information in device pages"
|
|
19
|
+
version = __version__
|
|
20
|
+
author = "sieteunoseis"
|
|
21
|
+
author_email = "jeremy.worden@gmail.com"
|
|
22
|
+
base_url = "cisco-ise"
|
|
23
|
+
min_version = "4.0.0"
|
|
24
|
+
max_version = "4.99"
|
|
25
|
+
|
|
26
|
+
# Required settings - plugin won't load without these
|
|
27
|
+
required_settings = []
|
|
28
|
+
|
|
29
|
+
# Default configuration values
|
|
30
|
+
default_settings = {
|
|
31
|
+
# ISE Connection Settings
|
|
32
|
+
"ise_url": "", # e.g., "https://ise.example.com"
|
|
33
|
+
"ise_username": "", # ERS Admin username
|
|
34
|
+
"ise_password": "", # ERS Admin password
|
|
35
|
+
"timeout": 30, # API timeout in seconds
|
|
36
|
+
"cache_timeout": 60, # Cache results for 60 seconds
|
|
37
|
+
"verify_ssl": False, # Skip SSL verification for self-signed certs
|
|
38
|
+
# Device mappings - determines which devices show ISE tab and lookup method
|
|
39
|
+
# Format: list of dicts with manufacturer (regex), device_type (regex, optional), lookup method
|
|
40
|
+
#
|
|
41
|
+
# lookup types:
|
|
42
|
+
# "endpoint" - MAC address lookup (for wireless clients, phones, badges)
|
|
43
|
+
# "nad" - Network Access Device lookup (for switches, routers, WLCs)
|
|
44
|
+
#
|
|
45
|
+
# Example:
|
|
46
|
+
# "device_mappings": [
|
|
47
|
+
# {"manufacturer": "cisco", "lookup": "nad"}, # Cisco network devices as NADs
|
|
48
|
+
# {"manufacturer": "vocera", "lookup": "endpoint"}, # Vocera badges by MAC
|
|
49
|
+
# {"manufacturer": "cisco", "device_type": ".*phone.*", "lookup": "endpoint"}, # Cisco phones by MAC
|
|
50
|
+
# ]
|
|
51
|
+
"device_mappings": [
|
|
52
|
+
{"manufacturer": r"cisco", "lookup": "nad"}, # Default: Cisco devices as NADs
|
|
53
|
+
],
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
config = CiscoISEConfig
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Cisco ISE API Client
|
|
3
|
+
|
|
4
|
+
Handles authentication and API calls to Cisco Identity Services Engine (ISE).
|
|
5
|
+
Supports both ERS API (configuration data) and Monitoring API (session data).
|
|
6
|
+
|
|
7
|
+
ISE API Overview:
|
|
8
|
+
- ERS API (port 9060 or 443): Configuration data - endpoints, NADs, groups, profiles
|
|
9
|
+
- Monitoring API (port 443): Real-time session data
|
|
10
|
+
|
|
11
|
+
Authentication: Basic Auth (username:password) for all API calls
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import logging
|
|
15
|
+
from typing import Any, Dict, List, Optional
|
|
16
|
+
|
|
17
|
+
import requests
|
|
18
|
+
from django.conf import settings
|
|
19
|
+
from django.core.cache import cache
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ISEClient:
|
|
25
|
+
"""Client for interacting with Cisco ISE ERS and Monitoring APIs."""
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
url: str,
|
|
30
|
+
username: str,
|
|
31
|
+
password: str,
|
|
32
|
+
timeout: int = 30,
|
|
33
|
+
verify_ssl: bool = False,
|
|
34
|
+
):
|
|
35
|
+
"""
|
|
36
|
+
Initialize the ISE client.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
url: Base URL for ISE (e.g., https://ise.example.com)
|
|
40
|
+
username: ERS Admin username
|
|
41
|
+
password: ERS Admin password
|
|
42
|
+
timeout: API request timeout in seconds
|
|
43
|
+
verify_ssl: Whether to verify SSL certificates
|
|
44
|
+
"""
|
|
45
|
+
self.base_url = url.rstrip("/")
|
|
46
|
+
self.auth = (username, password)
|
|
47
|
+
self.timeout = timeout
|
|
48
|
+
self.verify_ssl = verify_ssl
|
|
49
|
+
|
|
50
|
+
# Standard ERS API headers
|
|
51
|
+
self.ers_headers = {
|
|
52
|
+
"Accept": "application/json",
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
def _make_ers_request(
|
|
57
|
+
self,
|
|
58
|
+
endpoint: str,
|
|
59
|
+
method: str = "GET",
|
|
60
|
+
params: Optional[Dict] = None,
|
|
61
|
+
data: Optional[Dict] = None,
|
|
62
|
+
) -> Dict[str, Any]:
|
|
63
|
+
"""
|
|
64
|
+
Make authenticated ERS API request.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
endpoint: API endpoint path (e.g., /endpoint, /networkdevice)
|
|
68
|
+
method: HTTP method (GET, POST, PUT, DELETE)
|
|
69
|
+
params: Query parameters
|
|
70
|
+
data: Request body data
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
dict with response data or error
|
|
74
|
+
"""
|
|
75
|
+
try:
|
|
76
|
+
url = f"{self.base_url}/ers/config{endpoint}"
|
|
77
|
+
response = requests.request(
|
|
78
|
+
method=method,
|
|
79
|
+
url=url,
|
|
80
|
+
auth=self.auth,
|
|
81
|
+
headers=self.ers_headers,
|
|
82
|
+
params=params,
|
|
83
|
+
json=data,
|
|
84
|
+
verify=self.verify_ssl,
|
|
85
|
+
timeout=self.timeout,
|
|
86
|
+
)
|
|
87
|
+
response.raise_for_status()
|
|
88
|
+
return response.json() if response.content else {}
|
|
89
|
+
except requests.exceptions.HTTPError as e:
|
|
90
|
+
status_code = e.response.status_code if e.response else "Unknown"
|
|
91
|
+
error_text = e.response.text[:200] if e.response else str(e)
|
|
92
|
+
logger.error(f"ISE ERS HTTP error: {status_code} - {error_text}")
|
|
93
|
+
return {"error": f"HTTP {status_code}: {error_text}"}
|
|
94
|
+
except requests.exceptions.RequestException as e:
|
|
95
|
+
logger.error(f"ISE ERS request error: {e}")
|
|
96
|
+
return {"error": str(e)}
|
|
97
|
+
|
|
98
|
+
def _make_monitoring_request(self, endpoint: str) -> Dict[str, Any]:
|
|
99
|
+
"""
|
|
100
|
+
Make authenticated Monitoring API request.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
endpoint: API endpoint path (e.g., /Session/MACAddress/{mac})
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
dict with response data or error
|
|
107
|
+
"""
|
|
108
|
+
try:
|
|
109
|
+
url = f"{self.base_url}/admin/API/mnt{endpoint}"
|
|
110
|
+
response = requests.get(
|
|
111
|
+
url,
|
|
112
|
+
auth=self.auth,
|
|
113
|
+
headers=self.ers_headers,
|
|
114
|
+
verify=self.verify_ssl,
|
|
115
|
+
timeout=self.timeout,
|
|
116
|
+
)
|
|
117
|
+
response.raise_for_status()
|
|
118
|
+
return response.json() if response.content else {}
|
|
119
|
+
except requests.exceptions.HTTPError as e:
|
|
120
|
+
status_code = e.response.status_code if e.response else "Unknown"
|
|
121
|
+
# 404 is expected when no active session exists
|
|
122
|
+
if status_code == 404:
|
|
123
|
+
return {"error": "No active session found", "not_found": True}
|
|
124
|
+
logger.error(f"ISE Monitoring HTTP error: {status_code}")
|
|
125
|
+
return {"error": f"HTTP {status_code}"}
|
|
126
|
+
except requests.exceptions.RequestException as e:
|
|
127
|
+
logger.error(f"ISE Monitoring request error: {e}")
|
|
128
|
+
return {"error": str(e)}
|
|
129
|
+
|
|
130
|
+
# =========================================================================
|
|
131
|
+
# Endpoint APIs (ERS)
|
|
132
|
+
# =========================================================================
|
|
133
|
+
|
|
134
|
+
def get_endpoint_by_mac(self, mac_address: str) -> Dict[str, Any]:
|
|
135
|
+
"""
|
|
136
|
+
Get endpoint details by MAC address.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
mac_address: MAC address in any common format
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
dict with endpoint details or error
|
|
143
|
+
"""
|
|
144
|
+
mac = self._normalize_mac(mac_address)
|
|
145
|
+
|
|
146
|
+
# Check cache
|
|
147
|
+
cache_key = f"ise_endpoint_{mac}"
|
|
148
|
+
cached = cache.get(cache_key)
|
|
149
|
+
if cached:
|
|
150
|
+
cached["cached"] = True
|
|
151
|
+
return cached
|
|
152
|
+
|
|
153
|
+
# Query ISE ERS API with filter
|
|
154
|
+
result = self._make_ers_request("/endpoint", params={"filter": f"mac.EQ.{mac}"})
|
|
155
|
+
|
|
156
|
+
if "error" in result:
|
|
157
|
+
return result
|
|
158
|
+
|
|
159
|
+
# Parse response - ISE returns SearchResult with resources
|
|
160
|
+
search_result = result.get("SearchResult", {})
|
|
161
|
+
resources = search_result.get("resources", [])
|
|
162
|
+
|
|
163
|
+
if not resources:
|
|
164
|
+
return {"error": f"Endpoint not found for MAC: {mac}", "not_found": True}
|
|
165
|
+
|
|
166
|
+
# Get full endpoint details
|
|
167
|
+
endpoint_id = resources[0].get("id")
|
|
168
|
+
endpoint_result = self._make_ers_request(f"/endpoint/{endpoint_id}")
|
|
169
|
+
|
|
170
|
+
if "error" in endpoint_result:
|
|
171
|
+
return endpoint_result
|
|
172
|
+
|
|
173
|
+
endpoint = endpoint_result.get("ERSEndPoint", {})
|
|
174
|
+
|
|
175
|
+
endpoint_info = {
|
|
176
|
+
"id": endpoint.get("id"),
|
|
177
|
+
"mac_address": endpoint.get("mac"),
|
|
178
|
+
"profile_name": endpoint.get("profileName"),
|
|
179
|
+
"profile_id": endpoint.get("profileId"),
|
|
180
|
+
"group_name": endpoint.get("groupName"),
|
|
181
|
+
"group_id": endpoint.get("groupId"),
|
|
182
|
+
"static_group_assignment": endpoint.get("staticGroupAssignment", False),
|
|
183
|
+
"static_profile_assignment": endpoint.get("staticProfileAssignment", False),
|
|
184
|
+
"portal_user": endpoint.get("portalUser"),
|
|
185
|
+
"identity_store": endpoint.get("identityStore"),
|
|
186
|
+
"identity_store_id": endpoint.get("identityStoreId"),
|
|
187
|
+
"custom_attributes": endpoint.get("customAttributes", {}),
|
|
188
|
+
"description": endpoint.get("description"),
|
|
189
|
+
"cached": False,
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
# Cache result
|
|
193
|
+
cache_timeout = self._get_cache_timeout()
|
|
194
|
+
cache.set(cache_key, endpoint_info, cache_timeout)
|
|
195
|
+
|
|
196
|
+
return endpoint_info
|
|
197
|
+
|
|
198
|
+
def get_active_session_by_mac(self, mac_address: str) -> Dict[str, Any]:
|
|
199
|
+
"""
|
|
200
|
+
Get active session for endpoint by MAC address.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
mac_address: MAC address in any common format
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
dict with session details or error/not connected status
|
|
207
|
+
"""
|
|
208
|
+
mac = self._normalize_mac(mac_address)
|
|
209
|
+
|
|
210
|
+
cache_key = f"ise_session_{mac}"
|
|
211
|
+
cached = cache.get(cache_key)
|
|
212
|
+
if cached:
|
|
213
|
+
cached["cached"] = True
|
|
214
|
+
return cached
|
|
215
|
+
|
|
216
|
+
result = self._make_monitoring_request(f"/Session/MACAddress/{mac}")
|
|
217
|
+
|
|
218
|
+
if "error" in result:
|
|
219
|
+
if result.get("not_found"):
|
|
220
|
+
return {"connected": False, "error": "No active session found"}
|
|
221
|
+
return result
|
|
222
|
+
|
|
223
|
+
# Handle different response structures
|
|
224
|
+
session = result.get("activeSession") or result.get("session", {})
|
|
225
|
+
|
|
226
|
+
if not session:
|
|
227
|
+
return {"connected": False, "error": "No active session found"}
|
|
228
|
+
|
|
229
|
+
session_info = {
|
|
230
|
+
"connected": True,
|
|
231
|
+
"session_id": session.get("session_id") or session.get("acs_session_id"),
|
|
232
|
+
"user_name": session.get("user_name"),
|
|
233
|
+
"calling_station_id": session.get("calling_station_id"),
|
|
234
|
+
"nas_ip_address": session.get("nas_ip_address"),
|
|
235
|
+
"nas_port_id": session.get("nas_port_id"),
|
|
236
|
+
"nas_port_type": session.get("nas_port_type"),
|
|
237
|
+
"framed_ip_address": session.get("framed_ip_address"),
|
|
238
|
+
"framed_ipv6_address": session.get("framed_ipv6_address"),
|
|
239
|
+
"audit_session_id": session.get("audit_session_id"),
|
|
240
|
+
"acct_session_id": session.get("acct_session_id"),
|
|
241
|
+
"acct_session_time": session.get("acct_session_time"),
|
|
242
|
+
"authorization_profile": session.get("selected_authorization_profile"),
|
|
243
|
+
"posture_status": session.get("posture_status"),
|
|
244
|
+
"security_group": session.get("security_group"),
|
|
245
|
+
"vlan": session.get("vlan"),
|
|
246
|
+
"ssid": session.get("ssid"),
|
|
247
|
+
"auth_method": session.get("authentication_method"),
|
|
248
|
+
"network_device_name": session.get("network_device_name"),
|
|
249
|
+
"acs_server": session.get("acs_server"),
|
|
250
|
+
"cached": False,
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
cache_timeout = self._get_cache_timeout()
|
|
254
|
+
cache.set(cache_key, session_info, cache_timeout)
|
|
255
|
+
|
|
256
|
+
return session_info
|
|
257
|
+
|
|
258
|
+
# =========================================================================
|
|
259
|
+
# Network Device (NAD) APIs (ERS)
|
|
260
|
+
# =========================================================================
|
|
261
|
+
|
|
262
|
+
def get_network_device_by_ip(self, ip_address: str) -> Dict[str, Any]:
|
|
263
|
+
"""
|
|
264
|
+
Get NAD details by IP address.
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
ip_address: Management IP address
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
dict with NAD details or error
|
|
271
|
+
"""
|
|
272
|
+
cache_key = f"ise_nad_ip_{ip_address}"
|
|
273
|
+
cached = cache.get(cache_key)
|
|
274
|
+
if cached:
|
|
275
|
+
cached["cached"] = True
|
|
276
|
+
return cached
|
|
277
|
+
|
|
278
|
+
result = self._make_ers_request("/networkdevice", params={"filter": f"ipaddress.EQ.{ip_address}"})
|
|
279
|
+
|
|
280
|
+
return self._process_nad_result(result, cache_key)
|
|
281
|
+
|
|
282
|
+
def get_network_device_by_name(self, name: str) -> Dict[str, Any]:
|
|
283
|
+
"""
|
|
284
|
+
Get NAD details by device name.
|
|
285
|
+
|
|
286
|
+
Args:
|
|
287
|
+
name: Device name (supports partial match)
|
|
288
|
+
|
|
289
|
+
Returns:
|
|
290
|
+
dict with NAD details or error
|
|
291
|
+
"""
|
|
292
|
+
cache_key = f"ise_nad_name_{name}"
|
|
293
|
+
cached = cache.get(cache_key)
|
|
294
|
+
if cached:
|
|
295
|
+
cached["cached"] = True
|
|
296
|
+
return cached
|
|
297
|
+
|
|
298
|
+
result = self._make_ers_request("/networkdevice", params={"filter": f"name.CONTAINS.{name}"})
|
|
299
|
+
|
|
300
|
+
return self._process_nad_result(result, cache_key)
|
|
301
|
+
|
|
302
|
+
def _process_nad_result(self, result: Dict, cache_key: str) -> Dict[str, Any]:
|
|
303
|
+
"""Process NAD search result and fetch full details."""
|
|
304
|
+
if "error" in result:
|
|
305
|
+
return result
|
|
306
|
+
|
|
307
|
+
search_result = result.get("SearchResult", {})
|
|
308
|
+
resources = search_result.get("resources", [])
|
|
309
|
+
|
|
310
|
+
if not resources:
|
|
311
|
+
return {"error": "Network device not found in ISE", "not_found": True, "is_nad": False}
|
|
312
|
+
|
|
313
|
+
# Get full NAD details
|
|
314
|
+
nad_id = resources[0].get("id")
|
|
315
|
+
nad_result = self._make_ers_request(f"/networkdevice/{nad_id}")
|
|
316
|
+
|
|
317
|
+
if "error" in nad_result:
|
|
318
|
+
return nad_result
|
|
319
|
+
|
|
320
|
+
nad = nad_result.get("NetworkDevice", {})
|
|
321
|
+
|
|
322
|
+
# Parse network device groups
|
|
323
|
+
groups = nad.get("NetworkDeviceGroupList", [])
|
|
324
|
+
parsed_groups = self._parse_device_groups(groups)
|
|
325
|
+
|
|
326
|
+
# Parse IP addresses
|
|
327
|
+
ip_list = nad.get("NetworkDeviceIPList", [])
|
|
328
|
+
ip_addresses = [ip.get("ipaddress") for ip in ip_list if ip.get("ipaddress")]
|
|
329
|
+
|
|
330
|
+
# Parse authentication settings
|
|
331
|
+
auth_settings = nad.get("authenticationSettings", {})
|
|
332
|
+
tacacs_settings = nad.get("tacacsSettings", {})
|
|
333
|
+
snmp_settings = nad.get("snmpsettings", {})
|
|
334
|
+
trustsec_settings = nad.get("trustsecsettings", {})
|
|
335
|
+
|
|
336
|
+
nad_info = {
|
|
337
|
+
"is_nad": True,
|
|
338
|
+
"id": nad.get("id"),
|
|
339
|
+
"name": nad.get("name"),
|
|
340
|
+
"description": nad.get("description"),
|
|
341
|
+
"profile_name": nad.get("profileName"),
|
|
342
|
+
"model_name": nad.get("modelName"),
|
|
343
|
+
"software_version": nad.get("softwareVersion"),
|
|
344
|
+
"ip_addresses": ip_addresses,
|
|
345
|
+
"groups": parsed_groups,
|
|
346
|
+
"authentication_settings": {
|
|
347
|
+
"radius_enabled": bool(auth_settings.get("radiusSharedSecret")),
|
|
348
|
+
"enable_key_wrap": auth_settings.get("enableKeyWrap", False),
|
|
349
|
+
"dtls_required": auth_settings.get("dtlsRequired", False),
|
|
350
|
+
},
|
|
351
|
+
"tacacs_settings": {
|
|
352
|
+
"enabled": bool(tacacs_settings.get("sharedSecret")),
|
|
353
|
+
"connect_mode_options": tacacs_settings.get("connectModeOptions"),
|
|
354
|
+
},
|
|
355
|
+
"snmp_settings": {
|
|
356
|
+
"version": snmp_settings.get("snmpVersion"),
|
|
357
|
+
"ro_community": bool(snmp_settings.get("roCommunity")),
|
|
358
|
+
"polling_interval": snmp_settings.get("pollingInterval"),
|
|
359
|
+
},
|
|
360
|
+
"trustsec_enabled": bool(trustsec_settings.get("deviceAuthenticationSettings", {}).get("sgaDeviceId")),
|
|
361
|
+
"coA_port": nad.get("coaPort"),
|
|
362
|
+
"cached": False,
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
cache_timeout = self._get_cache_timeout()
|
|
366
|
+
cache.set(cache_key, nad_info, cache_timeout)
|
|
367
|
+
|
|
368
|
+
return nad_info
|
|
369
|
+
|
|
370
|
+
def _parse_device_groups(self, groups: List[str]) -> Dict[str, str]:
|
|
371
|
+
"""
|
|
372
|
+
Parse ISE device group strings into categorized dict.
|
|
373
|
+
|
|
374
|
+
ISE group format: "Category#All Category#Value" or "Location#All Locations#Building-A"
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
groups: List of group strings from ISE
|
|
378
|
+
|
|
379
|
+
Returns:
|
|
380
|
+
dict mapping category to value
|
|
381
|
+
"""
|
|
382
|
+
parsed = {}
|
|
383
|
+
for group in groups:
|
|
384
|
+
parts = group.split("#")
|
|
385
|
+
if len(parts) >= 2:
|
|
386
|
+
category = parts[0]
|
|
387
|
+
value = parts[-1] # Last part is the actual value
|
|
388
|
+
parsed[category] = value
|
|
389
|
+
return parsed
|
|
390
|
+
|
|
391
|
+
# =========================================================================
|
|
392
|
+
# Utility Methods
|
|
393
|
+
# =========================================================================
|
|
394
|
+
|
|
395
|
+
def _normalize_mac(self, mac: str) -> str:
|
|
396
|
+
"""
|
|
397
|
+
Normalize MAC address to XX:XX:XX:XX:XX:XX format (ISE standard).
|
|
398
|
+
|
|
399
|
+
Args:
|
|
400
|
+
mac: MAC address in any common format
|
|
401
|
+
|
|
402
|
+
Returns:
|
|
403
|
+
MAC address in XX:XX:XX:XX:XX:XX uppercase format
|
|
404
|
+
"""
|
|
405
|
+
mac_clean = mac.replace(":", "").replace("-", "").replace(".", "").lower()
|
|
406
|
+
if len(mac_clean) == 12:
|
|
407
|
+
return ":".join(mac_clean[i : i + 2] for i in range(0, 12, 2)).upper()
|
|
408
|
+
return mac.upper()
|
|
409
|
+
|
|
410
|
+
def _get_cache_timeout(self) -> int:
|
|
411
|
+
"""Get cache timeout from plugin config."""
|
|
412
|
+
config = settings.PLUGINS_CONFIG.get("netbox_cisco_ise", {})
|
|
413
|
+
return config.get("cache_timeout", 60)
|
|
414
|
+
|
|
415
|
+
def test_connection(self) -> Dict[str, Any]:
|
|
416
|
+
"""
|
|
417
|
+
Test connection to ISE by fetching network device count.
|
|
418
|
+
|
|
419
|
+
Returns:
|
|
420
|
+
dict with success status and message
|
|
421
|
+
"""
|
|
422
|
+
result = self._make_ers_request("/networkdevice", params={"size": 1})
|
|
423
|
+
|
|
424
|
+
if "error" in result:
|
|
425
|
+
return {"success": False, "error": result["error"]}
|
|
426
|
+
|
|
427
|
+
total = result.get("SearchResult", {}).get("total", 0)
|
|
428
|
+
return {
|
|
429
|
+
"success": True,
|
|
430
|
+
"message": f"Connected successfully. {total} network device(s) in ISE.",
|
|
431
|
+
"nad_count": total,
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
def get_client() -> Optional[ISEClient]:
|
|
436
|
+
"""
|
|
437
|
+
Get configured ISE client instance from plugin settings.
|
|
438
|
+
|
|
439
|
+
Returns:
|
|
440
|
+
ISEClient instance or None if not configured
|
|
441
|
+
"""
|
|
442
|
+
config = settings.PLUGINS_CONFIG.get("netbox_cisco_ise", {})
|
|
443
|
+
|
|
444
|
+
url = config.get("ise_url", "")
|
|
445
|
+
username = config.get("ise_username", "")
|
|
446
|
+
password = config.get("ise_password", "")
|
|
447
|
+
|
|
448
|
+
if not url or not username or not password:
|
|
449
|
+
return None
|
|
450
|
+
|
|
451
|
+
return ISEClient(
|
|
452
|
+
url=url,
|
|
453
|
+
username=username,
|
|
454
|
+
password=password,
|
|
455
|
+
timeout=config.get("timeout", 30),
|
|
456
|
+
verify_ssl=config.get("verify_ssl", False),
|
|
457
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Navigation menu items for NetBox Cisco ISE Plugin
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from netbox.plugins import PluginMenu, PluginMenuItem
|
|
6
|
+
|
|
7
|
+
menu = PluginMenu(
|
|
8
|
+
label="Cisco ISE",
|
|
9
|
+
groups=(
|
|
10
|
+
(
|
|
11
|
+
"Settings",
|
|
12
|
+
(
|
|
13
|
+
PluginMenuItem(
|
|
14
|
+
link="plugins:netbox_cisco_ise:settings",
|
|
15
|
+
link_text="Configuration",
|
|
16
|
+
permissions=["dcim.view_device"],
|
|
17
|
+
),
|
|
18
|
+
),
|
|
19
|
+
),
|
|
20
|
+
),
|
|
21
|
+
icon_class="mdi mdi-shield-account",
|
|
22
|
+
)
|
netbox_cisco_ise/urls.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
URL routing for NetBox Cisco ISE Plugin
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from django.urls import path
|
|
6
|
+
|
|
7
|
+
from .views import ISESettingsView, TestConnectionView
|
|
8
|
+
|
|
9
|
+
urlpatterns = [
|
|
10
|
+
path("settings/", ISESettingsView.as_view(), name="settings"),
|
|
11
|
+
path("test-connection/", TestConnectionView.as_view(), name="test_connection"),
|
|
12
|
+
]
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Views for NetBox Cisco ISE Plugin
|
|
3
|
+
|
|
4
|
+
Registers custom tabs on Device detail views to show ISE endpoint/NAD info.
|
|
5
|
+
Provides settings configuration UI.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import re
|
|
9
|
+
|
|
10
|
+
from dcim.models import Device
|
|
11
|
+
from django.conf import settings
|
|
12
|
+
from django.http import JsonResponse
|
|
13
|
+
from django.shortcuts import render
|
|
14
|
+
from django.views import View
|
|
15
|
+
from netbox.views import generic
|
|
16
|
+
from utilities.views import ViewTab, register_model_view
|
|
17
|
+
|
|
18
|
+
from .ise_client import get_client
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def is_valid_mac(value):
|
|
22
|
+
"""Check if a value looks like a MAC address."""
|
|
23
|
+
if not value:
|
|
24
|
+
return False
|
|
25
|
+
cleaned = re.sub(r"[:\-\.]", "", value.lower())
|
|
26
|
+
return bool(re.match(r"^[0-9a-f]{12}$", cleaned))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_device_mac(device):
|
|
30
|
+
"""Get the first valid MAC address from device interfaces."""
|
|
31
|
+
for iface in device.interfaces.all():
|
|
32
|
+
if iface.mac_address and is_valid_mac(str(iface.mac_address)):
|
|
33
|
+
return str(iface.mac_address)
|
|
34
|
+
return None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_device_lookup_method(device):
|
|
38
|
+
"""
|
|
39
|
+
Determine the lookup method for a device based on configured mappings.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
tuple: (lookup_method, has_required_data)
|
|
43
|
+
- lookup_method: "endpoint", "nad", or None if no mapping matches
|
|
44
|
+
- has_required_data: True if device has the data needed for lookup
|
|
45
|
+
"""
|
|
46
|
+
config = settings.PLUGINS_CONFIG.get("netbox_cisco_ise", {})
|
|
47
|
+
mappings = config.get("device_mappings", [])
|
|
48
|
+
|
|
49
|
+
if not device.device_type:
|
|
50
|
+
return None, False
|
|
51
|
+
|
|
52
|
+
# Get device info for matching
|
|
53
|
+
manufacturer = device.device_type.manufacturer
|
|
54
|
+
manufacturer_slug = manufacturer.slug.lower() if manufacturer and manufacturer.slug else ""
|
|
55
|
+
manufacturer_name = manufacturer.name.lower() if manufacturer and manufacturer.name else ""
|
|
56
|
+
device_type_slug = device.device_type.slug.lower() if device.device_type.slug else ""
|
|
57
|
+
device_type_model = device.device_type.model.lower() if device.device_type.model else ""
|
|
58
|
+
|
|
59
|
+
# Check each mapping
|
|
60
|
+
for mapping in mappings:
|
|
61
|
+
manufacturer_pattern = mapping.get("manufacturer", "").lower()
|
|
62
|
+
device_type_pattern = mapping.get("device_type", "").lower()
|
|
63
|
+
lookup = mapping.get("lookup", "nad")
|
|
64
|
+
|
|
65
|
+
# Check manufacturer match (against both slug and name)
|
|
66
|
+
manufacturer_match = False
|
|
67
|
+
if manufacturer_pattern:
|
|
68
|
+
try:
|
|
69
|
+
if re.search(manufacturer_pattern, manufacturer_slug, re.IGNORECASE) or re.search(
|
|
70
|
+
manufacturer_pattern, manufacturer_name, re.IGNORECASE
|
|
71
|
+
):
|
|
72
|
+
manufacturer_match = True
|
|
73
|
+
except re.error:
|
|
74
|
+
if manufacturer_pattern in manufacturer_slug or manufacturer_pattern in manufacturer_name:
|
|
75
|
+
manufacturer_match = True
|
|
76
|
+
|
|
77
|
+
if not manufacturer_match:
|
|
78
|
+
continue
|
|
79
|
+
|
|
80
|
+
# Check device_type match if specified
|
|
81
|
+
if device_type_pattern:
|
|
82
|
+
device_type_match = False
|
|
83
|
+
try:
|
|
84
|
+
if re.search(device_type_pattern, device_type_slug, re.IGNORECASE) or re.search(
|
|
85
|
+
device_type_pattern, device_type_model, re.IGNORECASE
|
|
86
|
+
):
|
|
87
|
+
device_type_match = True
|
|
88
|
+
except re.error:
|
|
89
|
+
if device_type_pattern in device_type_slug or device_type_pattern in device_type_model:
|
|
90
|
+
device_type_match = True
|
|
91
|
+
|
|
92
|
+
if not device_type_match:
|
|
93
|
+
continue
|
|
94
|
+
|
|
95
|
+
# Mapping matches! Return lookup type and check if device has required data
|
|
96
|
+
if lookup == "endpoint":
|
|
97
|
+
# Endpoint lookup - requires MAC address
|
|
98
|
+
mac = get_device_mac(device)
|
|
99
|
+
return "endpoint", mac is not None
|
|
100
|
+
else:
|
|
101
|
+
# NAD lookup - requires hostname or IP
|
|
102
|
+
has_hostname = bool(device.name)
|
|
103
|
+
has_ip = device.primary_ip4 is not None or device.primary_ip6 is not None
|
|
104
|
+
return "nad", (has_hostname or has_ip)
|
|
105
|
+
|
|
106
|
+
return None, False
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def should_show_ise_tab(device):
|
|
110
|
+
"""
|
|
111
|
+
Determine if the ISE tab should be visible for this device.
|
|
112
|
+
|
|
113
|
+
Shows tab if device matches any configured device_mapping and has
|
|
114
|
+
the required data for the lookup method.
|
|
115
|
+
"""
|
|
116
|
+
lookup_method, has_data = get_device_lookup_method(device)
|
|
117
|
+
return lookup_method is not None and has_data
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@register_model_view(Device, name="cisco_ise", path="cisco-ise")
|
|
121
|
+
class DeviceISEView(generic.ObjectView):
|
|
122
|
+
"""Display Cisco ISE endpoint/NAD details for a Device."""
|
|
123
|
+
|
|
124
|
+
queryset = Device.objects.all()
|
|
125
|
+
template_name = "netbox_cisco_ise/endpoint_tab.html"
|
|
126
|
+
|
|
127
|
+
tab = ViewTab(
|
|
128
|
+
label="Cisco ISE",
|
|
129
|
+
weight=9001,
|
|
130
|
+
permission="dcim.view_device",
|
|
131
|
+
hide_if_empty=False,
|
|
132
|
+
visible=should_show_ise_tab,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
def get(self, request, pk):
|
|
136
|
+
"""Handle GET request for the ISE tab."""
|
|
137
|
+
device = Device.objects.get(pk=pk)
|
|
138
|
+
|
|
139
|
+
client = get_client()
|
|
140
|
+
config = settings.PLUGINS_CONFIG.get("netbox_cisco_ise", {})
|
|
141
|
+
|
|
142
|
+
ise_data = {}
|
|
143
|
+
session_data = {}
|
|
144
|
+
error = None
|
|
145
|
+
|
|
146
|
+
if not client:
|
|
147
|
+
error = "Cisco ISE not configured. Configure the plugin in NetBox settings."
|
|
148
|
+
else:
|
|
149
|
+
lookup_method, has_data = get_device_lookup_method(device)
|
|
150
|
+
|
|
151
|
+
if lookup_method == "endpoint":
|
|
152
|
+
# Endpoint lookup by MAC address
|
|
153
|
+
mac_address = get_device_mac(device)
|
|
154
|
+
if mac_address:
|
|
155
|
+
ise_data = client.get_endpoint_by_mac(mac_address)
|
|
156
|
+
if "error" not in ise_data:
|
|
157
|
+
# Also get session data for connected endpoints
|
|
158
|
+
session_data = client.get_active_session_by_mac(mac_address)
|
|
159
|
+
if "error" in session_data and session_data.get("connected") is False:
|
|
160
|
+
# Not connected is fine, just no active session
|
|
161
|
+
pass
|
|
162
|
+
else:
|
|
163
|
+
error = ise_data.get("error")
|
|
164
|
+
ise_data = {}
|
|
165
|
+
else:
|
|
166
|
+
error = "No MAC address found on device interfaces."
|
|
167
|
+
|
|
168
|
+
elif lookup_method == "nad":
|
|
169
|
+
# NAD lookup - try IP first, then hostname
|
|
170
|
+
management_ip = None
|
|
171
|
+
if device.primary_ip4:
|
|
172
|
+
management_ip = str(device.primary_ip4.address.ip)
|
|
173
|
+
elif device.primary_ip6:
|
|
174
|
+
management_ip = str(device.primary_ip6.address.ip)
|
|
175
|
+
|
|
176
|
+
if management_ip:
|
|
177
|
+
ise_data = client.get_network_device_by_ip(management_ip)
|
|
178
|
+
|
|
179
|
+
# If IP lookup failed or no IP, try hostname
|
|
180
|
+
if ("error" in ise_data or not ise_data) and device.name:
|
|
181
|
+
ise_data = client.get_network_device_by_name(device.name)
|
|
182
|
+
|
|
183
|
+
if "error" in ise_data:
|
|
184
|
+
error = ise_data.get("error")
|
|
185
|
+
ise_data = {}
|
|
186
|
+
else:
|
|
187
|
+
error = "Device doesn't match any configured device_mappings."
|
|
188
|
+
|
|
189
|
+
# Get ISE URL for external links
|
|
190
|
+
ise_url = config.get("ise_url", "").rstrip("/")
|
|
191
|
+
|
|
192
|
+
# Choose template based on lookup type
|
|
193
|
+
if ise_data.get("is_nad"):
|
|
194
|
+
template = "netbox_cisco_ise/nad_tab.html"
|
|
195
|
+
else:
|
|
196
|
+
template = self.template_name
|
|
197
|
+
|
|
198
|
+
return render(
|
|
199
|
+
request,
|
|
200
|
+
template,
|
|
201
|
+
{
|
|
202
|
+
"object": device,
|
|
203
|
+
"tab": self.tab,
|
|
204
|
+
"ise_data": ise_data,
|
|
205
|
+
"session_data": session_data,
|
|
206
|
+
"error": error,
|
|
207
|
+
"ise_url": ise_url,
|
|
208
|
+
},
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class ISESettingsView(View):
|
|
213
|
+
"""View for displaying ISE plugin settings."""
|
|
214
|
+
|
|
215
|
+
template_name = "netbox_cisco_ise/settings.html"
|
|
216
|
+
|
|
217
|
+
def get(self, request):
|
|
218
|
+
"""Display current configuration."""
|
|
219
|
+
config = settings.PLUGINS_CONFIG.get("netbox_cisco_ise", {})
|
|
220
|
+
|
|
221
|
+
# Mask password for display
|
|
222
|
+
display_config = config.copy()
|
|
223
|
+
if display_config.get("ise_password"):
|
|
224
|
+
display_config["ise_password"] = "********"
|
|
225
|
+
|
|
226
|
+
return render(
|
|
227
|
+
request,
|
|
228
|
+
self.template_name,
|
|
229
|
+
{
|
|
230
|
+
"config": display_config,
|
|
231
|
+
},
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class TestConnectionView(View):
|
|
236
|
+
"""Test connection to ISE API."""
|
|
237
|
+
|
|
238
|
+
def post(self, request):
|
|
239
|
+
"""Test ISE connection and return result."""
|
|
240
|
+
client = get_client()
|
|
241
|
+
if not client:
|
|
242
|
+
return JsonResponse(
|
|
243
|
+
{"success": False, "error": "ISE not configured"},
|
|
244
|
+
status=400,
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
result = client.test_connection()
|
|
248
|
+
if not result.get("success"):
|
|
249
|
+
return JsonResponse(result, status=400)
|
|
250
|
+
|
|
251
|
+
return JsonResponse(result)
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netbox-cisco-ise
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NetBox plugin for Cisco ISE integration - endpoint tracking, NAD management, and session visibility
|
|
5
|
+
Author-email: sieteunoseis <jeremy.worden@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/sieteunoseis/netbox-cisco-ise
|
|
8
|
+
Project-URL: Repository, https://github.com/sieteunoseis/netbox-cisco-ise
|
|
9
|
+
Project-URL: Issues, https://github.com/sieteunoseis/netbox-cisco-ise/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/sieteunoseis/netbox-cisco-ise/wiki
|
|
11
|
+
Keywords: netbox,cisco,ise,identity-services-engine,radius,tacacs,nac,endpoint,plugin
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.28.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: black; extra == "dev"
|
|
26
|
+
Requires-Dist: flake8; extra == "dev"
|
|
27
|
+
Requires-Dist: isort; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-django; extra == "dev"
|
|
30
|
+
Requires-Dist: responses; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# NetBox Cisco ISE Plugin
|
|
34
|
+
|
|
35
|
+
<img src="docs/icon.png" alt="NetBox Cisco ISE Plugin" width="100" align="right">
|
|
36
|
+
|
|
37
|
+
A NetBox plugin that integrates Cisco Identity Services Engine (ISE) with NetBox, displaying endpoint details, network device (NAD) information, and active session data.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+

|
|
41
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
42
|
+
[](https://github.com/sieteunoseis/netbox-cisco-ise/actions/workflows/ci.yml)
|
|
43
|
+
[](https://pypi.org/project/netbox-cisco-ise/)
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
### Endpoint Integration
|
|
48
|
+
- **Endpoint Details Tab**: Adds a "Cisco ISE" tab to Device detail pages for endpoints
|
|
49
|
+
- **MAC Address Lookup**: Automatic lookup using device interface MAC addresses
|
|
50
|
+
- **Endpoint Profile**: Shows profiled device type and identity group
|
|
51
|
+
- **Session Status**: Displays active/inactive connection status
|
|
52
|
+
|
|
53
|
+
### Network Access Device (NAD) Integration
|
|
54
|
+
- **NAD Details Tab**: Shows ISE registration status for network devices
|
|
55
|
+
- **Authentication Settings**: Displays RADIUS, TACACS+, and SNMP configuration
|
|
56
|
+
- **TrustSec Status**: Shows device TrustSec enrollment
|
|
57
|
+
- **Device Groups**: Lists assigned network device groups
|
|
58
|
+
|
|
59
|
+
### Active Session Data
|
|
60
|
+
- **Real-time Session**: Shows active 802.1X/MAB session details
|
|
61
|
+
- **Connection Info**: NAS IP, port ID, VLAN assignment
|
|
62
|
+
- **Authorization**: Selected authorization profile and SGT
|
|
63
|
+
- **Posture Status**: Endpoint compliance posture state
|
|
64
|
+
|
|
65
|
+
### General Features
|
|
66
|
+
- **Configurable Device Mappings**: Control which devices show the tab and lookup method
|
|
67
|
+
- **API Caching**: Reduces load on ISE with configurable cache timeout
|
|
68
|
+
- **Settings Page**: View configuration and test ISE connection
|
|
69
|
+
|
|
70
|
+
## Requirements
|
|
71
|
+
|
|
72
|
+
- NetBox 4.0 or higher
|
|
73
|
+
- Cisco ISE 2.x or higher with ERS API enabled
|
|
74
|
+
- Python 3.10+
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
### From PyPI (when published)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install netbox-cisco-ise
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### From Source
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git clone https://github.com/sieteunoseis/netbox-cisco-ise.git
|
|
88
|
+
cd netbox-cisco-ise
|
|
89
|
+
pip install -e .
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Docker Installation
|
|
93
|
+
|
|
94
|
+
Add to your NetBox Docker requirements file:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# requirements-extra.txt
|
|
98
|
+
netbox-cisco-ise
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or for development:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# In docker-compose.override.yml, mount the plugin:
|
|
105
|
+
volumes:
|
|
106
|
+
- /path/to/netbox-cisco-ise:/opt/netbox/netbox/netbox_cisco_ise
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
Add the plugin to your NetBox configuration:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
# configuration.py
|
|
115
|
+
|
|
116
|
+
PLUGINS = [
|
|
117
|
+
'netbox_cisco_ise',
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
PLUGINS_CONFIG = {
|
|
121
|
+
'netbox_cisco_ise': {
|
|
122
|
+
# Required: ISE URL (ERS API)
|
|
123
|
+
'ise_url': 'https://ise.example.com',
|
|
124
|
+
|
|
125
|
+
# Required: ERS Admin credentials
|
|
126
|
+
'ise_username': 'ersadmin',
|
|
127
|
+
'ise_password': 'your-password',
|
|
128
|
+
|
|
129
|
+
# Optional settings
|
|
130
|
+
'timeout': 30, # API timeout in seconds (default: 30)
|
|
131
|
+
'cache_timeout': 60, # Cache duration in seconds (default: 60)
|
|
132
|
+
'verify_ssl': False, # Verify SSL certificates (default: False)
|
|
133
|
+
|
|
134
|
+
# Device mappings (REQUIRED) - Controls which devices show the Cisco ISE tab
|
|
135
|
+
# Each mapping specifies:
|
|
136
|
+
# - manufacturer: Regex pattern to match device manufacturer (slug or name)
|
|
137
|
+
# - device_type: Optional regex pattern to match device type (slug or model)
|
|
138
|
+
# - lookup: How to find the device in ISE:
|
|
139
|
+
# "nad" - Network Access Device lookup by IP/hostname (for switches, routers, WLCs)
|
|
140
|
+
# "endpoint" - Endpoint lookup by MAC address (for wireless clients, badges)
|
|
141
|
+
'device_mappings': [
|
|
142
|
+
# All Cisco devices - lookup as NADs
|
|
143
|
+
{'manufacturer': 'cisco', 'lookup': 'nad'},
|
|
144
|
+
|
|
145
|
+
# Vocera badges - lookup by MAC address as endpoints
|
|
146
|
+
{'manufacturer': 'vocera', 'lookup': 'endpoint'},
|
|
147
|
+
|
|
148
|
+
# Example: Specific device type only
|
|
149
|
+
# {'manufacturer': 'aruba', 'device_type': 'badge', 'lookup': 'endpoint'},
|
|
150
|
+
],
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### ISE ERS API Setup
|
|
156
|
+
|
|
157
|
+
1. Enable ERS API in ISE: **Administration > System > Settings > ERS Settings**
|
|
158
|
+
2. Create an ERS Admin user or use existing admin credentials
|
|
159
|
+
3. Ensure the user has "ERS Admin" or "ERS Operator" privileges
|
|
160
|
+
|
|
161
|
+
### Required ISE Permissions
|
|
162
|
+
|
|
163
|
+
| Permission | Used For |
|
|
164
|
+
|------------|----------|
|
|
165
|
+
| ERS Read | Endpoint and NAD queries |
|
|
166
|
+
| Monitoring API | Active session lookups |
|
|
167
|
+
|
|
168
|
+
## Usage
|
|
169
|
+
|
|
170
|
+
Once installed and configured:
|
|
171
|
+
|
|
172
|
+
1. Navigate to any Device in NetBox that matches your device_mappings
|
|
173
|
+
2. Click the **Cisco ISE** tab
|
|
174
|
+
3. View real-time endpoint or NAD details from ISE
|
|
175
|
+
|
|
176
|
+
### Lookup Methods
|
|
177
|
+
|
|
178
|
+
| Lookup | Data Source | Used For |
|
|
179
|
+
|--------|-------------|----------|
|
|
180
|
+
| `nad` | IP address or hostname | Switches, routers, WLCs, APs |
|
|
181
|
+
| `endpoint` | Interface MAC address | Wireless clients, badges, phones |
|
|
182
|
+
|
|
183
|
+
### What's Displayed
|
|
184
|
+
|
|
185
|
+
#### For Endpoints (lookup: endpoint)
|
|
186
|
+
|
|
187
|
+
| Field | Description |
|
|
188
|
+
|-------|-------------|
|
|
189
|
+
| MAC Address | Endpoint MAC from ISE |
|
|
190
|
+
| Profile | Profiled endpoint type |
|
|
191
|
+
| Identity Group | Assigned identity group |
|
|
192
|
+
| Session Status | Connected/Disconnected |
|
|
193
|
+
| NAS IP | Authenticator IP address |
|
|
194
|
+
| Port | Switch port or AP name |
|
|
195
|
+
| VLAN | Assigned VLAN |
|
|
196
|
+
| Authorization | Applied authorization profile |
|
|
197
|
+
|
|
198
|
+
#### For NADs (lookup: nad)
|
|
199
|
+
|
|
200
|
+
| Field | Description |
|
|
201
|
+
|-------|-------------|
|
|
202
|
+
| Name | Device name in ISE |
|
|
203
|
+
| IP Addresses | Registered management IPs |
|
|
204
|
+
| Profile | NAD profile name |
|
|
205
|
+
| Device Groups | Location, type, IPSEC groups |
|
|
206
|
+
| RADIUS | Shared secret configured |
|
|
207
|
+
| TACACS+ | TACACS+ settings |
|
|
208
|
+
| TrustSec | SGT enrollment status |
|
|
209
|
+
|
|
210
|
+
## Troubleshooting
|
|
211
|
+
|
|
212
|
+
### Endpoint not found
|
|
213
|
+
|
|
214
|
+
- Verify the device has an interface with a MAC address
|
|
215
|
+
- Check that the MAC format matches ISE (XX:XX:XX:XX:XX:XX)
|
|
216
|
+
- Confirm the endpoint exists in ISE endpoint database
|
|
217
|
+
|
|
218
|
+
### NAD not found
|
|
219
|
+
|
|
220
|
+
- Verify the device has a primary IP or hostname in NetBox
|
|
221
|
+
- Check that the device is registered as a NAD in ISE
|
|
222
|
+
- Try both IP and hostname lookups
|
|
223
|
+
|
|
224
|
+
### Connection errors
|
|
225
|
+
|
|
226
|
+
- Verify `ise_url` is accessible from NetBox
|
|
227
|
+
- Confirm ERS API is enabled on ISE
|
|
228
|
+
- For self-signed certificates, set `verify_ssl: False`
|
|
229
|
+
|
|
230
|
+
### Authentication errors
|
|
231
|
+
|
|
232
|
+
- Verify the ERS Admin credentials
|
|
233
|
+
- Check user has ERS Admin or ERS Operator role
|
|
234
|
+
|
|
235
|
+
## Development
|
|
236
|
+
|
|
237
|
+
### Setup
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
git clone https://github.com/sieteunoseis/netbox-cisco-ise.git
|
|
241
|
+
cd netbox-cisco-ise
|
|
242
|
+
pip install -e ".[dev]"
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Code Style
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
black netbox_cisco_ise/
|
|
249
|
+
isort netbox_cisco_ise/
|
|
250
|
+
flake8 netbox_cisco_ise/
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## API Reference
|
|
254
|
+
|
|
255
|
+
This plugin uses two ISE APIs:
|
|
256
|
+
|
|
257
|
+
- **ERS API** (`/ers/config/*`): Configuration data - endpoints, NADs, profiles
|
|
258
|
+
- **Monitoring API** (`/admin/API/mnt/*`): Real-time session data
|
|
259
|
+
|
|
260
|
+
## Changelog
|
|
261
|
+
|
|
262
|
+
See [CHANGELOG.md](CHANGELOG.md) for release history.
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
Apache License 2.0 - See [LICENSE](LICENSE) for details.
|
|
267
|
+
|
|
268
|
+
## Contributing
|
|
269
|
+
|
|
270
|
+
Contributions are welcome! Please:
|
|
271
|
+
|
|
272
|
+
1. Fork the repository
|
|
273
|
+
2. Create a feature branch
|
|
274
|
+
3. Submit a pull request
|
|
275
|
+
|
|
276
|
+
## Related Projects
|
|
277
|
+
|
|
278
|
+
- [netbox-catalyst-center](https://github.com/sieteunoseis/netbox-catalyst-center) - Catalyst Center integration for NetBox
|
|
279
|
+
- [netbox-graylog](https://github.com/sieteunoseis/netbox-graylog) - Display Graylog logs in NetBox
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
netbox_cisco_ise/__init__.py,sha256=i2HcznblQ7qWGki5GzdHVwVTT7jHoS5xoL9YI3aeqZw,2156
|
|
2
|
+
netbox_cisco_ise/ise_client.py,sha256=zUMakBU6lmSi-digrMxr6JKAbqyvBAPWz4l1eD8iDa8,16228
|
|
3
|
+
netbox_cisco_ise/navigation.py,sha256=mMN4EyzZl6ehoqflLeYy7logt39wpCN2TEsPfqn1VtI,507
|
|
4
|
+
netbox_cisco_ise/urls.py,sha256=3tJHJyEQXYZ2WXw4zq1kds7xpgyHl1-HwVHlgtJA84E,304
|
|
5
|
+
netbox_cisco_ise/views.py,sha256=01EzP1D2asecQr3rQAqTfXKOcgj4ra0o4_T5aAlos7I,8758
|
|
6
|
+
netbox_cisco_ise-0.1.0.dist-info/licenses/LICENSE,sha256=KmjHs19UP3vo7K2IWXkq3JDKG9PatSbqeLPwu3o2k7g,10761
|
|
7
|
+
netbox_cisco_ise-0.1.0.dist-info/METADATA,sha256=XrCMQAnyxOKxaFBPfieuQZlrRaJjXIUzeRZdfBObgDs,8793
|
|
8
|
+
netbox_cisco_ise-0.1.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
9
|
+
netbox_cisco_ise-0.1.0.dist-info/top_level.txt,sha256=LMP1ppZRzqtdaMGzz53KgacW_PEwyLSM9wwIMuBvJ00,17
|
|
10
|
+
netbox_cisco_ise-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 sieteunoseis
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
netbox_cisco_ise
|