Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify signed topology file against TRC #6

Merged
merged 19 commits into from
Apr 19, 2022
Merged

Conversation

FR4NK-W
Copy link
Contributor

@FR4NK-W FR4NK-W commented Feb 18, 2022

Unless the insecure flag is set, download a TRC, a signed topology file and verify the signature.
Verifies the certificate chain of the included certificate against the TRC.
Crypto operations are only done using the tools scion-pki and openssl.

fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_openapi.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
@FR4NK-W
Copy link
Contributor Author

FR4NK-W commented Feb 23, 2022

Thanks for your comments @matzf

From your comments, it seems like we want to do more checks than we can easily do with the scion-pki tool:

  • we no longer can treat the payload as a blob we authenticate
  • we want to verify that the content of the topology file (in particular the AS id we are getting) matches the signer identity.

This puts us in a similar case as with a detached signature, where we also need to infer the signer.

About the EKU (Extended Key Usage), crypto/x509 Verify insists on verifying the EKU from the signer, to the issuer through to the root (which in production only has EKU Time Stamping and an internal EKU 1.3.6.1.4.1.55324.1.3.3), so we have to ignore EKUs anyway since there is no valid EKU.

Not sure that restricting the EKU on the root certificates is intentional.

fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_openapi.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
@FR4NK-W FR4NK-W marked this pull request as ready for review March 30, 2022 15:30
@FR4NK-W FR4NK-W changed the title WIP: Verify signed topology file against TRC Verify signed topology file against TRC Mar 30, 2022
config/config.go Outdated Show resolved Hide resolved
fetcher/scion_openapi.go Show resolved Hide resolved
fetcher/scion_openapi.go Show resolved Hide resolved
fetcher/openssl_cmds.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_openapi.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
fetcher/scion_openapi.go Outdated Show resolved Hide resolved
fetcher/scion_cppki_verify.go Outdated Show resolved Hide resolved
Unless the insecure flag is set, download a signed topology file and TRC and verify the signature.
Verifies the certificate chain of the included certificate against the TRC.
Crypto operations are only done using the tools scion-pki and openssl.
Parse topology to get ISD ID to check against TRC root and AS ID to check against signer AS cert.
Perform additional checks on payload, signer certificate and TRC:
- Match TRC ISD Id to unverified topology IA
- Match signer certificate Subject DN to topology IA
Introduce security modes for differentiated validation modes of TRCs and signature verification:
- strict: only store a TRC if it validates against an existing TRC update chain
- permissive: only store a TRC if it does not conflict with an existing TRC update chain, enables fetching TRCs with TOFU semantics
- insecure: store any TRC received, mark it as insecure to not compromise later checks in other operation modes, do not validate the topology signature using any certificate, or certificate chain tying it to any TRC.

Default mode is `permissive`.
Pull TRCs ordered by update chain, allowing to check each TRC against the update chain before storing.
Check TRC update chain against local TRC files
Accept empty update chain only in the permissive mode
Only keep latest 10 intermediate verify directories.
We keep the latest 10 verify directories, to allow manual auditing of the signature verification and payload extraction, but not more to avoid cluttering the disk.
Sort TRC files by their ISD ID, base number and serial number,
since `scion-pki`requires a sorted list of TRC files to verify an update chain.
Only move or symlink TRCs to final directory after update chain validity check or mode check
Do not rely on TRC filenames to infer TRC ISD, base number or serial, directly use the values contained in the TRC
Simplify obtaining paths to TRC files sorted by TRC update chain
Split out and comment CLI tool commands for `scion-pki` and `openssl` subcommands
Check if we already have a TRC before fetching it, so we do not fetch TRCs we are dismissing anyway.

Update comment about purpose of `scion-pki cert verify` check
Use signer IA to drive the topology signature verification
Encapsulate functionality and checks, improve comments
Add more comments
Add some more tests for cppki verification and security mode change
@FR4NK-W FR4NK-W merged commit 8fe9707 into master Apr 19, 2022
@FR4NK-W FR4NK-W deleted the fetcher_attached_signature branch November 8, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants