mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-07-23 13:11:02 +03:00
Add folder anatomy (scripts/agent.py + references/api-reference.md) for 648 cybersecurity skills
Complete skill folder anatomy across all cybersecurity skills: - scripts/agent.py: 80-150 line Python agents using real libraries (impacket, boto3, azure-mgmt-*, kubernetes, pefile, yara, scapy, shodan, stix2, etc.) - references/api-reference.md: real API documentation with method signatures - LICENSE: MIT license for all skill folders
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
---
|
||||
name: implementing-mtls-for-zero-trust-services
|
||||
description: >
|
||||
Configures mutual TLS (mTLS) authentication between microservices using Python
|
||||
cryptography library for certificate generation and ssl module for TLS verification.
|
||||
Validates certificate chains, checks expiration, and audits mTLS deployment status.
|
||||
Use when implementing zero-trust service-to-service authentication.
|
||||
---
|
||||
|
||||
# Implementing mTLS for Zero Trust Services
|
||||
|
||||
## Instructions
|
||||
|
||||
Generate CA certificates, issue service certificates, and configure mutual TLS
|
||||
verification for service-to-service authentication.
|
||||
|
||||
```python
|
||||
from cryptography import x509
|
||||
from cryptography.x509.oid import NameOID
|
||||
from cryptography.hazmat.primitives import hashes, serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
import datetime
|
||||
|
||||
# Generate CA key and certificate
|
||||
ca_key = rsa.generate_private_key(public_exponent=65537, key_size=4096)
|
||||
ca_cert = (x509.CertificateBuilder()
|
||||
.subject_name(x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "Internal CA")]))
|
||||
.issuer_name(x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "Internal CA")]))
|
||||
.public_key(ca_key.public_key())
|
||||
.serial_number(x509.random_serial_number())
|
||||
.not_valid_before(datetime.datetime.utcnow())
|
||||
.not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=3650))
|
||||
.add_extension(x509.BasicConstraints(ca=True, path_length=None), critical=True)
|
||||
.sign(ca_key, hashes.SHA256()))
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```python
|
||||
import ssl
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
context.load_cert_chain("client.pem", "client-key.pem")
|
||||
context.load_verify_locations("ca.pem")
|
||||
context.verify_mode = ssl.CERT_REQUIRED
|
||||
```
|
||||
Reference in New Issue
Block a user