Skip to content
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

Importing JoshiaSiegel GitHub Actions #16023

Merged
merged 45 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
868d84f
Importing JosiahSiegel's action-connect-ovpn GitHub Action
emvaldes Sep 27, 2024
2e5d219
Importing JosiahSiegel's runleaks GitHub Action
emvaldes Sep 27, 2024
9fc1cfb
Importing JosiahSiegel's terraform-stats GitHub Action
emvaldes Sep 27, 2024
0a17185
Merge branch 'master' into importing-gha
emvaldes Oct 8, 2024
0d97a80
Correcting the terraform-stats GitHub Action with the specific used c…
emvaldes Oct 8, 2024
4705450
Importing JosiahSiegel's AzViz-action GitHub Action
emvaldes Oct 8, 2024
bf62adf
Importing JosiahSiegel's checksum-validate-action GitHub Action
emvaldes Oct 8, 2024
723e791
Importing JosiahSiegel's randomrepo GitHub Action
emvaldes Oct 8, 2024
6bc4b29
Importing JosiahSiegel's reliable-pull-request-action GitHub Action
emvaldes Oct 8, 2024
c6865d3
Importing JosiahSiegel's remote-branch-action GitHub Action
emvaldes Oct 8, 2024
a933908
Importing JosiahSiegel's slack-boltjs-app GitHub Action
emvaldes Oct 8, 2024
1acb1eb
Importing JosiahSiegel's workflow-housekeeper GitHub Action
emvaldes Oct 8, 2024
986f7b3
Merge branch 'master' into importing-gha
emvaldes Oct 8, 2024
fe62ba3
Modifying links to JosiahSiegel's GHA (remote repositories)
emvaldes Oct 8, 2024
a538a8a
Modifying links to JosiahSiegel's GHA (remote repositories)
emvaldes Oct 8, 2024
bcdd7f1
Reverting changes to references for JosiahSiegel's GHA (remote reposi…
emvaldes Oct 8, 2024
05620bd
Pre-setting workflows configuration changes for referencing JosiahSie…
emvaldes Oct 8, 2024
be2a6b5
Updated the imported GitHub Actions documentation (README.md)
emvaldes Oct 9, 2024
1fa78a9
Merge branch 'master' into importing-gha
emvaldes Oct 9, 2024
7ee6a6e
Correcting self/cross referenced repos within these GitHub Actions
emvaldes Oct 9, 2024
9b56f4c
Importing JosiahSiegel's rapid-wsl GitHub Action
emvaldes Oct 9, 2024
2a75e41
Importing JosiahSiegel's stackoverflow_in_pg GitHub Action
emvaldes Oct 9, 2024
c414690
Importing JosiahSiegel's terraform-templates GitHub Action
emvaldes Oct 9, 2024
b11a870
Correcting imported JosiahSiegel's repos as submodules
emvaldes Oct 10, 2024
5bd7df7
Importing JosiahSiegel's git-secrets GitHub Action
emvaldes Oct 10, 2024
d2c10b2
Merge branch 'master' into importing-gha
emvaldes Oct 15, 2024
fb486a7
Update dependabot.yml
emvaldes Oct 15, 2024
c4652b7
Merge branch 'master' into importing-gha
emvaldes Oct 15, 2024
28f3731
Merge branch 'master' into importing-gha
emvaldes Oct 15, 2024
39534c5
Merge branch 'master' into importing-gha
emvaldes Oct 22, 2024
ae9f58a
Restructuring the scope for target GitHub Actions to be imported
Oct 22, 2024
80e3ee7
Customizing this GitHub Action as an internal feature
Oct 22, 2024
7a6ee08
Masking action-result to avoid breaking build
Oct 22, 2024
f6900d6
Masking action-result to avoid breaking build
Oct 22, 2024
3419c9e
Masking action-result to avoid breaking build
Oct 22, 2024
09cabfc
Configuring daily schedule package-ecosystem for action-connect-ovpn
Oct 22, 2024
a9bdd22
Merge branch 'master' into importing-gha
emvaldes Oct 22, 2024
1cf6059
Merge branch 'master' into importing-gha
emvaldes Oct 22, 2024
68f687f
Merge branch 'master' into importing-gha
emvaldes Oct 22, 2024
09fb31a
Updating the markers with a Corporate email account for clarity
emvaldes Oct 22, 2024
0604e24
Finalizing some changes based on Matt's recommendations
emvaldes Oct 22, 2024
828661a
Merge branch 'master' into importing-gha
emvaldes Oct 22, 2024
5af3c9c
Adjusted the markers to reflect a changed by the DevSecOps - Aquia team
emvaldes Oct 22, 2024
31b2d85
Merge branch 'master' into importing-gha
emvaldes Oct 22, 2024
d34c441
Merge branch 'master' into importing-gha
emvaldes Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/action-connect-ovpn/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
*.crt
emvaldes marked this conversation as resolved.
Show resolved Hide resolved
*.key
*.txt
96 changes: 96 additions & 0 deletions .github/actions/action-connect-ovpn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<div align="center"><h1>Actions Connect Open VPN</h1></div>

>*Replaced deprecated [`set-output`](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/)*

> v2 switches to openvpn CLI for stability

## Example file `.ovpn` to connect vpn

[Example.ovpn](./example.ovpn)

## Configuration with With

The following settings must be passed as environment variables as shown in the
example.

| Key | Value | Suggested Type | Required | Default |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------- | --------------- |
| `FILE_OVPN` | Location file open vpn and . | `env` | **Yes** | `./config.ovpn` |
| `PING_URL` | URL for check status vpn connect pass or fail | `env` | **Yes** | `127.0.0.1` |
| `SECRET` | Username password for access vpn`(Encode base 64 before set secret.)`[How to encode base 64 ?](https://www.base64encode.org/). | `secret env` | No | `''` |
| `TLS_KEY` | Tls-crypt for access vpn `(Encode base 64 before set secret.)`[How to encode base 64 ?](https://www.base64encode.org/). | `secret env` | No | `''` |

## Configuration with Env

The following settings must be passed as environment variables as shown in the
example.

| Key | Value | Suggested Type | Required | Default |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------- | ------- |
| `CA_CRT` | Certificate for access vpn `(Encode base 64 before set secret.)`[How to encode base 64 ?](https://www.base64encode.org/). | `secret env` | **Yes** | N/A |
| `USER_CRT` | User certificate for access vpn. `(Encode base 64 before set secret.)`[How to encode base 64 ?](https://www.base64encode.org/). | `secret env` | **Yes** | N/A |
| `USER_KEY` | User key for access vpn. `(Encode base 64 before set secret.)`[How to encode base 64 ?](https://www.base64encode.org/). | `secret env` | **Yes** | N/A |

## Outputs

### `STATUS`

**Boolean** Can get status after connect `true` or `false`.

## Example usage

```yml
connect-open-vpn:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Open VPN
run: sudo apt-get install openvpn
- name: Connect VPN
uses: golfzaptw/action-connect-ovpn@master
id: connect_vpn
with:
PING_URL: '127.0.0.1'
FILE_OVPN: '.github/vpn/config.ovpn'
SECRET: ${{ secrets.SECRET_USERNAME_PASSWORD }}
TLS_KEY: ${{ secrets.TLS_KEY }}
env:
CA_CRT: ${{ secrets.CA_CRT}}
USER_CRT: ${{ secrets.USER_CRT }}
USER_KEY: ${{ secrets.USER_KEY }}
- name: Check Connect VPN
run: echo ${{ steps.connect_vpn.outputs.STATUS }}
- name: kill vpn
if: always()
run: sudo killall openvpn
```

## How to prepare file .ovpn

### Step

1. Copy the data inside the tags
`<ca></ca>`
`<cert></cert>`
`<key></key>`
and encode those values to base64. Then save those values (without a new line!) to the secrets in github actions

2. In the .ovpn file in your repo, remove the tags
`<ca></ca>`
`<cert></cert>`
`<key></key> `
and replace the values with
```
ca ca.crt
cert user.crt
key user.key
```

This will allow the values to be filled in from Github secrets.

3. If your open vpn configuration has a username and password please encode those in base64. After that, save the values in the github actions secrets.
format username password
username-vpn
password-vpn

4. If open vpn have tag `<tls></tls>` please repeat step 1 and 2 for the TLS records.
64 changes: 64 additions & 0 deletions .github/actions/action-connect-ovpn/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'Connect-VPN-action'
description: 'Connect VPN action'
branding:
icon: 'shield'
color: 'orange'
inputs:
SECRET:
description: 'Username and password for access vpn'
required: false
default: ''
TLS_KEY:
description: 'User key for access vpn'
required: false
default: ''
PING_URL:
description: 'For check success or fail'
required: true
default: '127.0.0.1'
FILE_OVPN:
description: 'Location file open vpn'
required: true
default: './config.ovpn'
outputs:
STATUS:
description: 'Status for check connect vpn'
value: ${{ steps.vpn_status.outputs.vpn-status }}
runs:
using: "composite"
steps:
- name: Install OpenVPN
run: |
sudo apt-get update
sudo apt-get install openvpn
sudo apt-get install openvpn-systemd-resolved
shell: bash

- name: Connect VPN
env:
TLS_KEY: ${{ inputs.TLS_KEY }}
emvaldes marked this conversation as resolved.
Show resolved Hide resolved
CA_CRT: ${{ env.CA_CRT}}
USER_CRT: ${{ env.USER_CRT }}
USER_KEY: ${{ env.USER_KEY }}
SECRET: ${{ inputs.SECRET }}
shell: bash
run: |
echo "$TLS_KEY" | base64 -d > tls.key
echo "$CA_CRT" | base64 -d > ca.crt
echo "$USER_CRT" | base64 -d > user.crt
echo "$USER_KEY" | base64 -d > user.key
echo "$SECRET" | base64 -d > secret.txt
sudo openvpn --config ${{ inputs.FILE_OVPN }} --daemon

- name: VPN Status
id: vpn_status
env:
PING_URL: ${{ inputs.PING_URL }}
shell: bash
run: |
sleep 5
if ping -c 2 $PING_URL > /dev/null 2>&1; then
echo "vpn-status=true" >> $GITHUB_OUTPUT
else
echo "vpn-status=false" >> $GITHUB_OUTPUT
fi
38 changes: 38 additions & 0 deletions .github/actions/action-connect-ovpn/example.ovpn
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// FULL FILE OVPN

client
dev tun
proto udp
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
auth-nocache
verb 3
<ca>
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
b1:b0:0b:1a:ad:05:54:0f
-----BEGIN CERTIFICATE-----
MIIBtjCCAVygAwIBAgIUbPYCDoO+XmScoS84AhQsbnKvd84wCgYIKoZIzj0EAwIw
u1MjifHr6jMxwQ==
-----END CERTIFICATE-----
</ca>
<cert>
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
b1:b0:0b:1a:ad:05:54:0f
-----BEGIN CERTIFICATE-----
MIIBtjCCAVygAwIBAgIUbPYCDoO+XmScoS
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN CERTIFICATE-----
MIIBtjCCAVygAwIBAgIUbPYCDoO+XmScoS84AhQsbn
-----END CERTIFICATE-----
</key>
6 changes: 4 additions & 2 deletions .github/actions/deploy-backend/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ runs:
echo "::add-mask::$value"
echo "$secret_get=$value" >> $GITHUB_OUTPUT
done


- name: Create ssl key file
if: env.USE_DCT == 'true'
Expand All @@ -152,7 +151,7 @@ runs:
shell: bash
env:
SSL_KEY: ${{ steps.key-vault.outputs[env.KEY_NAME] }}

emvaldes marked this conversation as resolved.
Show resolved Hide resolved
- name: Confirm if runner is a signer
if: env.USE_DCT == 'true'
working-directory: prime-router
Expand Down Expand Up @@ -333,7 +332,10 @@ runs:

- name: Validate function app checksum
if: inputs.checksum-validation == 'true'

uses: JosiahSiegel/checksum-validate-action@ebdf8c12c00912d18de93c483b935d51582f9236
## eduardo.valdes@aquia.io (Replace) uses: ./.github/actions/checksum-validate-action

with:
key: backend
validate: true
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/vpn-azure/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ runs:
shell: bash

- uses: josiahsiegel/action-connect-ovpn@794339aff94452216c97f609476c367a43a31295
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/action-connect-ovpn

if: inputs.env-name && inputs.ca-cert != 'false'
id: connect_vpn
with:
Expand Down Expand Up @@ -79,7 +81,7 @@ runs:
$env:ARM_CLIENT_SECRET = $servicePrincipal.clientSecret
$env:ARM_SUBSCRIPTION_ID = $servicePrincipal.subscriptionId
$env:ARM_TENANT_ID = $servicePrincipal.tenantId

# Save environment variable setup for subsequent steps
Get-ChildItem -Path Env: -Recurse -Include ARM_* | ForEach-Object {Write-Output "$($_.Name)=$($_.Value)"} >> $env:GITHUB_ENV
shell: pwsh
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ updates:
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/.github/actions/action-connect-ovpn"
schedule:
interval: "daily"

# Frontend
- package-ecosystem: "npm"
directory: "/frontend-react"
Expand Down Expand Up @@ -334,7 +339,7 @@ updates:
time: "04:17"
timezone: "US/Eastern"
rebase-strategy: "disabled"

# Backend
- package-ecosystem: "gradle"
directory: "/prime-router"
Expand Down
21 changes: 21 additions & 0 deletions .github/vpn/config.ovpn
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

client
dev tun
proto tcp
remote 188.94.28.233 443
verify-x509-name "C=de, L=Hamburg, O=IT works Consulting GmbH, CN=inf-gw-r1-06, emailAddress=technik@itworks-hh.de"
route remote_host 255.255.255.255 net_gateway
resolv-retry infinite
nobind
persist-key
persist-tun
auth-user-pass secret.txt
cipher AES-256-CBC
auth SHA256
comp-lzo no
route-delay 4
verb 3
reneg-sec 0
ca ca.crt
cert user.crt
key user.key
10 changes: 6 additions & 4 deletions .github/workflows/alert_terraform_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ jobs:
user-key: ${{ secrets.USER_KEY }}
sp-creds: ${{ secrets.SERVICE_PRINCIPAL_CREDS }}
tf-auth: true

- name: Collect Terraform stats

uses: josiahsiegel/terraform-stats@68b8cbe42c494333fbf6f8d90ac86da1fb69dcc2
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/terraform-stats

id: stats1
with:
terraform-directory: operations/app/terraform/vars/${{ matrix.env }}
Expand All @@ -46,7 +49,7 @@ jobs:
echo "resource-drifts=$(echo '${{ steps.stats1.outputs.resource-drifts }}' \
| sed 's/\"/\\\"/g' | sed 's/\\\\\"/\\\\\\"/g')" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT

- name: Slack Notification
if: ${{ steps.format_out.outputs.CHANGES != '' }}
uses: ./.github/actions/notifications
Expand All @@ -57,9 +60,8 @@ jobs:
"change-count": "${{ steps.stats1.outputs.change-count }}"
"drift-count": "${{ steps.stats1.outputs.drift-count }}"
"resource-drifts": "${{ env.resource-drifts }}"

icon-emoji: ':bell:'
channel: pagerduty-alert-dump
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
color: warning

3 changes: 3 additions & 0 deletions .github/workflows/deploy_terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ jobs:
sp-creds: ${{ secrets.SERVICE_PRINCIPAL_CREDS }}
tf-auth: true
- name: Collect Terraform stats

uses: josiahsiegel/terraform-stats@68b8cbe42c494333fbf6f8d90ac86da1fb69dcc2
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/terraform-stats

id: stats1
with:
terraform-directory: operations/app/terraform/vars/${{ needs.pre_job.outputs.env_name }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/log_management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ jobs:
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: Workflow Housekeeper - workflows NOT in default branch

uses: JosiahSiegel/workflow-housekeeper@731cc20bb613208b34efb6ac74aab4ba147abb50
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/workflow-housekeeper

env:
GITHUB_TOKEN: ${{ secrets.LOG_MANAGEMENT_TOKEN }}
with:
Expand All @@ -21,7 +24,10 @@ jobs:
retain-run-count: 0
dry-run: false
- name: Workflow Housekeeper - workflows in default branch

uses: JosiahSiegel/workflow-housekeeper@731cc20bb613208b34efb6ac74aab4ba147abb50
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/workflow-housekeeper

env:
GITHUB_TOKEN: ${{ secrets.LOG_MANAGEMENT_TOKEN }}
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/prepare_deployment_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ jobs:
echo "Branch name: \"${BRANCH_NAME}\""

- name: "Create branch '${{ env.BRANCH_NAME }}' to contain the changes for the deployment on ${{ env.DEPLOYMENT_DATE }}"

uses: JosiahSiegel/remote-branch-action@dbe7a2138eb064fbfdb980abee918091a7501fbe
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/remote-branch-action

with:
branch: "${{ env.BRANCH_NAME }}"

- name: "Prepare a Pull Request from ${{ env.BRANCH_NAME }} into production branch"
id: pr

uses: JosiahSiegel/reliable-pull-request-action@ae8d0c88126329ee363a35392793d0bc94cb82e7
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/reliable-pull-request-action

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release_to_azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ jobs:
env:
checksum_validation: ${{ vars.CHECKSUM_VALIDATION }}
if: needs.pre_job.outputs.has_router_change == 'true' && env.checksum_validation == 'true'

uses: JosiahSiegel/checksum-validate-action@ebdf8c12c00912d18de93c483b935d51582f9236
## eduardo.valdes@aquia.io (Replace) - uses: ./.github/actions/checksum-validate-action

with:
key: backend
input: $(az functionapp config appsettings list -g prime-data-hub-${{ needs.pre_job.outputs.env_name }} -n pdh${{ needs.pre_job.outputs.env_name }}-functionapp -o tsv | sort)
Expand Down
Loading
Loading