-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable mTLS connection support (#249)
* Enable mTLS connection support Enable mutual TLS (mTLS) connection support for mutual authentication. * Add an option to enable curl logs * Update Safestring and Metee lib version tag in Jenkinsfile.yml Signed-off-by: Shrikant Temburwar <[email protected]>
- Loading branch information
1 parent
bc537fd
commit 56c7bd0
Showing
11 changed files
with
150 additions
and
3 deletions.
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
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
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 @@ | ||
[req] | ||
distinguished_name=req_distinguished_name | ||
x509_extensions=v3_req | ||
prompt=no | ||
|
||
[req_distinguished_name] | ||
CN=apiUser | ||
OU=FDO project | ||
O=LF Edge | ||
L=Hillsboro | ||
ST=OR | ||
C=US | ||
|
||
[v3_req] | ||
basicConstraints = CA:FALSE | ||
nsCertType = client, email | ||
subjectKeyIdentifier = hash | ||
authorityKeyIdentifier = keyid,issuer | ||
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment | ||
extendedKeyUsage = clientAuth, emailProtection | ||
|
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
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,42 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache 2.0 | ||
# | ||
# ***WARNING***: The script generates the credentials using default system | ||
# configurations and might not provide necessary security strength for a | ||
# production deployment. Care must be taken to maintain necessary cryptographic | ||
# strength while generating keys for production deployment. | ||
|
||
# Summary: | ||
# user_csr_req.sh creates a certificate signing request for mTLS user/client credentials | ||
# the client.conf contains the subject name of the certificate. | ||
# the csr will be outputed to client.req file. | ||
# the private key will be outputed to client.key | ||
# | ||
# Usage message to be displayed whenever we provide wrong inputs | ||
usage() | ||
{ | ||
echo -e "\nUsage: | ||
$0 /path/to/client-sdk-fidoiot" | ||
} | ||
|
||
CLIENTSDK_REPO=$1 | ||
if ! [[ -d ${CLIENTSDK_REPO}/data ]]; then | ||
echo -e "Data folder doesn't exist.......\n\ | ||
Please do verify the data path in /path/to/client-sdk-fidoiot" | ||
usage | ||
exit 1 | ||
else | ||
CLIENTSDK_DATA=$CLIENTSDK_REPO/data | ||
fi | ||
|
||
if [[ $# == 1 ]]; then | ||
openssl req -x509 -newkey rsa:2048 -keyout $CLIENTSDK_DATA/clientKey.pem -out $CLIENTSDK_DATA/clientUser.pem -sha256 -days 12775 -nodes -config $CLIENTSDK_DATA/client.conf | ||
openssl x509 -x509toreq -in $CLIENTSDK_DATA/clientUser.pem -out $CLIENTSDK_DATA/client.req -signkey $CLIENTSDK_DATA/clientKey.pem | ||
|
||
#comment out following line if signing with external CA | ||
openssl x509 -req -days 12775 -in $CLIENTSDK_DATA/client.req -CA $CLIENTSDK_DATA/ca-cert.pem -CAkey $CLIENTSDK_DATA/caKey.pem -CAcreateserial -out $CLIENTSDK_DATA/apiUser.pem -extfile $CLIENTSDK_DATA/client.conf -extensions v3_req | ||
else | ||
usage; exit 1; | ||
fi |