-
Notifications
You must be signed in to change notification settings - Fork 0
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
Finalize UZI PoC Q4 for YubiSign project #59
Open
basvandriel
wants to merge
185
commits into
main
Choose a base branch
from
uzipoc_q4_2024
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
185 commits
Select commit
Hold shift + click to select a range
b02b92d
work on getting started
basvandriel 5ab7a96
Work with local tool
basvandriel 3b923b8
Work on docs
basvandriel 2d57054
change urls
basvandriel d0f6ce2
work
basvandriel 8a1fbd9
send jwt
basvandriel 2f4c71a
work on local setup
basvandriel 95aa0c7
work on local setup
basvandriel 24edf86
add images
basvandriel 400cd0f
add screenshots
basvandriel 42c99c6
work
basvandriel d079f16
move docs
basvandriel 7b34883
rm image
basvandriel 99e0a4f
add intro text
basvandriel b926f34
Merge branch 'uzipoc_q4_2024' into new-acme-server
basvandriel ec703aa
Remove initial test cert
basvandriel 6aa00f5
Cleanup test
basvandriel 0f427ff
local setup
basvandriel f1c5242
Remove comment
basvandriel 6a1a513
add comment
basvandriel d9f5e42
Clarify documentation
basvandriel 428ebb1
work
basvandriel 2695424
add test
basvandriel d566329
add init file
basvandriel e691ee3
work
basvandriel 556a779
Merge branch 'new-acme-server' into feature/dynamic-libykcs11
basvandriel 6d3cd34
Add finder
basvandriel 26228e5
Add license
basvandriel cbcec30
Add sample env file
basvandriel 62ef173
Revert "Add sample env file"
basvandriel 1ac2b0a
Add requirement
basvandriel fd54b67
Add sample .env file
basvandriel b77450c
Configure yubikey pin
basvandriel 5da898a
Remove line
basvandriel 865e9be
Remove debugging line
basvandriel b7e6906
Remove docker
basvandriel 15b1bf8
Merge pull request #24 from minvws/new-acme-server
basvandriel 492990c
Update app/pkcs.py
basvandriel 3fb56b9
Merge pull request #27 from minvws/feature/license-in-readme
basvandriel 6e043b5
add oidc login url
basvandriel b93ea6c
Fix
basvandriel 188513e
Merge branch 'uzipoc_q4_2024' into feature/env-file-usage
basvandriel 30d43d4
parse url for oidc provider
basvandriel 366d3f9
check
basvandriel e02965d
add oidc provider base url
basvandriel eba7993
normalize urls
basvandriel 57c7573
add ruff
basvandriel 8b5d253
Add github action and configure ruff
basvandriel 1ed420a
reformat
basvandriel fd2b12a
Fix linting errors
basvandriel f30b643
Install requirements
basvandriel 633b292
Update app/wizard.py
basvandriel 4330b91
Update .env.example
basvandriel 1611829
Update README.md
basvandriel 55aba06
Only run on PR
basvandriel 2d339e0
WORK
basvandriel f09b961
Add dev requirements
basvandriel 03ff65a
Merge pull request #28 from minvws/feature/env-file-usage
basvandriel 44148b7
Merge branch 'uzipoc_q4_2024' into feature/dynamic-libykcs11
basvandriel f332a3b
Merge branch 'uzipoc_q4_2024' into feature/ruff
basvandriel 944125c
fix test
basvandriel d3d6c9b
cleanup
basvandriel 3e93d09
Change comment
basvandriel 572d1bf
Merge pull request #25 from minvws/feature/dynamic-libykcs11
basvandriel f89fd75
parse url
basvandriel 0aabad0
work
basvandriel 77b0ba5
work
basvandriel 3eed896
Fix pkcs lib
basvandriel 0b97d62
Clean up docs
basvandriel e07fa30
apply feedback
basvandriel 775a3bd
remove comment
basvandriel 40156e0
fix readme file
basvandriel 1a5ce2c
Merge pull request #32 from minvws/feature/ali-feedback
basvandriel a3248b6
fix readme
basvandriel 0c0a56a
Fix docs
basvandriel db8ad63
Change reference to acme ca
basvandriel 8e018cd
change readme
basvandriel 774d89c
fix docs
basvandriel 5045547
Merge branch 'uzipoc_q4_2024' into feature/directory-usage
basvandriel 62560f3
Remove comment
basvandriel e98dc23
Cleanup
basvandriel 5cbcdae
remove baseurl
basvandriel cb6a20d
work
basvandriel 60b9e3c
Merge branch 'uzipoc_q4_2024' into feature/ruff
basvandriel 94b0ca7
reformat
basvandriel 58b6fb7
Close on finish and remove last page
basvandriel c21c800
reformat
basvandriel fbf5e39
format
basvandriel 4af7331
Update app/acme_directory_configuration.py
basvandriel f986e45
apply feedback
basvandriel e96a864
refactor
basvandriel cc7746d
Change example .env
basvandriel 15335af
reformat
basvandriel 17a105f
Merge pull request #30 from minvws/feature/ruff
basvandriel 79d363f
Merge branch 'uzipoc_q4_2024' into feature/directory-usage
basvandriel fad1f66
ruff format
basvandriel dd0b7be
cleanup
basvandriel 2aeac6a
Ruff lint
basvandriel 755f8b8
Merge branch 'uzipoc_q4_2024' into feature/noendpage
basvandriel 211afbe
Remove profit page
basvandriel c13303f
Merge pull request #33 from minvws/feature/directory-usage
basvandriel a235f79
Refer to .in file for requirements
basvandriel 79cb9dd
change text
basvandriel 80c309f
Merge pull request #34 from minvws/feature/noendpage
basvandriel 40e4aa0
Prevent backscrolls
basvandriel 449ff8f
Remove comments
basvandriel 6aca533
First step: refactor + complete emit
basvandriel a7e2cd7
Use of itemSelectionChanged signal
basvandriel 20500d5
Rename vars
basvandriel 018def0
Deselecting keys workds
basvandriel 820239a
Remove need for selected key
basvandriel 05d99ae
Merge pull request #36 from minvws/feature/no-back-after-keyselect
basvandriel a96dae5
Merge branch 'uzipoc_q4_2024' into feature/no-next-on-yubiselect
basvandriel 4a4cdc1
Merge pull request #37 from minvws/feature/no-next-on-yubiselect
basvandriel ec11505
Verify Python version
basvandriel ee6afb5
Add link to piv tool
basvandriel c2a0946
add windows specific
basvandriel 5c7646b
add windows requirements
basvandriel dfe7f6e
Set to rdo beheer for acme
basvandriel b85108a
Load .env file from correct location
basvandriel e495b85
Add git clone instruction
basvandriel 08ffc81
apply feedback
basvandriel 9795374
Update docs/LOCALSETUP.md
basvandriel 04a4765
Fix .env.example
ricklambrechts 8761027
Update windows Yubico PIV Tool libykc11 location
ricklambrechts c474387
env file loading cleanup
basvandriel f78c2e6
Merge pull request #40 from minvws/feature/jos-windows-feedback
basvandriel 7cb4b4e
Merge pull request #44 from minvws/update-windows-path
basvandriel 5843d8e
Merge pull request #43 from minvws/update-example-config
basvandriel 163dd1c
Add extra windows docs
basvandriel 8de77c9
Merge pull request #46 from minvws/feature/extra-docs-for-windows
basvandriel dd3f917
try
basvandriel e2ad04d
Use of direct QWizard
basvandriel 6032292
cleanup
basvandriel e3c23d6
Merge pull request #53 from minvws/feature/no-window-resize
basvandriel c5edb4e
Add to docs
basvandriel 6595f4e
add to docs
basvandriel 18081f8
work
basvandriel 4a00399
Cleanup
basvandriel c4b2b1f
add comment
basvandriel 42bc807
work on resetting
basvandriel 1a509c8
work on test
basvandriel 781b414
Add test for empty result
basvandriel 094c041
log
basvandriel c003a69
work
basvandriel b200a7b
refactor
basvandriel 02cdb9f
cleanup
basvandriel 04cd2c5
Enable logs
basvandriel 35b0c9b
work
basvandriel 1841775
cleanu
basvandriel d5887b0
work
basvandriel 0619455
cleanup
basvandriel 9887c94
Cleanup
basvandriel 2a80a46
Cleanup
basvandriel 8d962ef
work
basvandriel bc3b4d1
test
basvandriel 035ecb6
rm rsa key import
basvandriel 4bbfd96
Refactor welcome page
basvandriel 8c7c697
remove comment
basvandriel 0834acd
work
basvandriel 15eaf5c
work
basvandriel 512c7e7
test login
basvandriel 338c6ae
test
basvandriel 932ffdd
Cleanup
basvandriel 16d884a
Merge pull request #55 from minvws/feature/refactor-welcome
basvandriel 693431b
Merge pull request #56 from minvws/feature/refactor-login
basvandriel 4847589
Refactor
basvandriel 2ab5df9
Refactor
basvandriel 56d2473
Add RSA step
basvandriel 1a22eaf
Update main.py
basvandriel e5857e3
Remove unused import
basvandriel 7ce888d
rename
basvandriel 20205e3
cleanup
basvandriel 2e62664
Merge pull request #54 from minvws/feature/yubi-reset
basvandriel e15d0e7
Merge branch 'uzipoc_q4_2024' into feature/pkcs-check
basvandriel 309db22
Merge pull request #58 from minvws/feature/pkcs-check
basvandriel 29573c7
Update docs/LOCALSETUP.md
basvandriel e43f519
Update docs/LOCALSETUP.md
basvandriel 6d45d43
Update docs/LOCALSETUP.md
basvandriel 47506eb
Remove defaults
basvandriel 5129d06
work
basvandriel abd9dff
rename doc files
basvandriel e4526b6
change docs
basvandriel 604fbb0
Merge pull request #60 from minvws/feature/rick-feedback
basvandriel 0814b72
Variable ACME account email (#61)
basvandriel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.py] | ||
indent_size = 4 | ||
max_line_length = 120 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
YUBIKEY_PIN="123456" | ||
ACME_SERVER_DIRECTORY_URL="https://acme.proeftuin.uzi-online.irealisatie.nl/directory" | ||
OIDC_PROVIDER_BASE_URL="https://proeftuin.uzi-online.irealisatie.nl" | ||
ACME_ACCOUNT_EMAIL="[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Format and lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "*" | ||
types: [opened, synchronize, closed] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.13"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install developement requirements | ||
run: pip install -r requirements-dev.txt | ||
|
||
- name: Check for linting errors | ||
run: ruff check . | ||
|
||
- name: Check for formatting errors | ||
run: ruff format --check | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__pycache__ | ||
.pytest_cache | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,60 @@ | ||
# Disclaimer | ||
This Repository is created as a PoC (Proof of Concept) as part of the project *Toekomstbestendig maken UZI*, and | ||
**should not be used as is in any production environment**. | ||
# PoC with Yubikey | ||
|
||
# Wat doet dit? | ||
In order to automate certificate issuance for UZI, a PoC was done with a YubiKey and an ACME server. The keypairs are generated on the YubiKey and the certificate is issued by the ACME server. This program is designed to start with a _new_ YubiKey, meaning it should have the default PIN. This document will give you an high overview. | ||
|
||
Dit neemt een yubikey (doe maar versie 5) en maakt daarin de PIV module *leeg* | ||
### Steps | ||
|
||
Nadat deze leeg is worden er 4 keys aangemaakt in de yubikey | ||
- The YubiKey is reset: all the certificates on the device will be removed and the PIN code will be reset. | ||
- We will generate 4 public and private key pairs on the YubiKey. These are for PIV Authentication, Digital Signature, Key Management and Card Authentication. Next to that, the YubiKey will generate additional attestation certificates, to prove that the private key is generated on the YubiKey itself. The private keys will always remain in the YubiKey. | ||
- The user logs in via the chosen [authentication flow](./AUTH_FLOW.md). This returns an JWT, containing the user information. | ||
- Per generated key pair, an certificate signing request (CSR) is created and signed by the private key. | ||
- Finally, each certificate signing request with the corresponding attestation certificate is validated at the ACME server. When this is done, the server will issue an certificate for every key pair. Here, the JWT of the user is also used. This is done with the ACME server of iRealisatie. These are then saved back into the YubiKey into the corresponding slot. | ||
|
||
Er wordt contact gelegd met de rdo-acme service. En er worden 4 orders aangemaakt | ||
Now it is possible to use the certificate on the YubiKey to sign data. | ||
|
||
Van deze 4 orders wordt de unique-anti-replay-token meegestuurd met een uzi-labs digid login verzoek | ||
#### Diagram flow | ||
|
||
Er wordt een browser geopend in de applicatie zelf, daarmee log je in als zorg identiteit bij de ziekenboeg-uzi-labs | ||
This diagram expects that the Yubikey is already plugged in the user's computer. Next to that, it's expected that the user should use the **DigiD mock** login method. | ||
|
||
De app haalt hierna de JWT-token op bij ziekenboeg-uzi-labs waarin de 4 acmetokens zitten. | ||
```mermaid | ||
sequenceDiagram | ||
actor APP | ||
participant YUBIKEY | ||
|
||
Er wordt van de yubikey zelf opgehaald: | ||
* Het intermediate certificaat behorende bij de yubikey zoals geleverd door yubico op de yubikey zelf | ||
APP->>YUBIKEY: 1. Sends request to empty the Yubikeys certificates | ||
YUBIKEY-->YUBIKEY: Empties the certificates | ||
|
||
Per sleutel op de yubikey: | ||
* Een door de yubikey ondertekend certificaat per sleutel waarin de garantie (attestation) staat dat de sleutel echt op een yubikey is gemaakt | ||
* een CSR verzoek ondertekend door de aangemaakte sleutel | ||
APP->>YUBIKEY: 2. Sends request to generate 4 new private key pairs | ||
YUBIKEY-->YUBIKEY: 2.1 Create key pair for PIV Authentication | ||
YUBIKEY-->YUBIKEY: 2.2 Create key pair for Digital Signature | ||
YUBIKEY-->YUBIKEY: 2.3 Create key pair for Key Management | ||
YUBIKEY-->YUBIKEY: 2.4 Create key pair for Card Authentication | ||
|
||
Per order wordt dan verstuurd: | ||
* De JWT | ||
* Het yubikey intermediate certificaat | ||
* Het attestation certificaat | ||
create participant MAX | ||
APP->>MAX: 3. Opens browser to login the user | ||
MAX-->MAX: 3.1 Validates the user | ||
MAX-->>APP: Returns the JWT containing the user information. | ||
|
||
De acme server controleert dan per order: | ||
* of het attestation certificaat van de sleutel klopt | ||
* het token voor order in de JWT zit | ||
* De JWT goed is en van een geldige uzi-cibg-labs-uitgever komt | ||
APP->>APP: 4. Per generated key pair, <br> an certificate signing request (CSR)<br> is created and signed by the private key. | ||
|
||
Als dat klopt dan geeft de acme server terug dat het klopt en dan vraagt deze app in de laatste stap een certificaat aan met de eerder genoemde CSR. | ||
create participant ACME_SERVER | ||
loop 5. For every certificate signing request (CSR) | ||
APP->>ACME_SERVER: Validate every certificate signing request with the corresponding attestation certificate | ||
ACME_SERVER-->>APP: OK | ||
end | ||
|
||
Als de CSR dezelfde public key heeft als in de vorige stap gecontroleerde gegevens wordt er een Labs-UZI certifcaat uitgegeven op basis van de gegevens in de JWT. | ||
Dit certificaat bevat de huidige UZI-Certificaten structuur. | ||
loop 6. For every key pair | ||
APP->>ACME_SERVER: Request certificate for every key pair, also using the users' JWT | ||
ACME_SERVER-->>APP: OK | ||
ACME_SERVER-->>YUBIKEY: Save certificates | ||
end | ||
|
||
Als er een certificaat is opgehaald wordt dit opgeslagen op de juiste plek in de yubikey. | ||
``` | ||
|
||
Door het laden van de yubikey pkcs11 library in de browser, office, mac os, windows of linux plekken (zoals beschreven door yubico) kan de yubikey daarna | ||
worden gebruikt zoals een UZIpas ook gebruikt kan worden. Voor digitaal ondertekenen van documenten, verzoeken en om in te loggen in de browser bij | ||
partijen die UZI certificaten login mogelijk maken. | ||
### Disclaimer | ||
|
||
This Repository is created as a PoC (Proof of Concept) as part of the project _Toekomstbestendig maken UZI_, and **should not be used as is in any production environment**. | ||
|
||
### Licentie | ||
|
||
This project is licensed under the [EUPL-1.2 license](./LICENSE.txt). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class ACMEDirectoryConfiguration: | ||
""" | ||
This data is generated from the directory endpoint. These endpoints can be different per server. | ||
""" | ||
|
||
new_order_url: str | ||
new_account_url: str | ||
new_nonce_url: str | ||
revoke_cert_url: str |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally the JWT is already sent as a challenge and we should not need to update the finalize request.