forked from accuknox/accuknox-jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Insecure connection handling (accuknox#38)
* handling insecure connections * handling insecure connections * handling insecure connections * handling insecure connections * removed hardcorded data_type for curl command * modifing docker file * modifing docker file * modifing K8s-risk-management * modifing K8s-risk-management * values update * values update * new_requirement of allowing local cert * Update curl_command.sh * logic for cert from local * changes for local cert * changes for local cert --------- Co-authored-by: Sujith Reddy <60265529+SujithKasireddy@users.noreply.github.com>
- Loading branch information
1 parent
7581539
commit fa61f4c
Showing
16 changed files
with
211 additions
and
41 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
Binary file not shown.
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,34 @@ | ||
#!/bin/sh | ||
|
||
# Initialize CURL_FLAGS to handle both insecure and certificate usage | ||
CURL_FLAGS="" | ||
|
||
# Always add --insecure if USE_INSECURE_CONNECTION is true | ||
if [ "$USE_INSECURE_CONNECTION" = "true" ]; then | ||
CURL_FLAGS="$CURL_FLAGS --insecure" | ||
fi | ||
|
||
# Add certificate flags if CERT_BUNDLE_PATH is provided | ||
if [ -n "$CERT_BUNDLE_PATH" ]; then | ||
echo "Using in-line certificate content from CERT_BUNDLE_PATH..." | ||
printf "%b" "$CERT_BUNDLE_PATH" > /tmp/cert.pem | ||
CURL_FLAGS="$CURL_FLAGS --cacert /tmp/cert.pem" | ||
elif [ -n "$CERT_BUNDLE_URL" ]; then | ||
echo "Attempting to download certificate from $CERT_BUNDLE_URL..." | ||
if curl -o /tmp/cert.pem "$CERT_BUNDLE_URL"; then | ||
CURL_FLAGS="$CURL_FLAGS --cacert /tmp/cert.pem" | ||
else | ||
echo "Certificate not available or failed to download." | ||
fi | ||
fi | ||
|
||
# main curl command | ||
curl --location --request POST "https://${URL}/api/v1/artifact/?tenant_id=${TENANT_ID}&data_type=${DATA_TYPE}&label_id=${LABEL_NAME}&save_to_s3=true" \ | ||
--header "Tenant-Id: ${TENANT_ID}" \ | ||
--header "Authorization: Bearer ${AUTH_TOKEN}" \ | ||
$CURL_FLAGS \ | ||
--form "file=@/data/report.json" || exit 1 | ||
|
||
# Print the report | ||
cat /data/report.json | ||
|
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
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