Skip to content

Commit 17c9948

Browse files
committed
feat: add example attestation policies
Signed-off-by: Chris Butler <chris.butler@redhat.com>
1 parent a902547 commit 17c9948

File tree

7 files changed

+320
-19
lines changed

7 files changed

+320
-19
lines changed

attestation-notes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
3+
# curl http://127.0.0.1:8006/aa/token?token_type=kbs
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: attestation-policy
5+
namespace: trustee-operator-system
6+
data:
7+
default.rego: |
8+
package policy
9+
10+
import rego.v1
11+
12+
# This policy validates multiple TEE platforms
13+
# The policy is meant to capture the TCB requirements
14+
# for confidential containers.
15+
16+
# This policy is used to generate an EAR Appraisal.
17+
# Specifically it generates an AR4SI result.
18+
# More informatino on AR4SI can be found at
19+
# <https://datatracker.ietf.org/doc/draft-ietf-rats-ar4si/>
20+
21+
# For the `executables` trust claim, the value 33 stands for
22+
# "Runtime memory includes executables, scripts, files, and/or
23+
# objects which are not recognized."
24+
default executables := 33
25+
26+
# For the `hardware` trust claim, the value 97 stands for
27+
# "A Verifier does not recognize an Attester's hardware or
28+
# firmware, but it should be recognized."
29+
default hardware := 97
30+
31+
# For the `configuration` trust claim the value 36 stands for
32+
# "Elements of the configuration relevant to security are
33+
# unavailable to the Verifier."
34+
default configuration := 36
35+
36+
37+
##### Azure vTPM SNP
38+
executables := 3 if {
39+
input.azsnpvtpm.measurement in data.reference.measurement
40+
input.azsnpvtpm.tpm.pcr11 in data.reference.snp_pcr11
41+
input.azsnpvtpm.tpm.pcr12 in data.reference.snp_pcr12
42+
}
43+
44+
hardware := 2 if {
45+
# Check the reported TCB to validate the ASP FW
46+
input.azsnpvtpm.reported_tcb_bootloader in data.reference.tcb_bootloader
47+
input.azsnpvtpm.reported_tcb_microcode in data.reference.tcb_microcode
48+
input.azsnpvtpm.reported_tcb_snp in data.reference.tcb_snp
49+
input.azsnpvtpm.reported_tcb_tee in data.reference.tcb_tee
50+
}
51+
52+
# For the 'configuration' trust claim 2 stands for
53+
# "The configuration is a known and approved config."
54+
#
55+
# For this, we compare all the configuration fields.
56+
configuration := 2 if {
57+
input.azsnpvtpm.platform_smt_enabled in data.reference.smt_enabled
58+
input.azsnpvtpm.platform_tsme_enabled in data.reference.tsme_enabled
59+
input.azsnpvtpm.policy_abi_major in data.reference.abi_major
60+
input.azsnpvtpm.policy_abi_minor in data.reference.abi_minor
61+
input.azsnpvtpm.policy_single_socket in data.reference.single_socket
62+
input.azsnpvtpm.policy_smt_allowed in data.reference.smt_allowed
63+
}
64+
65+
##### Azure vTPM TDX
66+
executables := 3 if {
67+
input.aztdxvtpm.tpm.pcr11 in data.reference.tdx_pcr11
68+
input.aztdxvtpm.tpm.pcr12 in data.reference.tdx_pcr12
69+
70+
}
71+
72+
hardware := 2 if {
73+
# Check the quote is a TDX quote signed by Intel SGX Quoting Enclave
74+
input.aztdxvtpm.quote.header.tee_type == "81000000"
75+
input.aztdxvtpm.quote.header.vendor_id == "939a7233f79c4ca9940a0db3957f0607"
76+
77+
# Check TDX Module version and its hash. Also check OVMF code hash.
78+
input.aztdxvtpm.quote.body.mr_seam in data.reference.mr_seam
79+
input.aztdxvtpm.quote.body.tcb_svn in data.reference.tcb_svn
80+
input.aztdxvtpm.quote.body.mr_td in data.reference.mr_td
81+
}
82+
83+
configuration := 2 if {
84+
input.aztdxvtpm.quote.body.xfam in data.reference.xfam
85+
}

charts/hub/trustee/templates/kbs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
# certStorePvc: <persistent-volume-claim>
2323

2424
# Override attestation policy (optional)
25-
# kbsAttestationPolicyConfigMapName: attestation-policy
25+
kbsAttestationPolicyConfigMapName: attestation-policy
2626

2727
# Inject environment variables (optional)
2828
# Enable DEBUG logging in trustee pods

charts/hub/trustee/templates/reference-values.yaml

Lines changed: 222 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,225 @@ metadata:
77
namespace: {{ .Values.kbs.deployNS }}
88
data:
99
reference-values.json: |
10-
[
11-
]
12-
13-
# No reference values yet
14-
# [
15-
# {
16-
# "name": "sample.svn",
17-
# "expired": "2025-01-01T00:00:00Z",
18-
# "hash-value": [
19-
# {
20-
# "alg": "sha256",
21-
# "value": "1"
22-
# }
23-
# ]
24-
# }
25-
# ]
10+
[
11+
{
12+
"name": "tdx_pcr11",
13+
"expiration": "2025-09-09T00:00:00Z",
14+
"hash-value": [
15+
{
16+
"alg": "sha256",
17+
"value": "25f988b8b92a8394ee6c2413fe7bde77929ec143151df0a582f52d6c7ccba94c"
18+
}
19+
]
20+
},
21+
{
22+
"name": "tdx_pcr12",
23+
"expiration": "2025-09-09T00:00:00Z",
24+
"hash-value": [
25+
{
26+
"alg": "sha256",
27+
"value": "ab45624dae8e56a3b7835ece6d95d764ff675806778a1a716004cdff886f8f30"
28+
}
29+
]
30+
},
31+
{
32+
"name": "init_data",
33+
"expiration": "2025-09-09T00:00:00Z",
34+
"hash-value": [
35+
{
36+
"alg": "sha256",
37+
"value": "f754f893653bb36dafbb2b5c12de2a88f1725374ad59df818e84622c7f7bead1"
38+
}
39+
]
40+
},
41+
{
42+
"name": "rtmr_1",
43+
"expiration": "2025-09-09T00:00:00Z",
44+
"hash-value": [
45+
{
46+
"alg": "sha256",
47+
"value": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
48+
}
49+
]
50+
},
51+
{
52+
"name": "rtmr_2",
53+
"expiration": "2025-09-09T00:00:00Z",
54+
"hash-value": [
55+
{
56+
"alg": "sha256",
57+
"value": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
58+
}
59+
]
60+
},
61+
{
62+
"name": "mr_seam",
63+
"expiration": "2025-09-09T00:00:00Z",
64+
"hash-value": [
65+
{
66+
"alg": "sha256",
67+
"value": "9790d89a10210ec6968a773cee2ca05b5aa97309f36727a968527be4606fc19e6f73acce350946c9d46a9bf7a63f8430"
68+
}
69+
]
70+
},
71+
{
72+
"name": "tcb_svn",
73+
"expiration": "2025-09-09T00:00:00Z",
74+
"hash-value": [
75+
{
76+
"alg": "sha256",
77+
"value": "04010700000000000000000000000000"
78+
}
79+
]
80+
},
81+
{
82+
"name": "mr_td",
83+
"expiration": "2025-09-09T00:00:00Z",
84+
"hash-value": [
85+
{
86+
"alg": "sha256",
87+
"value": "a6c9a329848900230bc81678b81d0d64ae88e20be8f73c848da7e2bd025558ef38b5319096e6d78633a3f2a3a804f729"
88+
}
89+
]
90+
},
91+
{
92+
"name": "xfam",
93+
"expiration": "2025-09-09T00:00:00Z",
94+
"hash-value": [
95+
{
96+
"alg": "sha256",
97+
"value": "e718060000000000"
98+
}
99+
]
100+
},
101+
{
102+
"name": "measurement",
103+
"expiration": "2025-09-09T00:00:00Z",
104+
"hash-value": [
105+
{
106+
"alg": "sha256",
107+
"value": "Cwa8qBJimP2freTTrrpvAZVbEQEyAhPY4fZGgSn9z4qtt0CAGmcS+Otz96qQZ92k"
108+
}
109+
]
110+
},
111+
{
112+
"name": "tcb_bootloader",
113+
"expiration": "2025-09-09T00:00:00Z",
114+
"hash-value": [
115+
{
116+
"alg": "sha256",
117+
"value": "4"
118+
}
119+
]
120+
},
121+
{
122+
"name": "tcb_microcode",
123+
"expiration": "2025-09-09T00:00:00Z",
124+
"hash-value": [
125+
{
126+
"alg": "sha256",
127+
"value": "219"
128+
}
129+
]
130+
},
131+
{
132+
"name": "tcb_snp",
133+
"expiration": "2025-09-09T00:00:00Z",
134+
"hash-value": [
135+
{
136+
"alg": "sha256",
137+
"value": "24"
138+
}
139+
]
140+
},
141+
{
142+
"name": "tcb_tee",
143+
"expiration": "2025-09-09T00:00:00Z",
144+
"hash-value": [
145+
{
146+
"alg": "sha256",
147+
"value": "0"
148+
}
149+
]
150+
},
151+
{
152+
"name": "smt_enabled",
153+
"expiration": "2025-09-09T00:00:00Z",
154+
"hash-value": [
155+
{
156+
"alg": "sha256",
157+
"value": "1"
158+
}
159+
]
160+
},
161+
{
162+
"name": "tsme_enabled",
163+
"expiration": "2025-09-09T00:00:00Z",
164+
"hash-value": [
165+
{
166+
"alg": "sha256",
167+
"value": "0"
168+
}
169+
]
170+
},
171+
{
172+
"name": "abi_major",
173+
"expiration": "2025-09-09T00:00:00Z",
174+
"hash-value": [
175+
{
176+
"alg": "sha256",
177+
"value": "0"
178+
}
179+
]
180+
},
181+
{
182+
"name": "abi_minor",
183+
"expiration": "2025-09-09T00:00:00Z",
184+
"hash-value": [
185+
{
186+
"alg": "sha256",
187+
"value": "31"
188+
}
189+
]
190+
},
191+
{
192+
"name": "single_socket",
193+
"expiration": "2025-09-09T00:00:00Z",
194+
"hash-value": [
195+
{
196+
"alg": "sha256",
197+
"value": "0"
198+
}
199+
]
200+
},
201+
{
202+
"name": "smt_allowed",
203+
"expiration": "2025-09-09T00:00:00Z",
204+
"hash-value": [
205+
{
206+
"alg": "sha256",
207+
"value": "1"
208+
}
209+
]
210+
},
211+
{
212+
"name": "snp_pcr11",
213+
"expiration": "2025-09-09T00:00:00Z",
214+
"hash-value": [
215+
{
216+
"alg": "sha256",
217+
"value": "25f988b8b92a8394ee6c2413fe7bde77929ec143151df0a582f52d6c7ccba94c"
218+
}
219+
]
220+
},
221+
{
222+
"name": "snp_pcr12",
223+
"expiration": "2025-09-09T00:00:00Z",
224+
"hash-value": [
225+
{
226+
"alg": "sha256",
227+
"value": "ab45624dae8e56a3b7835ece6d95d764ff675806778a1a716004cdff886f8f30"
228+
}
229+
]
230+
}
231+
]

charts/hub/trustee/templates/resource-policy.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ metadata:
66
data:
77
policy.rego: |
88
package policy
9-
default allow = true
9+
import rego.v1
10+
default allow = false
11+
allow if {
12+
input["submods"]["cpu"]["ear.status"] != "contraindicated"
13+
input["submods"]["cpu"]["ear.trustworthiness-vector"]["configuration"] == 2
14+
input["submods"]["cpu"]["ear.trustworthiness-vector"]["hardware"] == 2
15+
input["submods"]["cpu"]["ear.trustworthiness-vector"]["executables"] == 3
16+
}
File renamed without changes.

values-simple.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ clusterGroup:
9595
# Default to 'safe' for ARO
9696
overrides:
9797
- name: letsencrypt.enabled
98-
value: false
98+
value: true
9999
hello-openshift:
100100
name: hello-openshift
101101
namespace: hello-openshift

0 commit comments

Comments
 (0)