-
Notifications
You must be signed in to change notification settings - Fork 105
wolfSSH support for using TPM based key for authentication #754
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 hidden or 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,143 @@ | ||
| name: TPM SSH Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ '*' ] | ||
| pull_request: | ||
| branches: [ '*' ] | ||
|
|
||
| jobs: | ||
| test-tpm-ssh: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| path: wolfssh | ||
|
|
||
| # Clone dependencies | ||
| - name: Clone wolfSSL | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: wolfSSL/wolfssl | ||
| path: wolfssl | ||
|
|
||
| - name: Clone wolfTPM | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: wolfSSL/wolftpm | ||
| path: wolftpm | ||
|
|
||
| # Install dependencies | ||
| - name: Install Dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libtool automake autoconf | ||
| sudo apt-get install -y build-essential git autoconf-archive \ | ||
| libcmocka-dev libssl-dev uthash-dev libglib2.0-dev \ | ||
| tpm2-tools openssh-client | ||
|
|
||
| # Clone, build, and start TPM Simulator | ||
| - name: Clone and Build TPM Simulator | ||
| run: | | ||
| git clone https://github.com/kgoldman/ibmswtpm2 | ||
| cd ibmswtpm2/src | ||
| make | ||
| ./tpm_server & | ||
| sleep 2 | ||
| cd ../.. | ||
|
|
||
| # Build and install wolfSSL | ||
| - name: Build wolfSSL | ||
| run: | | ||
| cd wolfssl | ||
| ./autogen.sh | ||
| ./configure --enable-wolftpm --enable-wolfssh | ||
| make | ||
| sudo make install | ||
| sudo ldconfig | ||
| cd .. | ||
|
|
||
| # Build and install wolfTPM | ||
| - name: Build wolfTPM | ||
| run: | | ||
| cd wolftpm | ||
| ./autogen.sh | ||
| ./configure --enable-swtpm | ||
| make | ||
| sudo make install | ||
| sudo ldconfig | ||
| cd .. | ||
|
|
||
| # Build wolfSSH | ||
| - name: Build wolfSSH | ||
| run: | | ||
| cd wolfssh | ||
| ./autogen.sh | ||
| ./configure --enable-tpm | ||
| make | ||
| sudo make install | ||
| sudo ldconfig | ||
| cd .. | ||
|
|
||
| # Test TPM SSH Default Password | ||
| - name: Test TPM SSH Default Password | ||
| run: | | ||
| # Generate key with default password | ||
| cd wolftpm | ||
| ./examples/keygen/keygen keyblob.bin -rsa -t -pem -eh | ||
|
|
||
| # Convert key to SSH format | ||
| ssh-keygen -f key.pem -i -m PKCS8 > ../wolfssh/key.ssh | ||
| cd .. | ||
|
|
||
| # Start echoserver and wait for it to be ready | ||
| cd wolfssh | ||
| ./examples/echoserver/echoserver -1 -s key.ssh & | ||
| echo "Echoserver started with PID: $!" | ||
| sleep 2 | ||
| cd .. | ||
|
|
||
| # Test client connection with default password | ||
| cd wolfssh | ||
| ./examples/client/client -i ../wolftpm/keyblob.bin -u hansel -K ThisIsMyKeyAuth | ||
| cd .. | ||
|
|
||
| # Test the TPM SSH Custom Password | ||
| - name: Test TPM SSH Custom Password | ||
| run: | | ||
| # Test with custom password | ||
| cd wolftpm | ||
| ./examples/keygen/keygen keyblob2.bin -rsa -t -pem -eh -auth=custompassword | ||
|
|
||
| # Convert key to SSH format | ||
| ssh-keygen -f key.pem -i -m PKCS8 > ../wolfssh/key.ssh | ||
| cd .. | ||
|
|
||
| # Start echoserver and wait for it to be ready | ||
| cd wolfssh | ||
| ./examples/echoserver/echoserver -1 -s key.ssh & | ||
| echo "Echoserver started with PID: $!" | ||
| sleep 2 | ||
| cd .. | ||
|
|
||
| # Test with custom password | ||
| cd wolfssh | ||
| ./examples/client/client -i ../wolftpm/keyblob2.bin -u hansel -K custompassword | ||
| cd .. | ||
|
|
||
| # Cleanup | ||
| pkill -f tpm_server | ||
|
aidangarske marked this conversation as resolved.
Outdated
|
||
| sleep 2 | ||
|
|
||
| # Archive artifacts for debugging | ||
| - name: Archive test artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-artifacts | ||
| path: | | ||
| wolftpm/keyblob.bin | ||
| wolftpm/keyblob2.bin | ||
| wolftpm/key.pem | ||
| wolfssh/key.ssh | ||
This file contains hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.