-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WFLY-18475] helloworld-mutual-ssl-secured Quickstart Common Enhancem…
…ents CY2023Q3
- Loading branch information
Prarthona Paul
committed
Oct 20, 2023
1 parent
8f25960
commit f917738
Showing
13 changed files
with
385 additions
and
63 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
.github/workflows/quickstart_helloworld-mutual-ssl-secured_ci.yml
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,21 @@ | ||
name: WildFly helloworld-mutual-ssl-secured Quickstart CI | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths: | ||
- 'helloworld-mutual-ssl-secured/**' | ||
- '.github/workflows/quickstart_ci.yml' | ||
|
||
# Only run the latest job | ||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.ref || github.run_id }}' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
call-quickstart_ci: | ||
uses: ./.github/workflows/quickstart_ci.yml | ||
with: | ||
QUICKSTART_PATH: helloworld-mutual-ssl-secured | ||
TEST_PROVISIONED_SERVER: true | ||
TEST_OPENSHIFT: 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
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,39 @@ | ||
#!/bin/sh | ||
|
||
# Generate a self-signed keystore with the specified DN fields | ||
expect <<EOF | ||
set timeout 10 | ||
spawn keytool -genkey -keystore client.keystore -storepass secret -validity 365 -keyalg RSA -keysize 2048 -storetype pkcs12 | ||
expect "What is your first and last name?" | ||
send "quickstartUser\r" | ||
expect "What is the name of your organizational unit?" | ||
send "Sales\r" | ||
expect "What is the name of your organization?" | ||
send "My Organization\r" | ||
expect "What is the name of your City or Locality?" | ||
send "Sao Paulo\r" | ||
expect "What is the name of your State or Province?" | ||
send "Sao Paulo\r" | ||
expect "What is the two-letter country code for this unit?" | ||
send "BR\r" | ||
expect "Is CN=quickstartUser, OU=Sales, O=My Organization, L=Sao Paulo, ST=Sao Paulo, C=BR correct?" | ||
send "yes\r" | ||
expect eof | ||
EOF | ||
|
||
# Export the certificate | ||
keytool -exportcert -keystore client.keystore -storetype pkcs12 -storepass secret -keypass secret -file client.crt | ||
|
||
# Import the certificate into a truststore | ||
expect <<EOF | ||
set timeout 10 | ||
spawn keytool -import -file client.crt -alias quickstartUser -keystore client.truststore -storepass secret | ||
expect "Trust this certificate? [no]: " | ||
send "yes\r" | ||
expect eof | ||
EOF | ||
|
||
# Create a new PKCS12 keystore with the same certificate | ||
keytool -importkeystore -srckeystore client.keystore -srcstorepass secret -destkeystore clientCert.p12 -srcstoretype PKCS12 -deststoretype PKCS12 -deststorepass secret |
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 @@ | ||
#configure a key-store in the Elytron subsystem. The path to the keystore file doesn’t actually have to exist yet. | ||
/subsystem=elytron/key-store=clientKS:add(path=client.keystore.P12, relative-to=jboss.server.config.dir, credential-reference={clear-text=secret}, type=PKCS12) | ||
|
||
#generate a new key pair which will be used later to extract the certificate. This is an RSA key of size 1024. CN must be quickstartUser for the key | ||
/subsystem=elytron/key-store=clientKS:generate-key-pair(alias=example, algorithm=RSA, key-size=2048, validity=365, credential-reference={clear-text=secret}, distinguished-name="CN=quickstartUser") | ||
|
||
#Export the certificate to a file | ||
/subsystem=elytron/key-store=clientKS:export-certificate(alias=example, path=clientCert.crt, relative-to=jboss.server.config.dir, pem=true) | ||
|
||
#Create a truststore in the elytron subsystem. | ||
/subsystem=elytron/key-store=serverTS:add(path=server.keystore, relative-to=jboss.server.config.dir, credential-reference={clear-text=secret}, type=PKCS12) | ||
|
||
# Import a certificate into a truststore | ||
/subsystem=elytron/key-store=serverTS:import-certificate(alias=example, path=clientCert.crt, relative-to=jboss.server.config.dir, credential-reference={clear-text=secret}, validate=false) | ||
|
||
#store the keystore and truststore into keystore files | ||
/subsystem=elytron/key-store=serverTS:store() | ||
/subsystem=elytron/key-store=clientKS:store() | ||
|
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,8 @@ | ||
#remove the keypairs and certificates from the keystore and truststore | ||
/subsystem=elytron/key-store=serverTS:remove-alias(alias=example) | ||
/subsystem=elytron/key-store=clientKS:remove-alias(alias=example) | ||
|
||
#remove the keystore and truststore | ||
/subsystem=elytron/key-store=serverTS:remove | ||
/subsystem=elytron/key-store=clientKS:remove | ||
|
Oops, something went wrong.