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

Commit edfdcf0

Browse files
authored
Merge pull request #166 from exfinen/update-a
Generate self-signed cert in setup_env.sh
2 parents 95e5d11 + c689241 commit edfdcf0

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed
File renamed without changes.

gen-self-signed-cert.sh

+6
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

+18-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spopd() {
4444
}
4545

4646
inst_pp() {
47-
[ "$1" = true ] && echo "*Install*" || echo "-"
47+
[ "$1" = true ] && echo "*Installed*" || echo "-"
4848
}
4949

5050
append_target() {
@@ -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

tlsn/notary/server/fixture/tls/openssl.cnf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ keyUsage = nonRepudiation, digitalSignature, keyEncipherment
44
subjectAltName = @alt_names
55

66
[ alt_names ]
7-
DNS.1 = tlsnotaryserver.io
7+
IP.1 = 127.0.0.1

0 commit comments

Comments
 (0)