-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
228 lines (211 loc) · 6.8 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
---
- name: Install deps on remote host
hosts: sgx
become: true
gather_facts: false
tasks:
- wait_for_connection:
- setup:
- name: rustup installer
become: true
become_user: ubuntu
get_url:
url: https://sh.rustup.rs
dest: ~/sh.rustup.rs
mode: "0755"
force: "yes"
tags:
- rust
- name: install rust/cargo
become: true
become_user: ubuntu
shell: ~/sh.rustup.rs -y
tags:
- rust
- name: Update and upgrade apt packages
become: true
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 172800 #two days
- name: Install deps on verifier
hosts: verifier
become: true
gather_facts: false
tasks:
- name: Add intel Apt signing key, uses whichever key is at the URL
ansible.builtin.apt_key:
url: https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key
state: present
- name: Add gramine Apt signing key, uses whichever key is at the URL
ansible.builtin.apt_key:
url: https://packages.gramineproject.io/gramine-keyring.gpg
state: present
- name: Add intel repository into sources list
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main
state: present
- name: Add gramine repository into sources list
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://packages.gramineproject.io/ jammy main
state: present
- name: Update and upgrade apt packages
become: true
apt:
update_cache: yes
- name: install libs
become: true
apt:
allow_downgrades: yes
pkg:
- libsgx-dcap-ql
- libsgx-dcap-default-qpl=1.16.100.2-jammy1
- libsgx-launch
- gramine
- cmake
- clang
- sqlite3
- libsgx-dcap-quote-verify-dev
- name: use azure PCCS
ansible.builtin.copy:
src: azure/sgx_default_qcnl.conf
dest: /etc/sgx_default_qcnl.conf
owner: root
group: root
- name: restart aesmd service
become: true
ansible.builtin.shell:
cmd: systemctl restart aesmd.service
- name: check for SGX support
command: is-sgx-available
ignore_errors: true
register: sgxstatus
- name: print sgx support status
ansible.builtin.debug:
msg: SGX Status {{ sgxstatus }}
when: sgxstatus is defined
- name: install gramine key
become: true
become_user: ubuntu
command: gramine-sgx-gen-private-key
ignore_errors: true
register: sgxstatus
- name: clone notary server
become: true
become_user: ubuntu
ignore_errors: true
git:
repo: https://github.com/maceip/sgx-tlsn-notary-server.git
dest: /home/ubuntu/sgx-tlsn-notary-server
clone: yes
update: yes
force: yes
- name: make repo
become: true
become_user: ubuntu
environment:
SGX: "1"
PATH: "/home/ubuntu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:{{ ansible_env.PATH }}"
command: make
args:
chdir: /home/ubuntu/sgx-tlsn-notary-server
register: makestatus
- name: load sigstruct
become: true
become_user: ubuntu
environment:
SGX: "1"
PATH: "/home/ubuntu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:{{ ansible_env.PATH }}"
command: gramine-sgx-sigstruct-view --output-format=toml sgx-notary-server.sig
args:
chdir: /home/ubuntu/sgx-tlsn-notary-server
register: sigstruct
- name: print make status
ansible.builtin.debug:
msg: Notary Build Status {{ makestatus }} Sigstruct {{ sigstruct }}
when: makestatus is defined
- name: run verifier
async: 1000 # run verifier for 16 minutes
poll: 0
become: true
environment:
SGX: "1"
PATH: "/home/ubuntu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:{{ ansible_env.PATH }}"
command: gramine-sgx sgx-notary-server
args:
chdir: /home/ubuntu/sgx-tlsn-notary-server
register: verifierstatus
- name: Clean up async verifier job
ansible.builtin.async_status:
jid: '{{ verifierstatus.ansible_job_id }}'
mode: cleanup
- name: Install deps on prover
hosts: prover
become: true
gather_facts: false
tasks:
- name: Add intel Apt signing key, uses whichever key is at the URL
ansible.builtin.apt_key:
url: https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key
state: present
- name: Add gramine Apt signing key, uses whichever key is at the URL
ansible.builtin.apt_key:
url: https://packages.gramineproject.io/gramine-keyring.gpg
state: present
- name: Add intel repository into sources list
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main
state: present
- name: Add gramine repository into sources list
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://packages.gramineproject.io/ jammy main
state: present
- name: Update and upgrade apt packages
become: true
apt:
update_cache: yes
- name: install libs
become: true
apt:
allow_downgrades: yes
pkg:
- cmake
- clang
- libssl-dev
- name: clone notary server
become: true
become_user: ubuntu
ignore_errors: true
git:
repo: https://github.com/tlsnotary/tlsn.git
dest: /home/ubuntu/tlsn
clone: yes
update: yes
force: yes
single_branch: yes
version: dev
- name: set notary host
ansible.builtin.lineinfile:
path: /home/ubuntu/tlsn/tlsn/examples/twitter/twitter_dm.rs
regexp: '^const NOTARY_HOST'
line: 'const NOTARY_HOST: &str = "74.235.218.81";' #fixme: get the verifier ip from terraform
- name: set env
become: true
become_user: ubuntu
environment:
PATH: "/home/ubuntu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:{{ ansible_env.PATH }}"
command: cp .env.example .env
args:
chdir: /home/ubuntu/tlsn/tlsn/examples/twitter
register: envcopy
- name: run prover
become: true
become_user: ubuntu
environment:
SGX: "1"
RUST_LOG: "debug,yamux=info"
PATH: "/home/ubuntu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:{{ ansible_env.PATH }}"
command: cargo run --release --example twitter_dm
args:
chdir: /home/ubuntu/tlsn/tlsn/examples/twitter
register: twitterstatus