-
Notifications
You must be signed in to change notification settings - Fork 11
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
61 changed files
with
1,563 additions
and
443 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 |
---|---|---|
|
@@ -5,30 +5,31 @@ | |
# Author: Marco Massenzio ([email protected]) | ||
# | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [ release ] | ||
branches: | ||
- release | ||
|
||
jobs: | ||
create-tag: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
AUTHOR: ${{ github.event.pusher.name }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Create a Release Tag | ||
run: | | ||
git config user.name "$AUTHOR" | ||
git config user.email "<[email protected]>" | ||
./make-tag.sh | ||
env: | ||
AUTHOR: ${{ github.event.pusher.name }} | ||
EMAIL: ${{ github.event.pusher.email }} | ||
KEYRING_FILE: /tmp/keyring.gpg | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
KEYRING_FILE: /tmp/keyring.gpg | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Create a Release Tag | ||
run: | | ||
git config user.name "$AUTHOR" | ||
git config user.email "<$EMAIL>" | ||
TAG=$(./get-version.sh) | ||
git tag -a $TAG -m "Release $TAG" | ||
git push --tags | ||
echo TAG=${TAG} >> $GITHUB_ENV | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
|
@@ -54,3 +55,9 @@ jobs: | |
- name: Publish to Sonatype | ||
run: | | ||
chmod +x gradlew && ./gradlew publish | ||
# Creates a new release in GitHub, with auto-generated content. | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ env.TAG }} | ||
generateReleaseNotes: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,44 +3,33 @@ | |
# Copyright (c) 2021 AlertAvert.com. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Author: Marco Massenzio ([email protected]) | ||
# | ||
|
||
# | ||
# Generates a Elliptict Cryptography keypair using openssl | ||
|
||
set -e | ||
set -eu | ||
|
||
function usage { | ||
echo "Usage: $(basename $0) KEY [DIR] | ||
KEY the name of the key pair to upload, required; | ||
echo "Usage: $(basename $0) KEY SECRET | ||
DIR optionally, a directory where the keypair is stored | ||
KEY the path to the key pair to upload, WITHOUT extension | ||
SECRET the name of the secret to create in AWS Secrets Manager | ||
This script uploads a key pair named 'KEY.pem' and 'KEY.pub' to AWS Secrets Manager, | ||
using the \$AWS_PROFILE env var to obtain the credentials and the region to upload to. | ||
Use \$AWS_ENDPOINT to specify a custom endpoint for the Secrets Manager service, if not using | ||
the default AWS endpoint (eg, when testing against a localstack container, you can use | ||
http://localhost:4566). | ||
The pair can be generated using the keygen.sh script. | ||
Requires the aws binary CLI (https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) | ||
" | ||
} | ||
|
||
KEY=${1:-} | ||
DIR=${2:-} | ||
SECRET=${2:-} | ||
ENDPOINT_URL="" | ||
|
||
if [[ -z ${KEY} || ${1:-} == "--help" || ${1:-} == "-h" ]]; then | ||
if [[ -z ${KEY} || -z ${SECRET} || ${1:-} == "-h" ]]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
@@ -52,27 +41,37 @@ then | |
exit 1 | ||
fi | ||
|
||
if [[ -n ${AWS_ENDPOINT:-} ]]; then | ||
ENDPOINT_URL="--endpoint-url ${AWS_ENDPOINT}" | ||
fi | ||
|
||
PRIV=${KEY}.pem | ||
PUB=${KEY}.pub | ||
if [[ -n ${DIR} && -d ${DIR} ]]; then | ||
PRIV=${DIR}/${PRIV} | ||
PUB=${DIR}/${PUB} | ||
if [[ ! -f ${PRIV} || ! -f ${PUB} ]]; then | ||
usage | ||
echo "ERROR: Cannot find ${PRIV} and/or ${PUB} keys" | ||
exit 1 | ||
fi | ||
|
||
out=$(mktemp /tmp/secret-XXXXXXXX.tmp) | ||
cat <<EOF >$out | ||
{ | ||
"priv": "$(while read -r line; do if [[ ! ${line} =~ ^----- ]]; \ | ||
then echo -n ${line}; fi; done < $PRIV)", | ||
"pub": "$(while read -r line; do [[ ${line} =~ ^----- ]] || echo -n ${line}; done < $PUB)", | ||
"algorithm": "EC" | ||
then echo -n ${line}; fi; done < ${PRIV})", | ||
"pub": "$(while read -r line; do [[ ${line} =~ ^----- ]] || echo -n ${line}; \ | ||
done < ${PUB})" | ||
} | ||
EOF | ||
|
||
aws secretsmanager create-secret --name $KEY \ | ||
--description "Keypair $KEY generated by the $(basename $0) script" \ | ||
--secret-string file://$out | ||
|
||
set +e | ||
res=$(aws ${ENDPOINT_URL} secretsmanager create-secret --name ${SECRET} --output json \ | ||
--description "Elliptic Cryptography Keypair generated by the $(basename $0) script" \ | ||
--secret-string file://${out}) | ||
if [[ $? != 0 ]] | ||
then | ||
echo "[ERROR] Failed to upload ${SECRET}: keys have kept behind in ${out}" | ||
exit 1 | ||
fi | ||
arn=$(echo ${res} | jq -r '.ARN') | ||
rm $out | ||
echo "[SUCCESS] Key Pair uploaded to AWS: ${KEY}" | ||
echo "${arn}" |
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,40 @@ | ||
# Copyright AlertAvert.com (c) 2022. All rights reserved. | ||
|
||
version: '3.2' | ||
|
||
services: | ||
opa: | ||
container_name: opa | ||
hostname: opa | ||
image: openpolicyagent/opa:0.42.2 | ||
command: run --server --addr :8181 | ||
ports: | ||
- "8181:8181" | ||
networks: | ||
- backend | ||
|
||
mongo: | ||
container_name: "mongo" | ||
image: "mongo:4" | ||
hostname: mongo | ||
ports: | ||
- "27017:27017" | ||
networks: | ||
- backend | ||
volumes: | ||
- mongo_data:/data | ||
|
||
### INFRASTRUCTURE | ||
|
||
volumes: | ||
mongo_data: | ||
|
||
# To connect to the servers in this stack, from a container run | ||
# via Docker, use `--network docker_backend`. | ||
# The hosts listed above will then be reachable at the given names, | ||
# on whatever ports are exposed. | ||
networks: | ||
backend: | ||
ipam: | ||
config: | ||
- subnet: 172.1.2.0/24 |
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 |
---|---|---|
|
@@ -3,16 +3,11 @@ | |
# Copyright (c) 2022 AlertAvert.com. All rights reserved. | ||
# Author: Marco Massenzio ([email protected]) | ||
# | ||
# Usage: get-version [build] | ||
# Extracts version from build.gradle | ||
# | ||
# build is the path to the build.gradle file, defaults to ./build.gradle | ||
|
||
set -eu | ||
workdir=$(dirname $0) | ||
|
||
build=${1:-build.gradle} | ||
|
||
# Note the use of -E to enable "extended" RegExps syntax (* and ?). | ||
grep -E '^[[:blank:]]*version' ${build} |\ | ||
grep -E '^[[:blank:]]*version' ${workdir}/jwt-opa/build.gradle |\ | ||
sed -E 's/^[[:blank:]]*version[[:blank:]]*=?[[:blank:]]*//' |\ | ||
sed "s/'//g" | sed 's/[[:blank:]]*$//' |
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.