Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Sometimes, we want to use a self-signed certificate without trusting it in the system. This PR implements
Certificate Pinning
to solve it.Checklist
Full changelogs
juicity-server generate-certchain-hash [cert_file]
.pinned_certchain_sha256
config item.Issue reference
Closes #34
Test Result
Normal case:
![image](https://private-user-images.githubusercontent.com/30586220/258136737-13377189-002b-48b9-b00c-d4e82875f780.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM4NTkzNTQsIm5iZiI6MTcyMzg1OTA1NCwicGF0aCI6Ii8zMDU4NjIyMC8yNTgxMzY3MzctMTMzNzcxODktMDAyYi00OGI5LWIwMGMtZDRlODI4NzVmNzgwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE3VDAxNDQxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0OTBlOGZjMWQxODY1ZDQ5ZjQxYzBlNDE4MDcyNDJiNTFhODU3MTE1ZDQxY2JmZTYyZWZhMjdkMDBkOGFhODMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-i8HUCAbREBSbWg-AcZ0JNf4MHJRZJDC2uWAohMTnEk)
Abnormal case (hash unmatched):
![image](https://private-user-images.githubusercontent.com/30586220/258136872-2ed0d386-8787-4182-b20f-ab212f84a86c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM4NTkzNTQsIm5iZiI6MTcyMzg1OTA1NCwicGF0aCI6Ii8zMDU4NjIyMC8yNTgxMzY4NzItMmVkMGQzODYtODc4Ny00MTgyLWIyMGYtYWIyMTJmODRhODZjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE3VDAxNDQxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTljZTZmYTcxNWUwZGVkYmVlMTQ5NjVmYjEzZGJlY2RhNjljMzRkNTI0OTIyZTIyMDJkMWNkYjNkZGZmZjFiZDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.KAKh4clonfcxp42dtvpqzkFXJD8VcP44gEJ9O7KZkr8)