Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-runner into action
  • Loading branch information
mxinden committed Mar 25, 2024
2 parents 7635261 + c3fe2e8 commit 64ad7ad
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Upload website to interop.seemann.io
uses: burnett01/rsync-deployments@c04732dab25a8b2c000b7198a067bf26e93959e2 # v6.0.0
uses: burnett01/rsync-deployments@e1c5b900e976bbc2a6aadf7fd85d7bef67ede4f1 # v7.0.0
with:
switches: -avzr --delete
path: web/
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ jobs:
find logs_measurement -depth -name "server" -type d -exec rm -r "{}" \;
mv logs_measurement/${{ matrix.server }}_${{ matrix.client }}/* logs/${{ matrix.server }}_${{ matrix.client }}/
- name: Upload logs to interop.seemann.io
uses: burnett01/rsync-deployments@c04732dab25a8b2c000b7198a067bf26e93959e2 # v6.0.0
uses: burnett01/rsync-deployments@e1c5b900e976bbc2a6aadf7fd85d7bef67ede4f1 # v7.0.0
if: ${{ github.event_name == 'schedule' }}
with:
switches: -avzr --relative
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
name: result-aggregated
path: result.json
- name: Upload logs to interop.seemann.io
uses: burnett01/rsync-deployments@c04732dab25a8b2c000b7198a067bf26e93959e2 # v6.0.0
uses: burnett01/rsync-deployments@e1c5b900e976bbc2a6aadf7fd85d7bef67ede4f1 # v7.0.0
if: ${{ github.event_name == 'schedule' }}
with:
switches: -avzr
Expand Down
41 changes: 22 additions & 19 deletions certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,59 @@

set -e

if [ -z "$1" ] || [ -z "$2" ] ; then
if [ -z "$1" ] || [ -z "$2" ]; then
echo "$0 <cert dir> <chain length>"
exit 1
fi

CERTDIR=$1
CHAINLEN=$2

mkdir -p $CERTDIR || true
mkdir -p "$CERTDIR" || true

# Generate Root CA and certificate
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 \
-keyout $CERTDIR/ca_0.key -out $CERTDIR/cert_0.pem \
openssl ecparam -name prime256v1 -genkey -out "$CERTDIR"/ca_0.key
openssl req -x509 -sha256 -nodes -days 10 -key "$CERTDIR"/ca_0.key \
-out "$CERTDIR"/cert_0.pem \
-subj "/O=interop runner Root Certificate Authority/" \
-config cert_config.txt \
-extensions v3_ca \
2> /dev/null

for i in $(seq 1 $CHAINLEN); do
for i in $(seq 1 "$CHAINLEN"); do
# Generate a CSR
SUBJ="interop runner intermediate $i"
if [[ $i == $CHAINLEN ]]; then
if [[ $i == "$CHAINLEN" ]]; then
SUBJ="interop runner leaf"
fi
openssl req -out $CERTDIR/cert.csr -new -newkey rsa:2048 -nodes -keyout $CERTDIR/ca_$i.key \

openssl ecparam -name prime256v1 -genkey -out "$CERTDIR"/ca_"$i".key
openssl req -out "$CERTDIR"/cert.csr -new -key "$CERTDIR"/ca_"$i".key -nodes \
-subj "/O=$SUBJ/" \
2> /dev/null

# Sign the certificate
j=$(($i-1))
if [[ $i < $CHAINLEN ]]; then
openssl x509 -req -sha256 -days 365 -in $CERTDIR/cert.csr -out $CERTDIR/cert_$i.pem \
-CA $CERTDIR/cert_$j.pem -CAkey $CERTDIR/ca_$j.key -CAcreateserial \
j=$((i-1))
if [[ $i < "$CHAINLEN" ]]; then
openssl x509 -req -sha256 -days 10 -in "$CERTDIR"/cert.csr -out "$CERTDIR"/cert_"$i".pem \
-CA "$CERTDIR"/cert_"$j".pem -CAkey "$CERTDIR"/ca_"$j".key -CAcreateserial \
-extfile cert_config.txt \
-extensions v3_ca \
2> /dev/null
else
openssl x509 -req -sha256 -days 365 -in $CERTDIR/cert.csr -out $CERTDIR/cert_$i.pem \
-CA $CERTDIR/cert_$j.pem -CAkey $CERTDIR/ca_$j.key -CAcreateserial \
openssl x509 -req -sha256 -days 10 -in "$CERTDIR"/cert.csr -out "$CERTDIR"/cert_"$i".pem \
-CA "$CERTDIR"/cert_"$j".pem -CAkey "$CERTDIR"/ca_"$j".key -CAcreateserial \
-extfile <(printf "subjectAltName=DNS:server,DNS:server4,DNS:server6,DNS:server46") \
2> /dev/null
fi
done

mv $CERTDIR/cert_0.pem $CERTDIR/ca.pem
cp $CERTDIR/ca_$CHAINLEN.key $CERTDIR/priv.key
mv "$CERTDIR"/cert_0.pem "$CERTDIR"/ca.pem
cp "$CERTDIR"/ca_"$CHAINLEN".key "$CERTDIR"/priv.key

# combine certificates
for i in $(seq $CHAINLEN -1 1); do
cat $CERTDIR/cert_$i.pem >> $CERTDIR/cert.pem
rm $CERTDIR/cert_$i.pem $CERTDIR/ca_$i.key
for i in $(seq "$CHAINLEN" -1 1); do
cat "$CERTDIR"/cert_"$i".pem >> "$CERTDIR"/cert.pem
rm "$CERTDIR"/cert_"$i".pem "$CERTDIR"/ca_"$i".key
done
rm -f $CERTDIR/*.srl $CERTDIR/ca_0.key $CERTDIR/cert.csr
rm -f "$CERTDIR"/*.srl "$CERTDIR"/ca_0.key "$CERTDIR"/cert.csr
5 changes: 5 additions & 0 deletions interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class InteropRunner:
_tests = []
_measurements = []
_output = ""
_markdown = False
_log_dir = ""
_save_files = False

Expand All @@ -58,6 +59,7 @@ def __init__(
tests: List[testcases.TestCase],
measurements: List[testcases.Measurement],
output: str,
markdown: bool,
debug: bool,
save_files=False,
log_dir="",
Expand All @@ -76,6 +78,7 @@ def __init__(
self._client_server_pairs = client_server_pairs
self._implementations = implementations
self._output = output
self._markdown = markdown
self._log_dir = log_dir
self._save_files = save_files
if len(self._log_dir) == 0:
Expand Down Expand Up @@ -187,6 +190,8 @@ def get_letters(result):

if len(self._tests) > 0:
t = prettytable.PrettyTable()
if self._markdown:
t.set_style(prettytable.MARKDOWN)
t.hrules = prettytable.ALL
t.vrules = prettytable.ALL
rows = {}
Expand Down
9 changes: 9 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def get_args():
parser.add_argument(
"-j", "--json", help="output the matrix to file in json format"
)
parser.add_argument(
"-m",
"--markdown",
help="output the matrix in Markdown format",
action="store_const",
const=True,
default=False,
)
parser.add_argument(
"-i",
"--must-include",
Expand Down Expand Up @@ -149,6 +157,7 @@ def get_tests_and_measurements(
tests=t[0],
measurements=t[1],
output=get_args().json,
markdown=get_args().markdown,
debug=get_args().debug,
log_dir=get_args().log_dir,
save_files=get_args().save_files,
Expand Down

0 comments on commit 64ad7ad

Please sign in to comment.