-
Notifications
You must be signed in to change notification settings - Fork 14
99 lines (91 loc) · 3.14 KB
/
check_gpg_key_not_expired.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: "Check Mondoo's GPG key is not expired"
on:
workflow_dispatch:
# Run every day at 00:00
schedule:
- cron: '0 0 * * *'
jobs:
check_gpg:
name: Check Mondoo's GPG key has not expired
env:
# C07R9GSGKEU == #mondoo-ops
SLACK_BOT_CHANNEL_ID: "C07R9GSGKEU"
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ env.SLACK_BOT_CHANNEL_ID }}
payload: |
{
"attachments": [
{
"color": "#FFFF00",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>"
},
{
"type": "mrkdwn",
"text": "*Status:*\n`In Progress`"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Install Mondoo cnspec
shell: bash
run: |
echo Installing Mondoo cnspec...
bash -xc "$(curl -sSL https://install.mondoo.com/sh/cnspec)"
- name: Check expiration of public-package-signing.gpg
shell: bash
run: |
cnspec providers install network
cnspec scan local --detect-cicd --score-threshold 100 --policy-bundle test/cnspec/check-gpg.mql.yaml -o full
- name: Install OpenPGP & cURL
run: sudo apt install gpg -y
- name: Check Public GPG Signing Key Harmony
shell: bash
run: |
bash test/scripts/cert-harmony.sh
- uses: slackapi/[email protected]
if: always()
with:
channel-id: ${{ env.SLACK_BOT_CHANNEL_ID }}
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"attachments": [
{
"color": "${{ job.status == 'success' && '#00FF00' || job.status == 'failure' && '#FF0000' || '#FFA500' }}",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>"
},
{
"type": "mrkdwn",
"text": "*Status:*\n`${{ job.status }}`"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}