-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
145 changed files
with
5,465 additions
and
866 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash | ||
|
||
# The purpose of this script is to sign Windows binaries on the remote Checkmarx signing server as part of the CI process | ||
|
||
# Check if FILEPATH parameter is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <filename>" | ||
exit 1 | ||
fi | ||
|
||
FILEPATH=$1 | ||
OS_TYPE=$2 | ||
FILENAME=$(basename "$FILEPATH") | ||
FILENAME_SIGNED="$FILENAME"_signed | ||
|
||
# Define remote server details | ||
REMOTE_USER=$SIGNING_REMOTE_SSH_USER | ||
REMOTE_HOST=$SIGNING_REMOTE_SSH_HOST | ||
REMOTE_PATH="/tmp" | ||
|
||
# HSM credentials | ||
HSM_CREDS=$SIGNING_HSM_CREDS | ||
|
||
# Check if OS is windows | ||
if [ "$OS_TYPE" != "windows" ]; then | ||
echo "The artifact is not a windows binary file, exiting." | ||
exit 0 | ||
fi | ||
|
||
# Check if required variables are set | ||
if [ -z "$REMOTE_USER" ] || [ -z "$REMOTE_HOST" ] || [ -z "$HSM_CREDS" ] || [ -z "$SIGNING_REMOTE_SSH_PRIVATE_KEY" ]; then | ||
echo "Required environment variables are not set" | ||
exit 1 | ||
fi | ||
|
||
# Create an SSH key file from the secret | ||
SSH_KEY_PATH=$(mktemp) | ||
echo "$SIGNING_REMOTE_SSH_PRIVATE_KEY" > "$SSH_KEY_PATH" | ||
chmod 600 "$SSH_KEY_PATH" | ||
|
||
# Ensure cleanup of temporary files on exit | ||
trap 'rm -f "$SSH_KEY_PATH"' EXIT | ||
|
||
# Be sure we don't have already uploaded filess on the remote server | ||
ssh -n -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" "rm -f '$REMOTE_PATH/$FILENAME' && rm -f '$REMOTE_PATH/$FILENAME_SIGNED'" | ||
|
||
# Upload file via scp | ||
scp -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no "$FILEPATH" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH" | ||
# Check if file was uploaded | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to copy $FILEPATH" | ||
exit 1 | ||
fi | ||
|
||
# Sign | ||
ssh -n -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" "osslsigncode sign -certs /home/ubuntu/checkmarx.crt -key 'pkcs11:object=CNGRSAPriv-cx-signing' -pass $HSM_CREDS -pkcs11module /opt/cloudhsm/lib/libcloudhsm_pkcs11.so -t http://timestamp.digicert.com -in '$REMOTE_PATH/$FILENAME' -out '$REMOTE_PATH/$FILENAME_SIGNED'" | ||
# Check remote command status | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to sign file $FILENAME" | ||
ssh -n -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" "rm -f '$REMOTE_PATH/$FILENAME'" | ||
exit 1 | ||
fi | ||
|
||
# Download signed file via scp | ||
scp -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH/$FILENAME_SIGNED" "/tmp/$FILENAME_SIGNED" | ||
# Check the status | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to download signed file $FILENAME_SIGNED" | ||
ssh -n -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" "rm -f '$REMOTE_PATH/$FILENAME' && rm -f '$REMOTE_PATH/$FILENAME_SIGNED'" | ||
exit 1 | ||
fi | ||
|
||
# Replace original file with the signed | ||
rm -f "$FILEPATH" && mv "/tmp/$FILENAME_SIGNED" "$FILEPATH" | ||
|
||
# Cleanup remote server | ||
ssh -n -i "$SSH_KEY_PATH" -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" "rm -f '$REMOTE_PATH/$FILENAME' && rm -f '$REMOTE_PATH/$FILENAME_SIGNED'" | ||
# Cleanup | ||
rm -f "$SSH_KEY_PATH" | ||
echo "Signing process completed successfully." |
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
uses: dependabot/fetch-metadata@bfac3fa29cc6834ca2e3fd659343da191a65d971 # v1.3.1 | ||
with: | ||
github-token: "${{ secrets.GH_TOKEN }}" | ||
- name: Enable auto-merge for Dependabot PRs | ||
|
@@ -20,6 +20,6 @@ jobs: | |
GITHUB_TOKEN: ${{secrets.GH_TOKEN}} | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
- name: Auto approve dependabot PRs | ||
uses: hmarr/auto-approve-action@v2 | ||
uses: hmarr/auto-approve-action@7782c7e2bdf62b4d79bdcded8332808fd2f179cd #v2 | ||
with: | ||
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Delete release | ||
uses: dev-drprasad/[email protected] | ||
uses: dev-drprasad/delete-tag-and-release@5eafd8668311bf3e4d6c1e9898f32a317103de68 #v0.2.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
|
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 |
---|---|---|
|
@@ -30,7 +30,7 @@ permissions: | |
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
runs-on: macos-13 | ||
env: | ||
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | ||
APPLE_DEVELOPER_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | ||
|
@@ -43,9 +43,9 @@ jobs: | |
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.21.5' | ||
go-version-file: go.mod | ||
- name: Import Code-Signing Certificates | ||
uses: Apple-Actions/import-codesign-certs@v1 | ||
uses: Apple-Actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071 #v1 | ||
with: | ||
# The certificates in a PKCS12 file encoded as a base64 string | ||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | ||
|
@@ -61,27 +61,23 @@ jobs: | |
brew --version | ||
- name: Install gon | ||
run: | | ||
brew tap mitchellh/gon | ||
brew install mitchellh/gon/gon | ||
- name: Install and start docker | ||
brew install Bearer/tap/gon | ||
- name: Setup Docker on macOS | ||
if: inputs.dev == false | ||
run: | | ||
brew install docker | ||
colima start | ||
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock | ||
uses: douglascamata/setup-docker-macos-action@v1-alpha | ||
- name: Test docker | ||
if: inputs.dev == false | ||
run: | | ||
docker version | ||
docker info | ||
- name: Login to Docker Hub | ||
if: inputs.dev == false | ||
uses: docker/login-action@v1 | ||
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7 #v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 #v2 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | ||
aws-region: ${{ secrets.AWS_ASSUME_ROLE_REGION }} | ||
|
@@ -105,7 +101,7 @@ jobs: | |
- name: Echo GoReleaser Args | ||
run: echo ${{ env.GR_ARGS }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 #v3 | ||
with: | ||
version: v1.18.2 | ||
args: ${{ env.GR_ARGS }} | ||
|
@@ -114,6 +110,10 @@ jobs: | |
GO_BOT_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | ||
S3_BUCKET_REGION: ${{ secrets.S3_BUCKET_REGION }} | ||
SIGNING_REMOTE_SSH_USER: ${{ secrets.SIGNING_REMOTE_SSH_USER }} | ||
SIGNING_REMOTE_SSH_HOST: ${{ secrets.SIGNING_REMOTE_SSH_HOST }} | ||
SIGNING_REMOTE_SSH_PRIVATE_KEY: ${{ secrets.SIGNING_REMOTE_SSH_PRIVATE_KEY }} | ||
SIGNING_HSM_CREDS: ${{ secrets.SIGNING_HSM_CREDS }} | ||
|
||
notify: | ||
runs-on: ubuntu-latest | ||
|
@@ -131,7 +131,7 @@ jobs: | |
- name: Converts Markdown to HTML | ||
id: convert | ||
uses: lifepal/[email protected] | ||
uses: lifepal/markdown-to-html@71ed74a56602597c05dd7dd0e561631557158ed5 #v1.1 | ||
with: | ||
text: "${{ steps.release.outputs.body_release }}" | ||
|
||
|
@@ -144,7 +144,7 @@ jobs: | |
- name: Send a Notification | ||
id: notify | ||
uses: thechetantalwar/teams-notify@v2 | ||
uses: thechetantalwar/teams-notify@8a78811f5e8f58cdd204efebd79158006428c46b #v2 | ||
with: | ||
teams_webhook_url: ${{ secrets.TEAMS_WEBHOOK_URI }} | ||
message: "${{ steps.clean.outputs.clean }}" |
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
Oops, something went wrong.