Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit c689241

Browse files
committed
gen self-signed cert in setup_env.sh
1 parent b5b985e commit c689241

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed
File renamed without changes.

gen-self-signed-cert.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
pushd tlsn/notary/
6+

setup_env.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,14 @@ else
117117
OUT_REDIR=">/dev/null 2>&1"
118118
fi
119119

120+
ALL_SERVERS="All servers"
121+
120122
if [ -z "$install_target" ]; then
121123
install_mpspdz=true
122124
install_prover=true
123125
install_verifier=true
124126
install_notary=true
125-
install_target="All servers"
127+
install_target=ALL_SERVERS
126128
fi
127129

128130
if [ "$install_prover" = true ] || [ "$install_verifier" = true ] || [ "$install_notary" = true ]; then
@@ -269,6 +271,20 @@ if [ "$install_rust" = true ]; then
269271
print "Building Notary Server..."
270272
spushd notary/server
271273
eval "cargo build --release $OUT_REDIR"
274+
275+
# Generate self-signed certificate if all servers configuration
276+
if [ "$install_target" = "$ALL_SERVERS" ]; then
277+
spushd fixture/tls
278+
279+
openssl genpkey -algorithm RSA -out notary.key -pkeyopt rsa_keygen_bits:2048 \
280+
&& openssl req -new -key notary.key -out request.csr -subj "/C=US/ST=State/L=City/O=Organization/OU=Department/CN=127.0.0.1" \
281+
&& openssl x509 -req -in request.csr -signkey notary.key -out notary.crt -days 365 -extfile openssl.cnf -extensions v3_req
282+
283+
# copy notary.crt to repository root so that binance prover can use
284+
cp notary.crt $MPC_DEMO_INFRA_ROOT
285+
spopd # pushd fixture/tls
286+
fi
287+
272288
cp -R fixture ../target/release
273289
mkdir -p ../target/release/config
274290
cp $MPC_DEMO_INFRA_ROOT/mpc_demo_infra/notary_server/docker/config.yaml ../target/release/config

0 commit comments

Comments
 (0)