Skip to content

Commit

Permalink
Merge pull request #5 from canonical/enable-security-monitoring
Browse files Browse the repository at this point in the history
[DPE-6078] Enable security monitoring
  • Loading branch information
reneradoi authored Dec 6, 2024
2 parents ea218e9 + c6116be commit 878db63
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
sudo addgroup --system docker; sudo adduser $USER docker
newgrp docker
sudo snap disable docker; sudo snap enable docker
- name: Install skopeo
- name: Install rockcraft.skopeo
run: |
sudo snap install --devmode --channel edge skopeo
sudo snap install rockcraft --classic
- name: Install yq
run: |
sudo snap install yq
Expand All @@ -49,7 +49,7 @@ jobs:
base=$(yq '(.base|split("@"))[1]' rockcraft.yaml)
tag=${version}-${base}-${{ env.RELEASE }}
echo "Publishing valkey:${tag}"
sudo skopeo --insecure-policy copy \
sudo rockcraft.skopeo --insecure-policy copy \
oci-archive:valkey_${rock_image_version}_amd64.rock \
docker-daemon:ghcr.io/canonical/valkey:${tag}
docker push ghcr.io/canonical/valkey:${tag}
44 changes: 44 additions & 0 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Trivy Security Scanner
on:
push:
branches:
- main
pull_request:

jobs:
build:
uses: ./.github/workflows/build.yaml
scan:
name: Trivy scan
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install rockcraft.skopeo
run: |
sudo snap install rockcraft --classic
- uses: actions/download-artifact@v3
with:
name: valkey-rock
path: .
- name: Import locally
run: |
rock_image_version=$(yq '(.version)' rockcraft.yaml)
sudo rockcraft.skopeo --insecure-policy copy \
oci-archive:valkey_${rock_image_version}_amd64.rock \
docker-daemon:trivy/valkey:test
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'trivy/valkey:test'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'MEDIUM,HIGH,CRITICAL'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: 'trivy-results.sarif'
72 changes: 72 additions & 0 deletions usr/share/rocks/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: charmed-valkey # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '7.2.5' # just for humans, typically '1.2+git' or '1.3.2'
summary: 'Valkey: open source, in memory datastore as a snap' # 79 char long summary
description: |
Valkey is an open source, in memory datastore released under
the BSD-3 Clause License. It is a continuation of the work
that was being done on Redis 7.2.4.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

apps:
server:
command: usr/bin/valkey-server
daemon: simple
restart-condition: always
environment:
LANG: C.UTF-8
plugs:
- network
- network-bind
- network-observe
- home
cli:
command: usr/bin/valkey-cli
plugs:
- network
- network-bind
- network-observe
- home
benchmark:
command: usr/bin/valkey-benchmark
plugs:
- network
- network-bind
- network-observe
- home
check-aof:
command: usr/bin/valkey-check-aof
plugs:
- network
- network-bind
- network-observe
- home
check-rdb:
command: usr/bin/valkey-check-rdb
plugs:
- network
- network-bind
- network-observe
- home
sentinel:
command: usr/bin/valkey-sentinel
environment:
LANG: C.UTF-8
plugs:
- network
- network-bind
- network-observe
- home

parts:
valkey:
plugin: make
source: https://github.com/valkey-io/valkey/archive/refs/tags/7.2.5.tar.gz
override-build: |
mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr
make BUILD_TLS=yes
PREFIX=${SNAPCRAFT_PART_INSTALL}/usr make BUILD_TLS=yes install
build-packages:
- libssl-dev

0 comments on commit 878db63

Please sign in to comment.