| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
"""Tests for anta.tests.security.py.""" |
| 5 |
|
| 6 |
from __future__ import annotations |
| 7 |
|
| 8 |
import sys |
| 9 |
from typing import TYPE_CHECKING, Any |
| 10 |
|
| 11 |
import pytest |
| 12 |
from pydantic import ValidationError |
| 13 |
|
| 14 |
from anta.models import AntaTest |
| 15 |
from anta.result_manager.models import AntaTestStatus |
| 16 |
from anta.tests.security import ( |
| 17 |
VerifyAPIHttpsSSL, |
| 18 |
VerifyAPIHttpStatus, |
| 19 |
VerifyAPIIPv4Acl, |
| 20 |
VerifyAPIIPv6Acl, |
| 21 |
VerifyAPISSLCertificate, |
| 22 |
VerifyBannerLogin, |
| 23 |
VerifyBannerMotd, |
| 24 |
VerifyHardwareEntropy, |
| 25 |
VerifyIPSecConnHealth, |
| 26 |
VerifyIPv4ACL, |
| 27 |
VerifySpecificIPSecConn, |
| 28 |
VerifySSHFIPSRestrictions, |
| 29 |
VerifySSHIPv4Acl, |
| 30 |
VerifySSHIPv6Acl, |
| 31 |
VerifySSHStatus, |
| 32 |
VerifyTelnetStatus, |
| 33 |
) |
| 34 |
from tests.units.anta_tests import test |
| 35 |
|
| 36 |
if TYPE_CHECKING: |
| 37 |
from tests.units.anta_tests import AntaUnitTestData |
| 38 |
|
| 39 |
DATA: AntaUnitTestData = { |
| 40 |
(VerifySSHStatus, "success"): { |
| 41 |
"eos_data": ["SSHD status for Default VRF is disabled\nSSH connection limit is 50\nSSH per host connection limit is 20\nFIPS status: disabled\n\n"], |
| 42 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 43 |
}, |
| 44 |
(VerifySSHStatus, "error-missing-ssh-status"): { |
| 45 |
"eos_data": ["SSH per host connection limit is 20\nFIPS status: disabled\n\n"], |
| 46 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Could not find SSH status in returned output"]}, |
| 47 |
}, |
| 48 |
(VerifySSHStatus, "failure-ssh-enabled"): { |
| 49 |
"eos_data": ["SSHD status for Default VRF is enabled\nSSH connection limit is 50\nSSH per host connection limit is 20\nFIPS status: disabled\n\n"], |
| 50 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["SSHD status for Default VRF is enabled"]}, |
| 51 |
}, |
| 52 |
(VerifySSHStatus, "success-4.32"): { |
| 53 |
"eos_data": [ |
| 54 |
"User certificate authentication methods: none (neither trusted CA nor SSL profile configured)\n" |
| 55 |
"SSHD status for Default VRF: disabled\nSSH connection limit: 50\nSSH per host connection limit: 20\nFIPS status: disabled\n\n" |
| 56 |
], |
| 57 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 58 |
}, |
| 59 |
(VerifySSHStatus, "failure-ssh-enabled-4.32"): { |
| 60 |
"eos_data": [ |
| 61 |
"User certificate authentication methods: none (neither trusted CA nor SSL profile configured)\nSSHD status for Default VRF: enabled\n" |
| 62 |
"SSH connection limit: 50\nSSH per host connection limit: 20\nFIPS status: disabled\n\n" |
| 63 |
], |
| 64 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["SSHD status for Default VRF: enabled"]}, |
| 65 |
}, |
| 66 |
(VerifySSHIPv4Acl, "success"): { |
| 67 |
"eos_data": [{"ipAclList": {"aclList": [{"type": "Ip4Acl", "name": "ACL_IPV4_SSH", "configuredVrfs": ["MGMT"], "activeVrfs": ["MGMT"]}]}}], |
| 68 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 69 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 70 |
}, |
| 71 |
(VerifySSHIPv4Acl, "failure-wrong-number"): { |
| 72 |
"eos_data": [{"ipAclList": {"aclList": []}}], |
| 73 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 74 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - SSH IPv4 ACL(s) count mismatch - Expected: 1 Actual: 0"]}, |
| 75 |
}, |
| 76 |
(VerifySSHIPv4Acl, "failure-wrong-vrf"): { |
| 77 |
"eos_data": [{"ipAclList": {"aclList": [{"type": "Ip4Acl", "name": "ACL_IPV4_SSH", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}], |
| 78 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 79 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - Following SSH IPv4 ACL(s) not configured or active: ACL_IPV4_SSH"]}, |
| 80 |
}, |
| 81 |
(VerifySSHIPv6Acl, "success"): { |
| 82 |
"eos_data": [{"ipv6AclList": {"aclList": [{"type": "Ip6Acl", "name": "ACL_IPV6_SSH", "configuredVrfs": ["MGMT"], "activeVrfs": ["MGMT"]}]}}], |
| 83 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 84 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 85 |
}, |
| 86 |
(VerifySSHIPv6Acl, "failure-wrong-number"): { |
| 87 |
"eos_data": [{"ipv6AclList": {"aclList": []}}], |
| 88 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 89 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - SSH IPv6 ACL(s) count mismatch - Expected: 1 Actual: 0"]}, |
| 90 |
}, |
| 91 |
(VerifySSHIPv6Acl, "failure-wrong-vrf"): { |
| 92 |
"eos_data": [{"ipv6AclList": {"aclList": [{"type": "Ip6Acl", "name": "ACL_IPV6_SSH", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}], |
| 93 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 94 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - Following SSH IPv6 ACL(s) not configured or active: ACL_IPV6_SSH"]}, |
| 95 |
}, |
| 96 |
(VerifyTelnetStatus, "success"): { |
| 97 |
"eos_data": [{"serverState": "disabled", "vrfName": "default", "maxTelnetSessions": 20, "maxTelnetSessionsPerHost": 20}], |
| 98 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 99 |
}, |
| 100 |
(VerifyTelnetStatus, "failure"): { |
| 101 |
"eos_data": [{"serverState": "enabled", "vrfName": "default", "maxTelnetSessions": 20, "maxTelnetSessionsPerHost": 20}], |
| 102 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Telnet status for Default VRF is enabled"]}, |
| 103 |
}, |
| 104 |
(VerifyAPIHttpStatus, "success"): { |
| 105 |
"eos_data": [ |
| 106 |
{ |
| 107 |
"enabled": True, |
| 108 |
"httpServer": {"configured": False, "running": False, "port": 80}, |
| 109 |
"localHttpServer": {"configured": False, "running": False, "port": 8080}, |
| 110 |
"httpsServer": {"configured": True, "running": True, "port": 443}, |
| 111 |
"unixSocketServer": {"configured": False, "running": False}, |
| 112 |
"sslProfile": {"name": "API_SSL_Profile", "configured": True, "state": "valid"}, |
| 113 |
"tlsProtocol": ["1.2"], |
| 114 |
} |
| 115 |
], |
| 116 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 117 |
}, |
| 118 |
(VerifyAPIHttpStatus, "failure"): { |
| 119 |
"eos_data": [ |
| 120 |
{ |
| 121 |
"enabled": True, |
| 122 |
"httpServer": {"configured": True, "running": True, "port": 80}, |
| 123 |
"localHttpServer": {"configured": False, "running": False, "port": 8080}, |
| 124 |
"httpsServer": {"configured": True, "running": True, "port": 443}, |
| 125 |
"unixSocketServer": {"configured": False, "running": False}, |
| 126 |
"sslProfile": {"name": "API_SSL_Profile", "configured": True, "state": "valid"}, |
| 127 |
"tlsProtocol": ["1.2"], |
| 128 |
} |
| 129 |
], |
| 130 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["eAPI HTTP server is enabled globally"]}, |
| 131 |
}, |
| 132 |
(VerifyAPIHttpsSSL, "success"): { |
| 133 |
"eos_data": [ |
| 134 |
{ |
| 135 |
"enabled": True, |
| 136 |
"httpServer": {"configured": False, "running": False, "port": 80}, |
| 137 |
"localHttpServer": {"configured": False, "running": False, "port": 8080}, |
| 138 |
"httpsServer": {"configured": True, "running": True, "port": 443}, |
| 139 |
"unixSocketServer": {"configured": False, "running": False}, |
| 140 |
"sslProfile": {"name": "API_SSL_Profile", "configured": True, "state": "valid"}, |
| 141 |
"tlsProtocol": ["1.2"], |
| 142 |
} |
| 143 |
], |
| 144 |
"inputs": {"profile": "API_SSL_Profile"}, |
| 145 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 146 |
}, |
| 147 |
(VerifyAPIHttpsSSL, "failure-not-configured"): { |
| 148 |
"eos_data": [ |
| 149 |
{ |
| 150 |
"enabled": True, |
| 151 |
"httpServer": {"configured": True, "running": True, "port": 80}, |
| 152 |
"localHttpServer": {"configured": False, "running": False, "port": 8080}, |
| 153 |
"httpsServer": {"configured": True, "running": True, "port": 443}, |
| 154 |
"unixSocketServer": {"configured": False, "running": False}, |
| 155 |
"tlsProtocol": ["1.2"], |
| 156 |
} |
| 157 |
], |
| 158 |
"inputs": {"profile": "API_SSL_Profile"}, |
| 159 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["eAPI HTTPS server SSL profile API_SSL_Profile is not configured"]}, |
| 160 |
}, |
| 161 |
(VerifyAPIHttpsSSL, "failure-misconfigured-invalid"): { |
| 162 |
"eos_data": [ |
| 163 |
{ |
| 164 |
"enabled": True, |
| 165 |
"httpServer": {"configured": True, "running": True, "port": 80}, |
| 166 |
"localHttpServer": {"configured": False, "running": False, "port": 8080}, |
| 167 |
"httpsServer": {"configured": True, "running": True, "port": 443}, |
| 168 |
"unixSocketServer": {"configured": False, "running": False}, |
| 169 |
"sslProfile": {"name": "Wrong_SSL_Profile", "configured": True, "state": "valid"}, |
| 170 |
"tlsProtocol": ["1.2"], |
| 171 |
} |
| 172 |
], |
| 173 |
"inputs": {"profile": "API_SSL_Profile"}, |
| 174 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["eAPI HTTPS server SSL profile API_SSL_Profile is misconfigured or invalid"]}, |
| 175 |
}, |
| 176 |
(VerifyAPIIPv4Acl, "success"): { |
| 177 |
"eos_data": [{"ipAclList": {"aclList": [{"type": "Ip4Acl", "name": "ACL_IPV4_API", "configuredVrfs": ["MGMT"], "activeVrfs": ["MGMT"]}]}}], |
| 178 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 179 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 180 |
}, |
| 181 |
(VerifyAPIIPv4Acl, "failure-wrong-number"): { |
| 182 |
"eos_data": [{"ipAclList": {"aclList": []}}], |
| 183 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 184 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - eAPI IPv4 ACL(s) count mismatch - Expected: 1 Actual: 0"]}, |
| 185 |
}, |
| 186 |
(VerifyAPIIPv4Acl, "failure-wrong-vrf"): { |
| 187 |
"eos_data": [{"ipAclList": {"aclList": [{"type": "Ip4Acl", "name": "ACL_IPV4_API", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}], |
| 188 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 189 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - Following eAPI IPv4 ACL(s) not configured or active: ACL_IPV4_API"]}, |
| 190 |
}, |
| 191 |
(VerifyAPIIPv6Acl, "success"): { |
| 192 |
"eos_data": [{"ipv6AclList": {"aclList": [{"type": "Ip6Acl", "name": "ACL_IPV6_API", "configuredVrfs": ["MGMT"], "activeVrfs": ["MGMT"]}]}}], |
| 193 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 194 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 195 |
}, |
| 196 |
(VerifyAPIIPv6Acl, "failure-wrong-number"): { |
| 197 |
"eos_data": [{"ipv6AclList": {"aclList": []}}], |
| 198 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 199 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - eAPI IPv6 ACL(s) count mismatch - Expected: 1 Actual: 0"]}, |
| 200 |
}, |
| 201 |
(VerifyAPIIPv6Acl, "failure-wrong-vrf"): { |
| 202 |
"eos_data": [{"ipv6AclList": {"aclList": [{"type": "Ip6Acl", "name": "ACL_IPV6_API", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}], |
| 203 |
"inputs": {"number": 1, "vrf": "MGMT"}, |
| 204 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - Following eAPI IPv6 ACL(s) not configured or active: ACL_IPV6_API"]}, |
| 205 |
}, |
| 206 |
(VerifyAPISSLCertificate, "success"): { |
| 207 |
"eos_data": [ |
| 208 |
{ |
| 209 |
"certificates": { |
| 210 |
"ARISTA_ROOT_CA.crt": { |
| 211 |
"subject": {"commonName": "Arista Networks Internal IT Root Cert Authority"}, |
| 212 |
"notAfter": 2127420899, |
| 213 |
"publicKey": {"encryptionAlgorithm": "RSA", "size": 4096}, |
| 214 |
}, |
| 215 |
"ARISTA_SIGNING_CA.crt": { |
| 216 |
"subject": {"commonName": "AristaIT-ICA ECDSA Issuing Cert Authority"}, |
| 217 |
"notAfter": 2127420899, |
| 218 |
"publicKey": {"encryptionAlgorithm": "ECDSA", "size": 256}, |
| 219 |
}, |
| 220 |
} |
| 221 |
}, |
| 222 |
{"utcTime": 1702288467.6736515}, |
| 223 |
], |
| 224 |
"inputs": { |
| 225 |
"certificates": [ |
| 226 |
{ |
| 227 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 228 |
"expiry_threshold": 30, |
| 229 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 230 |
"encryption_algorithm": "ECDSA", |
| 231 |
"key_size": 256, |
| 232 |
}, |
| 233 |
{ |
| 234 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 235 |
"expiry_threshold": 30, |
| 236 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 237 |
"encryption_algorithm": "RSA", |
| 238 |
"key_size": 4096, |
| 239 |
}, |
| 240 |
] |
| 241 |
}, |
| 242 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 243 |
}, |
| 244 |
(VerifyAPISSLCertificate, "failure-certificate-not-configured"): { |
| 245 |
"eos_data": [ |
| 246 |
{ |
| 247 |
"certificates": { |
| 248 |
"ARISTA_SIGNING_CA.crt": { |
| 249 |
"subject": {"commonName": "AristaIT-ICA ECDSA Issuing Cert Authority"}, |
| 250 |
"notAfter": 2127420899, |
| 251 |
"publicKey": {"encryptionAlgorithm": "ECDSA", "size": 256}, |
| 252 |
} |
| 253 |
} |
| 254 |
}, |
| 255 |
{"utcTime": 1702288467.6736515}, |
| 256 |
], |
| 257 |
"inputs": { |
| 258 |
"certificates": [ |
| 259 |
{ |
| 260 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 261 |
"expiry_threshold": 30, |
| 262 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 263 |
"encryption_algorithm": "ECDSA", |
| 264 |
"key_size": 256, |
| 265 |
}, |
| 266 |
{ |
| 267 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 268 |
"expiry_threshold": 30, |
| 269 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 270 |
"encryption_algorithm": "RSA", |
| 271 |
"key_size": 4096, |
| 272 |
}, |
| 273 |
] |
| 274 |
}, |
| 275 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Certificate: ARISTA_ROOT_CA.crt - Not found"]}, |
| 276 |
}, |
| 277 |
(VerifyAPISSLCertificate, "failure-certificate-expired"): { |
| 278 |
"eos_data": [ |
| 279 |
{ |
| 280 |
"certificates": { |
| 281 |
"ARISTA_ROOT_CA.crt": { |
| 282 |
"subject": {"commonName": "Arista Networks Internal IT Root Cert Authority"}, |
| 283 |
"notAfter": 1702533518, |
| 284 |
"publicKey": {"encryptionAlgorithm": "RSA", "size": 4096}, |
| 285 |
} |
| 286 |
} |
| 287 |
}, |
| 288 |
{"utcTime": 1702622372.2240553}, |
| 289 |
], |
| 290 |
"inputs": { |
| 291 |
"certificates": [ |
| 292 |
{ |
| 293 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 294 |
"expiry_threshold": 30, |
| 295 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 296 |
"encryption_algorithm": "RSA", |
| 297 |
"key_size": 4096, |
| 298 |
} |
| 299 |
] |
| 300 |
}, |
| 301 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Certificate: ARISTA_ROOT_CA.crt - certificate expired"]}, |
| 302 |
}, |
| 303 |
(VerifyAPISSLCertificate, "failure-certificate-about-to-expire"): { |
| 304 |
"eos_data": [ |
| 305 |
{ |
| 306 |
"certificates": { |
| 307 |
"ARISTA_ROOT_CA.crt": { |
| 308 |
"subject": {"commonName": "Arista Networks Internal IT Root Cert Authority"}, |
| 309 |
"notAfter": 1704782709, |
| 310 |
"publicKey": {"encryptionAlgorithm": "RSA", "size": 4096}, |
| 311 |
}, |
| 312 |
"ARISTA_SIGNING_CA.crt": { |
| 313 |
"subject": {"commonName": "AristaIT-ICA ECDSA Issuing Cert Authority"}, |
| 314 |
"notAfter": 1705992709, |
| 315 |
"publicKey": {"encryptionAlgorithm": "ECDSA", "size": 256}, |
| 316 |
}, |
| 317 |
} |
| 318 |
}, |
| 319 |
{"utcTime": 1702622372.2240553}, |
| 320 |
], |
| 321 |
"inputs": { |
| 322 |
"certificates": [ |
| 323 |
{ |
| 324 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 325 |
"expiry_threshold": 30, |
| 326 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 327 |
"encryption_algorithm": "ECDSA", |
| 328 |
"key_size": 256, |
| 329 |
}, |
| 330 |
{ |
| 331 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 332 |
"expiry_threshold": 30, |
| 333 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 334 |
"encryption_algorithm": "RSA", |
| 335 |
"key_size": 4096, |
| 336 |
}, |
| 337 |
] |
| 338 |
}, |
| 339 |
"expected": { |
| 340 |
"result": AntaTestStatus.FAILURE, |
| 341 |
"messages": ["Certificate: ARISTA_ROOT_CA.crt - set to expire within the threshold - Threshold: 30 days Actual: 25 days"], |
| 342 |
}, |
| 343 |
}, |
| 344 |
(VerifyAPISSLCertificate, "failure-wrong-subject-name"): { |
| 345 |
"eos_data": [ |
| 346 |
{ |
| 347 |
"certificates": { |
| 348 |
"ARISTA_ROOT_CA.crt": { |
| 349 |
"subject": {"commonName": "AristaIT-ICA Networks Internal IT Root Cert Authority"}, |
| 350 |
"notAfter": 2127420899, |
| 351 |
"publicKey": {"encryptionAlgorithm": "RSA", "size": 4096}, |
| 352 |
}, |
| 353 |
"ARISTA_SIGNING_CA.crt": { |
| 354 |
"subject": {"commonName": "Arista ECDSA Issuing Cert Authority"}, |
| 355 |
"notAfter": 2127420899, |
| 356 |
"publicKey": {"encryptionAlgorithm": "ECDSA", "size": 256}, |
| 357 |
}, |
| 358 |
} |
| 359 |
}, |
| 360 |
{"utcTime": 1702288467.6736515}, |
| 361 |
], |
| 362 |
"inputs": { |
| 363 |
"certificates": [ |
| 364 |
{ |
| 365 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 366 |
"expiry_threshold": 30, |
| 367 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 368 |
"encryption_algorithm": "ECDSA", |
| 369 |
"key_size": 256, |
| 370 |
}, |
| 371 |
{ |
| 372 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 373 |
"expiry_threshold": 30, |
| 374 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 375 |
"encryption_algorithm": "RSA", |
| 376 |
"key_size": 4096, |
| 377 |
}, |
| 378 |
] |
| 379 |
}, |
| 380 |
"expected": { |
| 381 |
"result": AntaTestStatus.FAILURE, |
| 382 |
"messages": [ |
| 383 |
"Certificate: ARISTA_SIGNING_CA.crt - incorrect common name - " |
| 384 |
"Expected: AristaIT-ICA ECDSA Issuing Cert Authority Actual: Arista ECDSA Issuing Cert Authority", |
| 385 |
"Certificate: ARISTA_ROOT_CA.crt - incorrect common name - Expected: Arista Networks Internal IT " |
| 386 |
"Root Cert Authority Actual: AristaIT-ICA Networks Internal IT Root Cert Authority", |
| 387 |
], |
| 388 |
}, |
| 389 |
}, |
| 390 |
(VerifyAPISSLCertificate, "failure-wrong-encryption-type-and-size"): { |
| 391 |
"eos_data": [ |
| 392 |
{ |
| 393 |
"certificates": { |
| 394 |
"ARISTA_ROOT_CA.crt": { |
| 395 |
"subject": {"commonName": "Arista Networks Internal IT Root Cert Authority"}, |
| 396 |
"notAfter": 2127420899, |
| 397 |
"publicKey": {"encryptionAlgorithm": "ECDSA", "size": 256}, |
| 398 |
}, |
| 399 |
"ARISTA_SIGNING_CA.crt": { |
| 400 |
"subject": {"commonName": "AristaIT-ICA ECDSA Issuing Cert Authority"}, |
| 401 |
"notAfter": 2127420899, |
| 402 |
"publicKey": {"encryptionAlgorithm": "RSA", "size": 4096}, |
| 403 |
}, |
| 404 |
} |
| 405 |
}, |
| 406 |
{"utcTime": 1702288467.6736515}, |
| 407 |
], |
| 408 |
"inputs": { |
| 409 |
"certificates": [ |
| 410 |
{ |
| 411 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 412 |
"expiry_threshold": 30, |
| 413 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 414 |
"encryption_algorithm": "ECDSA", |
| 415 |
"key_size": 256, |
| 416 |
}, |
| 417 |
{ |
| 418 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 419 |
"expiry_threshold": 30, |
| 420 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 421 |
"encryption_algorithm": "RSA", |
| 422 |
"key_size": 4096, |
| 423 |
}, |
| 424 |
] |
| 425 |
}, |
| 426 |
"expected": { |
| 427 |
"result": AntaTestStatus.FAILURE, |
| 428 |
"messages": [ |
| 429 |
"Certificate: ARISTA_SIGNING_CA.crt - incorrect encryption algorithm - Expected: ECDSA Actual: RSA", |
| 430 |
"Certificate: ARISTA_SIGNING_CA.crt - incorrect public key - Expected: 256 Actual: 4096", |
| 431 |
"Certificate: ARISTA_ROOT_CA.crt - incorrect encryption algorithm - Expected: RSA Actual: ECDSA", |
| 432 |
"Certificate: ARISTA_ROOT_CA.crt - incorrect public key - Expected: 4096 Actual: 256", |
| 433 |
], |
| 434 |
}, |
| 435 |
}, |
| 436 |
(VerifyAPISSLCertificate, "failure-missing-algorithm-details"): { |
| 437 |
"eos_data": [ |
| 438 |
{ |
| 439 |
"certificates": { |
| 440 |
"ARISTA_ROOT_CA.crt": {"subject": {"commonName": "Arista Networks Internal IT Root Cert Authority"}, "notAfter": 2127420899}, |
| 441 |
"ARISTA_SIGNING_CA.crt": {"subject": {"commonName": "AristaIT-ICA ECDSA Issuing Cert Authority"}, "notAfter": 2127420899}, |
| 442 |
} |
| 443 |
}, |
| 444 |
{"utcTime": 1702288467.6736515}, |
| 445 |
], |
| 446 |
"inputs": { |
| 447 |
"certificates": [ |
| 448 |
{ |
| 449 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 450 |
"expiry_threshold": 30, |
| 451 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 452 |
"encryption_algorithm": "ECDSA", |
| 453 |
"key_size": 256, |
| 454 |
}, |
| 455 |
{ |
| 456 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 457 |
"expiry_threshold": 30, |
| 458 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 459 |
"encryption_algorithm": "RSA", |
| 460 |
"key_size": 4096, |
| 461 |
}, |
| 462 |
] |
| 463 |
}, |
| 464 |
"expected": { |
| 465 |
"result": AntaTestStatus.FAILURE, |
| 466 |
"messages": [ |
| 467 |
"Certificate: ARISTA_SIGNING_CA.crt - incorrect encryption algorithm - Expected: ECDSA Actual: Not found", |
| 468 |
"Certificate: ARISTA_SIGNING_CA.crt - incorrect public key - Expected: 256 Actual: Not found", |
| 469 |
"Certificate: ARISTA_ROOT_CA.crt - incorrect encryption algorithm - Expected: RSA Actual: Not found", |
| 470 |
"Certificate: ARISTA_ROOT_CA.crt - incorrect public key - Expected: 4096 Actual: Not found", |
| 471 |
], |
| 472 |
}, |
| 473 |
}, |
| 474 |
(VerifyBannerLogin, "success"): { |
| 475 |
"eos_data": [ |
| 476 |
{ |
| 477 |
"loginBanner": ( |
| 478 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0" |
| 479 |
"\nthat can be found in the LICENSE file.\n" |
| 480 |
) |
| 481 |
} |
| 482 |
], |
| 483 |
"inputs": { |
| 484 |
"login_banner": ( |
| 485 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 486 |
"that can be found in the LICENSE file.\n" |
| 487 |
) |
| 488 |
}, |
| 489 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 490 |
}, |
| 491 |
(VerifyBannerLogin, "success-multiline"): { |
| 492 |
"eos_data": [ |
| 493 |
{ |
| 494 |
"loginBanner": ( |
| 495 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\n" |
| 496 |
" Use of this source code is governed by the Apache License 2.0\n" |
| 497 |
" that can be found in the LICENSE file.\n" |
| 498 |
) |
| 499 |
} |
| 500 |
], |
| 501 |
"inputs": { |
| 502 |
"login_banner": ( |
| 503 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\n " |
| 504 |
"Use of this source code is governed by the Apache License 2.0\n that can be found in the LICENSE file.\n" |
| 505 |
) |
| 506 |
}, |
| 507 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 508 |
}, |
| 509 |
(VerifyBannerLogin, "success-leading-whitespaces"): { |
| 510 |
"eos_data": [{"loginBanner": " Copyright (c) 2023-2024 Arista Networks, Inc.\n"}], |
| 511 |
"inputs": {"login_banner": " Copyright (c) 2023-2024 Arista Networks, Inc.\n"}, |
| 512 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 513 |
}, |
| 514 |
(VerifyBannerLogin, "failure-incorrect-login-banner"): { |
| 515 |
"eos_data": [ |
| 516 |
{ |
| 517 |
"loginBanner": ( |
| 518 |
"Copyright (c) 2023 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 519 |
"that can be found in the LICENSE file.\n" |
| 520 |
) |
| 521 |
} |
| 522 |
], |
| 523 |
"inputs": { |
| 524 |
"login_banner": ( |
| 525 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 526 |
"that can be found in the LICENSE file.\n" |
| 527 |
) |
| 528 |
}, |
| 529 |
"expected": { |
| 530 |
"result": AntaTestStatus.FAILURE, |
| 531 |
"messages": [ |
| 532 |
( |
| 533 |
"Incorrect login banner configured - Expected: 'Copyright (c) 2023-2024 Arista Networks, Inc.\n" |
| 534 |
"Use of this source code is governed by the Apache License 2.0\nthat can be found in the LICENSE file.\n'" |
| 535 |
" Actual: 'Copyright (c) 2023 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0" |
| 536 |
"\nthat can be found in the LICENSE file.\n'" |
| 537 |
) |
| 538 |
], |
| 539 |
}, |
| 540 |
}, |
| 541 |
(VerifyBannerLogin, "failure-login-banner-not-configured"): { |
| 542 |
"eos_data": [{"loginBanner": ""}], |
| 543 |
"inputs": { |
| 544 |
"login_banner": ( |
| 545 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 546 |
"that can be found in the LICENSE file.\n" |
| 547 |
) |
| 548 |
}, |
| 549 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Login banner is not configured"]}, |
| 550 |
}, |
| 551 |
(VerifyBannerMotd, "success"): { |
| 552 |
"eos_data": [ |
| 553 |
{ |
| 554 |
"motd": ( |
| 555 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 556 |
"that can be found in the LICENSE file." |
| 557 |
) |
| 558 |
} |
| 559 |
], |
| 560 |
"inputs": { |
| 561 |
"motd_banner": ( |
| 562 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 563 |
"that can be found in the LICENSE file." |
| 564 |
) |
| 565 |
}, |
| 566 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 567 |
}, |
| 568 |
(VerifyBannerMotd, "success-multiline"): { |
| 569 |
"eos_data": [ |
| 570 |
{ |
| 571 |
"motd": ( |
| 572 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 573 |
"that can be found in the LICENSE file.\n" |
| 574 |
) |
| 575 |
} |
| 576 |
], |
| 577 |
"inputs": { |
| 578 |
"motd_banner": ( |
| 579 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed " |
| 580 |
"by the Apache License 2.0\nthat can be found in the LICENSE file.\n" |
| 581 |
) |
| 582 |
}, |
| 583 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 584 |
}, |
| 585 |
(VerifyBannerMotd, "success-leading-whitespaces"): { |
| 586 |
"eos_data": [{"motd": " Copyright (c) 2023-2024 Arista Networks, Inc.\n"}], |
| 587 |
"inputs": {"motd_banner": (" Copyright (c) 2023-2024 Arista Networks, Inc.\n")}, |
| 588 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 589 |
}, |
| 590 |
(VerifyBannerMotd, "failure-incorrect-motd-banner"): { |
| 591 |
"eos_data": [ |
| 592 |
{ |
| 593 |
"motd": ( |
| 594 |
"Copyright (c) 2023 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 595 |
"that can be found in the LICENSE file.\n" |
| 596 |
) |
| 597 |
} |
| 598 |
], |
| 599 |
"inputs": { |
| 600 |
"motd_banner": ( |
| 601 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 602 |
"that can be found in the LICENSE file.\n" |
| 603 |
) |
| 604 |
}, |
| 605 |
"expected": { |
| 606 |
"result": AntaTestStatus.FAILURE, |
| 607 |
"messages": [ |
| 608 |
( |
| 609 |
"Incorrect MOTD banner configured - Expected: 'Copyright (c) 2023-2024 Arista Networks, Inc.\n" |
| 610 |
"Use of this source code is governed by the Apache License 2.0\nthat can be found in the LICENSE file.\n' " |
| 611 |
"Actual: 'Copyright (c) 2023 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 612 |
"that can be found in the LICENSE file.\n'" |
| 613 |
) |
| 614 |
], |
| 615 |
}, |
| 616 |
}, |
| 617 |
(VerifyBannerMotd, "failure-leading-whitespaces"): { |
| 618 |
"eos_data": [{"motd": "Copyright (c) 2023 Arista Networks, Inc.\n"}], |
| 619 |
"inputs": {"motd_banner": (" Copyright (c) 2023-2024 Arista Networks, Inc.\n")}, |
| 620 |
"expected": { |
| 621 |
"result": AntaTestStatus.FAILURE, |
| 622 |
"messages": [ |
| 623 |
( |
| 624 |
"Incorrect MOTD banner configured - Expected: ' Copyright (c) 2023-2024 Arista Networks, Inc.\n' " |
| 625 |
"Actual: 'Copyright (c) 2023 Arista Networks, Inc.\n'" |
| 626 |
) |
| 627 |
], |
| 628 |
}, |
| 629 |
}, |
| 630 |
(VerifyBannerMotd, "failure-login-banner-not-configured"): { |
| 631 |
"eos_data": [{"motd": ""}], |
| 632 |
"inputs": { |
| 633 |
"motd_banner": ( |
| 634 |
"Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n" |
| 635 |
"that can be found in the LICENSE file." |
| 636 |
) |
| 637 |
}, |
| 638 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["MOTD banner is not configured"]}, |
| 639 |
}, |
| 640 |
(VerifyIPv4ACL, "success"): { |
| 641 |
"eos_data": [ |
| 642 |
{ |
| 643 |
"aclList": [ |
| 644 |
{ |
| 645 |
"name": "default-control-plane-acl", |
| 646 |
"sequence": [ |
| 647 |
{"text": "permit icmp any any", "sequenceNumber": 10}, |
| 648 |
{"text": "permit ip any any tracked", "sequenceNumber": 20}, |
| 649 |
{"text": "permit udp any any eq bfd ttl eq 255", "sequenceNumber": 30}, |
| 650 |
], |
| 651 |
}, |
| 652 |
{ |
| 653 |
"name": "LabTest", |
| 654 |
"sequence": [{"text": "permit icmp any any", "sequenceNumber": 10}, {"text": "permit tcp any any range 5900 5910", "sequenceNumber": 20}], |
| 655 |
}, |
| 656 |
] |
| 657 |
} |
| 658 |
], |
| 659 |
"inputs": { |
| 660 |
"ipv4_access_lists": [ |
| 661 |
{ |
| 662 |
"name": "default-control-plane-acl", |
| 663 |
"entries": [ |
| 664 |
{"sequence": 10, "action": "permit icmp any any"}, |
| 665 |
{"sequence": 20, "action": "permit ip any any tracked"}, |
| 666 |
{"sequence": 30, "action": "permit udp any any eq bfd ttl eq 255"}, |
| 667 |
], |
| 668 |
}, |
| 669 |
{ |
| 670 |
"name": "LabTest", |
| 671 |
"entries": [{"sequence": 10, "action": "permit icmp any any"}, {"sequence": 20, "action": "permit tcp any any range 5900 5910"}], |
| 672 |
}, |
| 673 |
] |
| 674 |
}, |
| 675 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 676 |
}, |
| 677 |
(VerifyIPv4ACL, "failure-no-acl-list"): { |
| 678 |
"eos_data": [{"aclList": []}], |
| 679 |
"inputs": {"ipv4_access_lists": [{"name": "default-control-plane-acl", "entries": [{"sequence": 10, "action": "permit icmp any any"}]}]}, |
| 680 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No Access Control List (ACL) configured"]}, |
| 681 |
}, |
| 682 |
(VerifyIPv4ACL, "failure-acl-not-found"): { |
| 683 |
"eos_data": [ |
| 684 |
{ |
| 685 |
"aclList": [ |
| 686 |
{ |
| 687 |
"name": "default-control-plane-acl", |
| 688 |
"sequence": [ |
| 689 |
{"text": "permit icmp any any", "sequenceNumber": 10}, |
| 690 |
{"text": "permit ip any any tracked", "sequenceNumber": 20}, |
| 691 |
{"text": "permit udp any any eq bfd ttl eq 255", "sequenceNumber": 30}, |
| 692 |
], |
| 693 |
} |
| 694 |
] |
| 695 |
} |
| 696 |
], |
| 697 |
"inputs": { |
| 698 |
"ipv4_access_lists": [ |
| 699 |
{ |
| 700 |
"name": "default-control-plane-acl", |
| 701 |
"entries": [ |
| 702 |
{"sequence": 10, "action": "permit icmp any any"}, |
| 703 |
{"sequence": 20, "action": "permit ip any any tracked"}, |
| 704 |
{"sequence": 30, "action": "permit udp any any eq bfd ttl eq 255"}, |
| 705 |
], |
| 706 |
}, |
| 707 |
{ |
| 708 |
"name": "LabTest", |
| 709 |
"entries": [{"sequence": 10, "action": "permit icmp any any"}, {"sequence": 20, "action": "permit tcp any any range 5900 5910"}], |
| 710 |
}, |
| 711 |
] |
| 712 |
}, |
| 713 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["ACL name: LabTest - Not configured"]}, |
| 714 |
}, |
| 715 |
(VerifyIPv4ACL, "failure-sequence-not-found"): { |
| 716 |
"eos_data": [ |
| 717 |
{ |
| 718 |
"aclList": [ |
| 719 |
{ |
| 720 |
"name": "default-control-plane-acl", |
| 721 |
"sequence": [ |
| 722 |
{"text": "permit icmp any any", "sequenceNumber": 10}, |
| 723 |
{"text": "permit ip any any tracked", "sequenceNumber": 20}, |
| 724 |
{"text": "permit udp any any eq bfd ttl eq 255", "sequenceNumber": 40}, |
| 725 |
], |
| 726 |
}, |
| 727 |
{ |
| 728 |
"name": "LabTest", |
| 729 |
"sequence": [{"text": "permit icmp any any", "sequenceNumber": 10}, {"text": "permit tcp any any range 5900 5910", "sequenceNumber": 30}], |
| 730 |
}, |
| 731 |
] |
| 732 |
} |
| 733 |
], |
| 734 |
"inputs": { |
| 735 |
"ipv4_access_lists": [ |
| 736 |
{ |
| 737 |
"name": "default-control-plane-acl", |
| 738 |
"entries": [ |
| 739 |
{"sequence": 10, "action": "permit icmp any any"}, |
| 740 |
{"sequence": 20, "action": "permit ip any any tracked"}, |
| 741 |
{"sequence": 30, "action": "permit udp any any eq bfd ttl eq 255"}, |
| 742 |
], |
| 743 |
}, |
| 744 |
{ |
| 745 |
"name": "LabTest", |
| 746 |
"entries": [{"sequence": 10, "action": "permit icmp any any"}, {"sequence": 20, "action": "permit tcp any any range 5900 5910"}], |
| 747 |
}, |
| 748 |
] |
| 749 |
}, |
| 750 |
"expected": { |
| 751 |
"result": AntaTestStatus.FAILURE, |
| 752 |
"messages": ["ACL name: default-control-plane-acl Sequence: 30 - Not configured", "ACL name: LabTest Sequence: 20 - Not configured"], |
| 753 |
}, |
| 754 |
}, |
| 755 |
(VerifyIPv4ACL, "failure-action-not-match"): { |
| 756 |
"eos_data": [ |
| 757 |
{ |
| 758 |
"aclList": [ |
| 759 |
{ |
| 760 |
"name": "default-control-plane-acl", |
| 761 |
"sequence": [ |
| 762 |
{"text": "permit icmp any any", "sequenceNumber": 10}, |
| 763 |
{"text": "permit ip any any tracked", "sequenceNumber": 20}, |
| 764 |
{"text": "permit tcp any any range 5900 5910", "sequenceNumber": 30}, |
| 765 |
], |
| 766 |
}, |
| 767 |
{ |
| 768 |
"name": "LabTest", |
| 769 |
"sequence": [{"text": "permit icmp any any", "sequenceNumber": 10}, {"text": "permit udp any any eq bfd ttl eq 255", "sequenceNumber": 20}], |
| 770 |
}, |
| 771 |
] |
| 772 |
} |
| 773 |
], |
| 774 |
"inputs": { |
| 775 |
"ipv4_access_lists": [ |
| 776 |
{ |
| 777 |
"name": "default-control-plane-acl", |
| 778 |
"entries": [ |
| 779 |
{"sequence": 10, "action": "permit icmp any any"}, |
| 780 |
{"sequence": 20, "action": "permit ip any any tracked"}, |
| 781 |
{"sequence": 30, "action": "permit udp any any eq bfd ttl eq 255"}, |
| 782 |
], |
| 783 |
}, |
| 784 |
{ |
| 785 |
"name": "LabTest", |
| 786 |
"entries": [{"sequence": 10, "action": "permit icmp any any"}, {"sequence": 20, "action": "permit tcp any any range 5900 5910"}], |
| 787 |
}, |
| 788 |
] |
| 789 |
}, |
| 790 |
"expected": { |
| 791 |
"result": AntaTestStatus.FAILURE, |
| 792 |
"messages": [ |
| 793 |
"ACL name: default-control-plane-acl Sequence: 30 - action mismatch - " |
| 794 |
"Expected: permit udp any any eq bfd ttl eq 255 Actual: permit tcp any any range 5900 5910", |
| 795 |
"ACL name: LabTest Sequence: 20 - action mismatch - Expected: permit tcp any any range 5900 5910 Actual: permit udp any any eq bfd ttl eq 255", |
| 796 |
], |
| 797 |
}, |
| 798 |
}, |
| 799 |
(VerifyIPv4ACL, "failure-all-type"): { |
| 800 |
"eos_data": [ |
| 801 |
{ |
| 802 |
"aclList": [ |
| 803 |
{ |
| 804 |
"name": "default-control-plane-acl", |
| 805 |
"sequence": [ |
| 806 |
{"text": "permit icmp any any", "sequenceNumber": 10}, |
| 807 |
{"text": "permit ip any any tracked", "sequenceNumber": 40}, |
| 808 |
{"text": "permit tcp any any range 5900 5910", "sequenceNumber": 30}, |
| 809 |
], |
| 810 |
} |
| 811 |
] |
| 812 |
} |
| 813 |
], |
| 814 |
"inputs": { |
| 815 |
"ipv4_access_lists": [ |
| 816 |
{ |
| 817 |
"name": "default-control-plane-acl", |
| 818 |
"entries": [ |
| 819 |
{"sequence": 10, "action": "permit icmp any any"}, |
| 820 |
{"sequence": 20, "action": "permit ip any any tracked"}, |
| 821 |
{"sequence": 30, "action": "permit udp any any eq bfd ttl eq 255"}, |
| 822 |
], |
| 823 |
}, |
| 824 |
{ |
| 825 |
"name": "LabTest", |
| 826 |
"entries": [{"sequence": 10, "action": "permit icmp any any"}, {"sequence": 20, "action": "permit tcp any any range 5900 5910"}], |
| 827 |
}, |
| 828 |
] |
| 829 |
}, |
| 830 |
"expected": { |
| 831 |
"result": AntaTestStatus.FAILURE, |
| 832 |
"messages": [ |
| 833 |
"ACL name: default-control-plane-acl Sequence: 20 - Not configured", |
| 834 |
"ACL name: default-control-plane-acl Sequence: 30 - action mismatch - " |
| 835 |
"Expected: permit udp any any eq bfd ttl eq 255 Actual: permit tcp any any range 5900 5910", |
| 836 |
"ACL name: LabTest - Not configured", |
| 837 |
], |
| 838 |
}, |
| 839 |
}, |
| 840 |
(VerifyIPSecConnHealth, "success"): { |
| 841 |
"eos_data": [ |
| 842 |
{ |
| 843 |
"connections": { |
| 844 |
"default-172.18.3.2-172.18.5.2-srcUnused-0": {"pathDict": {"path9": "Established"}}, |
| 845 |
"default-100.64.3.2-100.64.5.2-srcUnused-0": {"pathDict": {"path10": "Established"}}, |
| 846 |
} |
| 847 |
} |
| 848 |
], |
| 849 |
"inputs": {}, |
| 850 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 851 |
}, |
| 852 |
(VerifyIPSecConnHealth, "failure-no-connection"): { |
| 853 |
"eos_data": [{"connections": {}}], |
| 854 |
"inputs": {}, |
| 855 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No IPv4 security connection configured"]}, |
| 856 |
}, |
| 857 |
(VerifyIPSecConnHealth, "failure-not-established"): { |
| 858 |
"eos_data": [ |
| 859 |
{ |
| 860 |
"connections": { |
| 861 |
"default-172.18.3.2-172.18.5.2-srcUnused-0": { |
| 862 |
"pathDict": {"path9": "Idle"}, |
| 863 |
"saddr": "172.18.3.2", |
| 864 |
"daddr": "172.18.2.2", |
| 865 |
"tunnelNs": "default", |
| 866 |
}, |
| 867 |
"Guest-100.64.3.2-100.64.5.2-srcUnused-0": {"pathDict": {"path10": "Idle"}, "saddr": "100.64.3.2", "daddr": "100.64.5.2", "tunnelNs": "Guest"}, |
| 868 |
} |
| 869 |
} |
| 870 |
], |
| 871 |
"inputs": {}, |
| 872 |
"expected": { |
| 873 |
"result": AntaTestStatus.FAILURE, |
| 874 |
"messages": [ |
| 875 |
"Source: 172.18.3.2 Destination: 172.18.2.2 VRF: default - IPv4 security connection not established", |
| 876 |
"Source: 100.64.3.2 Destination: 100.64.5.2 VRF: Guest - IPv4 security connection not established", |
| 877 |
], |
| 878 |
}, |
| 879 |
}, |
| 880 |
(VerifySpecificIPSecConn, "success-with-connection"): { |
| 881 |
"eos_data": [ |
| 882 |
{ |
| 883 |
"connections": { |
| 884 |
"Guest-172.18.3.2-172.18.2.2-srcUnused-0": { |
| 885 |
"pathDict": {"path9": "Established"}, |
| 886 |
"saddr": "172.18.3.2", |
| 887 |
"daddr": "172.18.2.2", |
| 888 |
"tunnelNs": "Guest", |
| 889 |
}, |
| 890 |
"Guest-100.64.3.2-100.64.2.2-srcUnused-0": { |
| 891 |
"pathDict": {"path10": "Established"}, |
| 892 |
"saddr": "100.64.3.2", |
| 893 |
"daddr": "100.64.2.2", |
| 894 |
"tunnelNs": "Guest", |
| 895 |
}, |
| 896 |
} |
| 897 |
} |
| 898 |
], |
| 899 |
"inputs": { |
| 900 |
"ip_security_connections": [ |
| 901 |
{ |
| 902 |
"peer": "10.255.0.1", |
| 903 |
"vrf": "Guest", |
| 904 |
"connections": [ |
| 905 |
{"source_address": "100.64.3.2", "destination_address": "100.64.2.2"}, |
| 906 |
{"source_address": "172.18.3.2", "destination_address": "172.18.2.2"}, |
| 907 |
], |
| 908 |
} |
| 909 |
] |
| 910 |
}, |
| 911 |
"expected": { |
| 912 |
"result": AntaTestStatus.SUCCESS, |
| 913 |
"atomic_results": [ |
| 914 |
{ |
| 915 |
"description": "Peer: 10.255.0.1 VRF: Guest Source: 100.64.3.2 Destination: 100.64.2.2", |
| 916 |
"result": AntaTestStatus.SUCCESS, |
| 917 |
}, |
| 918 |
{ |
| 919 |
"description": "Peer: 10.255.0.1 VRF: Guest Source: 172.18.3.2 Destination: 172.18.2.2", |
| 920 |
"result": AntaTestStatus.SUCCESS, |
| 921 |
}, |
| 922 |
], |
| 923 |
}, |
| 924 |
}, |
| 925 |
(VerifySpecificIPSecConn, "success-with-description"): { |
| 926 |
"eos_data": [ |
| 927 |
{ |
| 928 |
"connections": { |
| 929 |
"Guest-172.18.3.2-172.18.2.2-srcUnused-0": { |
| 930 |
"pathDict": {"path9": "Established"}, |
| 931 |
"saddr": "172.18.3.2", |
| 932 |
"daddr": "172.18.2.2", |
| 933 |
"tunnelNs": "Guest", |
| 934 |
}, |
| 935 |
"Guest-100.64.3.2-100.64.2.2-srcUnused-0": { |
| 936 |
"pathDict": {"path10": "Established"}, |
| 937 |
"saddr": "100.64.3.2", |
| 938 |
"daddr": "100.64.2.2", |
| 939 |
"tunnelNs": "Guest", |
| 940 |
}, |
| 941 |
} |
| 942 |
} |
| 943 |
], |
| 944 |
"inputs": { |
| 945 |
"ip_security_connections": [ |
| 946 |
{ |
| 947 |
"peer": "10.255.0.1", |
| 948 |
"description": "Datacenter IPsec tunnel", |
| 949 |
"vrf": "Guest", |
| 950 |
"connections": [ |
| 951 |
{"source_address": "100.64.3.2", "destination_address": "100.64.2.2"}, |
| 952 |
{"source_address": "172.18.3.2", "destination_address": "172.18.2.2"}, |
| 953 |
], |
| 954 |
} |
| 955 |
] |
| 956 |
}, |
| 957 |
"expected": { |
| 958 |
"result": AntaTestStatus.SUCCESS, |
| 959 |
"atomic_results": [ |
| 960 |
{ |
| 961 |
"description": "Peer: 10.255.0.1 (Datacenter IPsec tunnel) VRF: Guest Source: 100.64.3.2 Destination: 100.64.2.2", |
| 962 |
"result": AntaTestStatus.SUCCESS, |
| 963 |
}, |
| 964 |
{ |
| 965 |
"description": "Peer: 10.255.0.1 (Datacenter IPsec tunnel) VRF: Guest Source: 172.18.3.2 Destination: 172.18.2.2", |
| 966 |
"result": AntaTestStatus.SUCCESS, |
| 967 |
}, |
| 968 |
], |
| 969 |
}, |
| 970 |
}, |
| 971 |
(VerifySpecificIPSecConn, "success-without-connection"): { |
| 972 |
"eos_data": [ |
| 973 |
{ |
| 974 |
"connections": { |
| 975 |
"default-172.18.3.2-172.18.2.2-srcUnused-0": { |
| 976 |
"pathDict": {"path9": "Established"}, |
| 977 |
"saddr": "172.18.3.2", |
| 978 |
"daddr": "172.18.2.2", |
| 979 |
"tunnelNs": "default", |
| 980 |
}, |
| 981 |
"default-100.64.3.2-100.64.2.2-srcUnused-0": {"pathDict": {"path10": "Established"}, "saddr": "100.64.3.2", "daddr": "100.64.2.2"}, |
| 982 |
} |
| 983 |
} |
| 984 |
], |
| 985 |
"inputs": {"ip_security_connections": [{"peer": "10.255.0.1", "vrf": "default"}]}, |
| 986 |
"expected": { |
| 987 |
"result": AntaTestStatus.SUCCESS, |
| 988 |
"atomic_results": [ |
| 989 |
{ |
| 990 |
"description": "Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2", |
| 991 |
"result": AntaTestStatus.SUCCESS, |
| 992 |
}, |
| 993 |
{ |
| 994 |
"description": "Peer: 10.255.0.1 VRF: default Source: 100.64.3.2 Destination: 100.64.2.2", |
| 995 |
"result": AntaTestStatus.SUCCESS, |
| 996 |
}, |
| 997 |
], |
| 998 |
}, |
| 999 |
}, |
| 1000 |
(VerifySpecificIPSecConn, "failure-no-connection"): { |
| 1001 |
"eos_data": [ |
| 1002 |
{"connections": {}}, |
| 1003 |
{ |
| 1004 |
"connections": { |
| 1005 |
"DATA-172.18.3.2-172.18.2.2-srcUnused-0": { |
| 1006 |
"pathDict": {"path9": "Established"}, |
| 1007 |
"saddr": "172.18.3.2", |
| 1008 |
"daddr": "172.18.2.2", |
| 1009 |
"tunnelNs": "DATA", |
| 1010 |
}, |
| 1011 |
"DATA-100.64.3.2-100.64.2.2-srcUnused-0": { |
| 1012 |
"pathDict": {"path10": "Established"}, |
| 1013 |
"saddr": "100.64.3.2", |
| 1014 |
"daddr": "100.64.2.2", |
| 1015 |
"tunnelNs": "DATA", |
| 1016 |
}, |
| 1017 |
} |
| 1018 |
}, |
| 1019 |
], |
| 1020 |
"inputs": { |
| 1021 |
"ip_security_connections": [ |
| 1022 |
{"peer": "10.255.0.1", "vrf": "default"}, |
| 1023 |
{ |
| 1024 |
"peer": "10.255.0.2", |
| 1025 |
"vrf": "DATA", |
| 1026 |
"connections": [ |
| 1027 |
{"source_address": "100.64.3.2", "destination_address": "100.64.2.2"}, |
| 1028 |
{"source_address": "172.18.3.2", "destination_address": "172.18.2.2"}, |
| 1029 |
], |
| 1030 |
}, |
| 1031 |
] |
| 1032 |
}, |
| 1033 |
"expected": { |
| 1034 |
"result": AntaTestStatus.FAILURE, |
| 1035 |
"messages": ["Peer: 10.255.0.1 VRF: default - Not configured"], |
| 1036 |
"atomic_results": [ |
| 1037 |
{"description": "Peer: 10.255.0.1 VRF: default", "result": AntaTestStatus.FAILURE, "messages": ["Not configured"]}, |
| 1038 |
{ |
| 1039 |
"description": "Peer: 10.255.0.2 VRF: DATA Source: 100.64.3.2 Destination: 100.64.2.2", |
| 1040 |
"result": AntaTestStatus.SUCCESS, |
| 1041 |
}, |
| 1042 |
{ |
| 1043 |
"description": "Peer: 10.255.0.2 VRF: DATA Source: 172.18.3.2 Destination: 172.18.2.2", |
| 1044 |
"result": AntaTestStatus.SUCCESS, |
| 1045 |
}, |
| 1046 |
], |
| 1047 |
}, |
| 1048 |
}, |
| 1049 |
(VerifySpecificIPSecConn, "failure-not-established"): { |
| 1050 |
"eos_data": [ |
| 1051 |
{ |
| 1052 |
"connections": { |
| 1053 |
"default-172.18.3.2-172.18.5.2-srcUnused-0": { |
| 1054 |
"pathDict": {"path9": "Idle"}, |
| 1055 |
"saddr": "172.18.3.2", |
| 1056 |
"daddr": "172.18.2.2", |
| 1057 |
"tunnelNs": "default", |
| 1058 |
}, |
| 1059 |
"default-100.64.3.2-100.64.5.2-srcUnused-0": { |
| 1060 |
"pathDict": {"path10": "Idle"}, |
| 1061 |
"saddr": "100.64.2.2", |
| 1062 |
"daddr": "100.64.1.2", |
| 1063 |
"tunnelNs": "default", |
| 1064 |
}, |
| 1065 |
} |
| 1066 |
}, |
| 1067 |
{ |
| 1068 |
"connections": { |
| 1069 |
"MGMT-172.18.2.2-172.18.1.2-srcUnused-0": {"pathDict": {"path9": "Idle"}, "saddr": "172.18.2.2", "daddr": "172.18.1.2", "tunnelNs": "MGMT"}, |
| 1070 |
"MGMT-100.64.2.2-100.64.1.2-srcUnused-0": {"pathDict": {"path10": "Idle"}, "saddr": "100.64.2.2", "daddr": "100.64.1.2", "tunnelNs": "MGMT"}, |
| 1071 |
} |
| 1072 |
}, |
| 1073 |
], |
| 1074 |
"inputs": { |
| 1075 |
"ip_security_connections": [ |
| 1076 |
{"peer": "10.255.0.1", "vrf": "default"}, |
| 1077 |
{ |
| 1078 |
"peer": "10.255.0.2", |
| 1079 |
"vrf": "MGMT", |
| 1080 |
"connections": [ |
| 1081 |
{"source_address": "100.64.2.2", "destination_address": "100.64.1.2"}, |
| 1082 |
{"source_address": "172.18.2.2", "destination_address": "172.18.1.2"}, |
| 1083 |
], |
| 1084 |
}, |
| 1085 |
] |
| 1086 |
}, |
| 1087 |
"expected": { |
| 1088 |
"result": AntaTestStatus.FAILURE, |
| 1089 |
"messages": [ |
| 1090 |
"Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2 - Connection down - Expected: Established Actual: Idle", |
| 1091 |
"Peer: 10.255.0.1 VRF: default Source: 100.64.2.2 Destination: 100.64.1.2 - Connection down - Expected: Established Actual: Idle", |
| 1092 |
"Peer: 10.255.0.2 VRF: MGMT Source: 100.64.2.2 Destination: 100.64.1.2 - Connection down - Expected: Established Actual: Idle", |
| 1093 |
"Peer: 10.255.0.2 VRF: MGMT Source: 172.18.2.2 Destination: 172.18.1.2 - Connection down - Expected: Established Actual: Idle", |
| 1094 |
], |
| 1095 |
"atomic_results": [ |
| 1096 |
{ |
| 1097 |
"description": "Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2", |
| 1098 |
"result": AntaTestStatus.FAILURE, |
| 1099 |
"messages": ["Connection down - Expected: Established Actual: Idle"], |
| 1100 |
}, |
| 1101 |
{ |
| 1102 |
"description": "Peer: 10.255.0.1 VRF: default Source: 100.64.2.2 Destination: 100.64.1.2", |
| 1103 |
"result": AntaTestStatus.FAILURE, |
| 1104 |
"messages": ["Connection down - Expected: Established Actual: Idle"], |
| 1105 |
}, |
| 1106 |
{ |
| 1107 |
"description": "Peer: 10.255.0.2 VRF: MGMT Source: 100.64.2.2 Destination: 100.64.1.2", |
| 1108 |
"result": AntaTestStatus.FAILURE, |
| 1109 |
"messages": ["Connection down - Expected: Established Actual: Idle"], |
| 1110 |
}, |
| 1111 |
{ |
| 1112 |
"description": "Peer: 10.255.0.2 VRF: MGMT Source: 172.18.2.2 Destination: 172.18.1.2", |
| 1113 |
"result": AntaTestStatus.FAILURE, |
| 1114 |
"messages": ["Connection down - Expected: Established Actual: Idle"], |
| 1115 |
}, |
| 1116 |
], |
| 1117 |
}, |
| 1118 |
}, |
| 1119 |
(VerifySpecificIPSecConn, "failure-missing-connection"): { |
| 1120 |
"eos_data": [ |
| 1121 |
{ |
| 1122 |
"connections": { |
| 1123 |
"default-172.18.3.2-172.18.5.2-srcUnused-0": { |
| 1124 |
"pathDict": {"path9": "Idle"}, |
| 1125 |
"saddr": "172.18.3.2", |
| 1126 |
"daddr": "172.18.2.2", |
| 1127 |
"tunnelNs": "default", |
| 1128 |
}, |
| 1129 |
"default-100.64.3.2-100.64.5.2-srcUnused-0": { |
| 1130 |
"pathDict": {"path10": "Idle"}, |
| 1131 |
"saddr": "100.64.3.2", |
| 1132 |
"daddr": "100.64.2.2", |
| 1133 |
"tunnelNs": "default", |
| 1134 |
}, |
| 1135 |
} |
| 1136 |
}, |
| 1137 |
{ |
| 1138 |
"connections": { |
| 1139 |
"default-172.18.2.2-172.18.1.2-srcUnused-0": { |
| 1140 |
"pathDict": {"path9": "Idle"}, |
| 1141 |
"saddr": "172.18.2.2", |
| 1142 |
"daddr": "172.18.1.2", |
| 1143 |
"tunnelNs": "default", |
| 1144 |
}, |
| 1145 |
"default-100.64.2.2-100.64.1.2-srcUnused-0": { |
| 1146 |
"pathDict": {"path10": "Idle"}, |
| 1147 |
"saddr": "100.64.2.2", |
| 1148 |
"daddr": "100.64.1.2", |
| 1149 |
"tunnelNs": "default", |
| 1150 |
}, |
| 1151 |
} |
| 1152 |
}, |
| 1153 |
], |
| 1154 |
"inputs": { |
| 1155 |
"ip_security_connections": [ |
| 1156 |
{"peer": "10.255.0.1", "vrf": "default"}, |
| 1157 |
{ |
| 1158 |
"peer": "10.255.0.2", |
| 1159 |
"vrf": "default", |
| 1160 |
"connections": [ |
| 1161 |
{"source_address": "100.64.4.2", "destination_address": "100.64.1.2"}, |
| 1162 |
{"source_address": "172.18.4.2", "destination_address": "172.18.1.2"}, |
| 1163 |
], |
| 1164 |
}, |
| 1165 |
] |
| 1166 |
}, |
| 1167 |
"expected": { |
| 1168 |
"result": AntaTestStatus.FAILURE, |
| 1169 |
"messages": [ |
| 1170 |
"Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2 - Connection down - Expected: Established Actual: Idle", |
| 1171 |
"Peer: 10.255.0.1 VRF: default Source: 100.64.3.2 Destination: 100.64.2.2 - Connection down - Expected: Established Actual: Idle", |
| 1172 |
"Peer: 10.255.0.2 VRF: default Source: 100.64.4.2 Destination: 100.64.1.2 - Connection not found", |
| 1173 |
"Peer: 10.255.0.2 VRF: default Source: 172.18.4.2 Destination: 172.18.1.2 - Connection not found", |
| 1174 |
], |
| 1175 |
"atomic_results": [ |
| 1176 |
{ |
| 1177 |
"description": "Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2", |
| 1178 |
"result": AntaTestStatus.FAILURE, |
| 1179 |
"messages": ["Connection down - Expected: Established Actual: Idle"], |
| 1180 |
}, |
| 1181 |
{ |
| 1182 |
"description": "Peer: 10.255.0.1 VRF: default Source: 100.64.3.2 Destination: 100.64.2.2", |
| 1183 |
"result": AntaTestStatus.FAILURE, |
| 1184 |
"messages": ["Connection down - Expected: Established Actual: Idle"], |
| 1185 |
}, |
| 1186 |
{ |
| 1187 |
"description": "Peer: 10.255.0.2 VRF: default Source: 100.64.4.2 Destination: 100.64.1.2", |
| 1188 |
"result": AntaTestStatus.FAILURE, |
| 1189 |
"messages": ["Connection not found"], |
| 1190 |
}, |
| 1191 |
{ |
| 1192 |
"description": "Peer: 10.255.0.2 VRF: default Source: 172.18.4.2 Destination: 172.18.1.2", |
| 1193 |
"result": AntaTestStatus.FAILURE, |
| 1194 |
"messages": ["Connection not found"], |
| 1195 |
}, |
| 1196 |
], |
| 1197 |
}, |
| 1198 |
}, |
| 1199 |
(VerifySSHFIPSRestrictions, "success"): { |
| 1200 |
"eos_data": ["SSHD status for Default VRF is enabled\nSSH connection limit is 50\nSSH per host connection limit is 20\nFIPS status: enabled\n\n"], |
| 1201 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 1202 |
}, |
| 1203 |
(VerifySSHFIPSRestrictions, "failure-fips-disabled"): { |
| 1204 |
"eos_data": ["SSHD status for Default VRF is enabled\nSSH connection limit is 50\nSSH per host connection limit is 20\nFIPS status: disabled\n\n"], |
| 1205 |
"expected": { |
| 1206 |
"result": AntaTestStatus.FAILURE, |
| 1207 |
"messages": ["FIPS restrictions not enabled in management SSH - FIPS status: disabled"], |
| 1208 |
}, |
| 1209 |
}, |
| 1210 |
(VerifySSHFIPSRestrictions, "failure-fips-line-missing"): { |
| 1211 |
"eos_data": ["SSHD status for Default VRF is enabled\nSSH connection limit is 50\nSSH per host connection limit is 20\n\n"], |
| 1212 |
"expected": { |
| 1213 |
"result": AntaTestStatus.FAILURE, |
| 1214 |
"messages": ["FIPS status not found in 'show management ssh' output"], |
| 1215 |
}, |
| 1216 |
}, |
| 1217 |
(VerifyHardwareEntropy, "success"): { |
| 1218 |
"eos_data": [{"cpuModel": "2.20GHz", "cryptoModule": "Crypto Module v3.0", "hardwareEntropyEnabled": True, "blockedNetworkProtocols": []}], |
| 1219 |
"inputs": {}, |
| 1220 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 1221 |
}, |
| 1222 |
(VerifyHardwareEntropy, "failure"): { |
| 1223 |
"eos_data": [{"cpuModel": "2.20GHz", "cryptoModule": "Crypto Module v3.0", "hardwareEntropyEnabled": False, "blockedNetworkProtocols": []}], |
| 1224 |
"inputs": {}, |
| 1225 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Hardware entropy generation is disabled"]}, |
| 1226 |
}, |
| 1227 |
} |
| 1228 |
|
| 1229 |
|
| 1230 |
class TestAPISSLCertificate: |
| 1231 |
"""Test anta.tests.security.VerifyAPISSLCertificate.Input.APISSLCertificate.""" |
| 1232 |
|
| 1233 |
@pytest.mark.parametrize( |
| 1234 |
("model_params", "error"), |
| 1235 |
[ |
| 1236 |
pytest.param( |
| 1237 |
{ |
| 1238 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 1239 |
"expiry_threshold": 30, |
| 1240 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 1241 |
"encryption_algorithm": "RSA", |
| 1242 |
"key_size": 256, |
| 1243 |
}, |
| 1244 |
"Value error, `ARISTA_ROOT_CA.crt` key size 256 is invalid for RSA encryption. Allowed sizes are (2048, 3072, 4096).", |
| 1245 |
id="RSA_wrong_size", |
| 1246 |
), |
| 1247 |
pytest.param( |
| 1248 |
{ |
| 1249 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 1250 |
"expiry_threshold": 30, |
| 1251 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 1252 |
"encryption_algorithm": "ECDSA", |
| 1253 |
"key_size": 2048, |
| 1254 |
}, |
| 1255 |
"Value error, `ARISTA_SIGNING_CA.crt` key size 2048 is invalid for ECDSA encryption. Allowed sizes are (256, 384, 512).", |
| 1256 |
id="ECDSA_wrong_size", |
| 1257 |
), |
| 1258 |
], |
| 1259 |
) |
| 1260 |
def test_invalid(self, model_params: dict[str, Any], error: str) -> None: |
| 1261 |
"""Test invalid inputs for anta.tests.security.VerifyAPISSLCertificate.Input.APISSLCertificate.""" |
| 1262 |
with pytest.raises(ValidationError) as exec_info: |
| 1263 |
VerifyAPISSLCertificate.Input.APISSLCertificate.model_validate(model_params) |
| 1264 |
assert error == exec_info.value.errors()[0]["msg"] |
| 1265 |
|
| 1266 |
@pytest.mark.parametrize( |
| 1267 |
"model_params", |
| 1268 |
[ |
| 1269 |
pytest.param( |
| 1270 |
{ |
| 1271 |
"certificate_name": "ARISTA_SIGNING_CA.crt", |
| 1272 |
"expiry_threshold": 30, |
| 1273 |
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority", |
| 1274 |
"encryption_algorithm": "ECDSA", |
| 1275 |
"key_size": 256, |
| 1276 |
}, |
| 1277 |
id="ECDSA", |
| 1278 |
), |
| 1279 |
pytest.param( |
| 1280 |
{ |
| 1281 |
"certificate_name": "ARISTA_ROOT_CA.crt", |
| 1282 |
"expiry_threshold": 30, |
| 1283 |
"common_name": "Arista Networks Internal IT Root Cert Authority", |
| 1284 |
"encryption_algorithm": "RSA", |
| 1285 |
"key_size": 4096, |
| 1286 |
}, |
| 1287 |
id="RSA", |
| 1288 |
), |
| 1289 |
], |
| 1290 |
) |
| 1291 |
def test_valid(self, model_params: dict[str, Any]) -> None: |
| 1292 |
"""Test valid inputs for anta.tests.security.VerifyAPISSLCertificate.Input.APISSLCertificate.""" |
| 1293 |
VerifyAPISSLCertificate.Input.APISSLCertificate.model_validate(model_params) |