blob: ba28424594bb24302975448f992417478be574ac [file] [log] [blame]
Zhiyi Zhang3aaf06d2020-10-17 13:05:36 -07001#! /bin/bash
2
tylerliue0a7dd02020-10-17 17:10:59 -07003# Generate ndncert config file
4echo 'Please enter the /ndn certificate:(end with Ctrl-D)'
5ROOT_CERT=$(cat | tr -d '\n')
6
7cat > ndncert-site-client.conf << ~EOF
8{
9 "ca-list":
10 [
11 {
12 "ca-prefix": "/ndn",
13 "ca-info": "NDN Testbed Root Trust Anchor",
14 "max-validity-period": "1296000",
15 "max-suffix-length": "3",
16 "probe-parameters":
17 [
18 {"probe-parameter-key": "pin"}
19 ],
20 "certificate": "$ROOT_CERT"
21 }
22 ]
23}
24~EOF
25
26echo 'Please enter the /ndn certificate:(end with Ctrl-D)'
27ROOT_CERT=$(cat | tr -d '\n')
28
29# compile and install ndncert
30git clone https://github.com/Zhiyi-Zhang/ndncert.git
31cd ndncert
32git checkout origin/v0.3
33./waf configure
34sudo ./waf install
35sudo cp ./build/systemd/ndncert-ca.service /etc/systemd/system/
36sudo chmod 644 /etc/systemd/system/ndncert-ca.service
37
38
39
40# prepare CA configuration file
41echo -e "{\n\"ca-prefix\": \"/ndn\",\n\"ca-info\": \"NDN testbed root CA\",\n\"max-validity-period\": \"1296000\",\n\"max-suffix-length\": \"2\",\n\"supported-challenges\":\n[\n{ \"challenge\": \"pin\" }\n]\n}" > /usr/local/etc/ndncert/ca.conf
42
43# run the CA
44sudo systemctl start ndncert-ca
45sleep(2)
46
47# check the status to make sure everything is correct
48sudo systemctl status ndncert-server
49