aboutsummaryrefslogtreecommitdiff
path: root/test/init.sh
blob: 5a8d1980c7267ab5087cab46eb399cb65b734031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
#
# Copyright (C) 2021 jahoti <jahoti@tilde.team>
# Licensing information is collated in the `copyright` file

# Initialize the root certificate for the tests proxy server
# Make sure this is run in the directory where they will be put!

gen_keys () {
    while [ -n "$1" ]; do
	openssl genrsa -out "${1}".key 4096
    done
}

if [ -n "$1" ]; then
    cd "$1"
fi
gen_keys ca cert
openssl req -new -x509 -days ${2:-183} -key ca.key -out ca.crt -subj "/CN=Hachette Test"