AGENT SKILL

verify-mtls-client-certificate

Use when configuring or debugging mutual TLS between services where the client must present a certificate. Verify the server validates the chain, checks the client identity, and rejects expired or unauthorized client certs rather than accepting any well-formed one.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 81
Forks
17

01 前言 Front Matter

name
verify-mtls-client-certificate
description
Use when configuring or debugging mutual TLS between services where the client must present a certificate. Verify the server validates the chain, checks the client identity, and rejects expired or unauthorized client certs rather than accepting any well-formed one.

02 资源文件 3

03 SKILL.md 正文

Verify mTLS client certificate

mTLS only adds security if the server actually validates the presented client cert against a trusted CA and maps its identity. A server that reads "some cert is present" and moves on is doing nothing.

Procedure

  1. Generate/obtain a client cert signed by the internal CA and confirm its subject:
    openssl x509 -in client.crt -noout -subject -issuer -ext subjectAltName
    
  2. Configure the server to require and verify client certs (Nginx example):
    ssl_client_certificate /etc/ssl/internal-ca.crt;
    ssl_verify_client on;          # "optional" lets unauthenticated clients through
    ssl_verify_depth 2;
    
    on rejects clients with no cert; optional accepts them, which is the usual config mistake.
  3. Prove a valid client cert is accepted:
    openssl s_client -connect api.internal:443 -servername api.internal \
      -cert client.crt -key client.key -CAfile internal-ca.crt </dev/null 2>&1 | grep -i 'Verify return'
    
  4. Prove a missing cert is rejected:
    openssl s_client -connect api.internal:443 -servername api.internal </dev/null 2>&1 \
      | grep -iE 'alert|handshake'
    
    Expect a handshake failure / certificate required alert.
  5. Prove a cert from the wrong CA (a public cert) is rejected, not just a missing one:
    openssl s_client -connect api.internal:443 -servername api.internal \
      -cert /etc/ssl/certs/public.crt -key public.key </dev/null 2>&1 | grep -i alert
    
  6. Map the identity in the app: read $ssl_client_s_dn / $ssl_client_verify in Nginx, or the peer-cert subject in your gateway, and assert the CN/SAN equals the service identity before allowing the request:
    if ($ssl_client_verify != SUCCESS) { return 496; }
    
  7. Confirm expiry handling — a client cert that has expired should fail, tested with -attime:
    openssl verify -attime 2000000000 -CAfile internal-ca.crt client.crt   # simulate far future
    

Pitfalls

  • ssl_verify_client optional (or its gateway equivalent) accepts clients with no certificate at all.
  • Verifying the chain but never checking the CN/SAN lets any cert from the internal CA act as any service.
  • ssl_verify_depth too low rejects valid chains that include an intermediate.
  • Revoking a compromised client cert needs CRL/OCSP configured; without it the cert works until expiry.
  • Testing only the happy path (valid cert passes) misses the two failure cases that matter.
  • Rotating the CA without reissuing client certs breaks every service at once on renewal day.
  • Behind a load balancer that terminates TLS, the app never sees the client cert unless the LB forwards it — and then it is a header you must not trust blindly.

Verification

openssl s_client -connect api.internal:443 -servername api.internal \
  -cert client.crt -key client.key -CAfile internal-ca.crt </dev/null 2>&1 \
  | grep -E 'Verify return code|subject='

Pass means the valid client cert verifies (Verify return code: 0) and steps 4–5 fail with an alert. Report: "mTLS required; valid client accepted, no-cert and wrong-CA rejected with handshake alerts, CN mapped to service identity."

04 同仓库更多 Skills

jiayaoqijia
jiayaoqijia/cryptoskill

troves

Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

trade

Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

staking

Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

send

Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

portfolio

View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".

★ 81
jiayaoqijia
jiayaoqijia/cryptoskill

multi-swap

Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.

★ 81