tpm2_policyauthorize.1 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. .\" Automatically generated by Pandoc 1.19.2.4
  2. .\"
  3. .TH "tpm2_policyauthorize" "1" "" "tpm2\-tools" "General Commands Manual"
  4. .hy
  5. .SH NAME
  6. .PP
  7. \f[B]tpm2_policyauthorize\f[](1) \- Allows for mutable policies by
  8. tethering to a signing authority.
  9. .SH SYNOPSIS
  10. .PP
  11. \f[B]tpm2_policyauthorize\f[] [\f[I]OPTIONS\f[]]
  12. .SH DESCRIPTION
  13. .PP
  14. \f[B]tpm2_policyauthorize\f[](1) \- This command allows for policies to
  15. change by associating the policy to a signing authority and allowing the
  16. policy contents to change.
  17. .IP "1." 3
  18. If the input session is a trial session this tool generates a policy
  19. digest that associates a signing authority\[aq]s public key name with
  20. the policy being authorized.
  21. .IP "2." 3
  22. If the input session is real policy session
  23. \f[B]tpm2_policyauthorize\f[](1) looks for a verification ticket from
  24. the TPM to attest that the TPM has verified the signature on the policy
  25. digest before authorizing the policy in the policy digest.
  26. .SH OPTIONS
  27. .IP \[bu] 2
  28. \f[B]\-L\f[], \f[B]\-\-policy\f[]=\f[I]FILE\f[]:
  29. .RS 2
  30. .PP
  31. File to save the policy digest.
  32. .RE
  33. .IP \[bu] 2
  34. \f[B]\-S\f[], \f[B]\-\-session\f[]=\f[I]FILE\f[]:
  35. .RS 2
  36. .PP
  37. The policy session file generated via the \f[B]\-S\f[] option to
  38. \f[B]tpm2_startauthsession\f[](1).
  39. .RE
  40. .IP \[bu] 2
  41. \f[B]\-i\f[], \f[B]\-\-input\f[]=\f[I]FILE\f[]:
  42. .RS 2
  43. .PP
  44. The policy digest that has to be authorized.
  45. .RE
  46. .IP \[bu] 2
  47. \f[B]\-q\f[], \f[B]\-\-qualification\f[]=\f[I]FILE_OR_HEX\f[]:
  48. .RS 2
  49. .PP
  50. The policy qualifier data signed in conjunction with the input policy
  51. digest.
  52. This is unique data that the signer can choose to include in the
  53. signature and can either be a path or hex string.
  54. .RE
  55. .IP \[bu] 2
  56. \f[B]\-n\f[], \f[B]\-\-name\f[]=\f[I]FILE\f[]:
  57. .RS 2
  58. .PP
  59. File containing the name of the verifying public key.
  60. This ties the final policy digest with a signer.
  61. This can be retrieved with \f[B]tpm2_readpublic\f[](1)
  62. .RE
  63. .IP \[bu] 2
  64. \f[B]\-t\f[], \f[B]\-\-ticket\f[]=\f[I]FILE\f[]:
  65. .RS 2
  66. .PP
  67. The ticket file to record the validation structure.
  68. This is generated with \f[B]tpm2_verifysignature\f[](1).
  69. .RE
  70. .SS References
  71. .SH COMMON OPTIONS
  72. .PP
  73. This collection of options are common to many programs and provide
  74. information that many users may expect.
  75. .IP \[bu] 2
  76. \f[B]\-h\f[], \f[B]\-\-help=[man|no\-man]\f[]: Display the tools
  77. manpage.
  78. By default, it attempts to invoke the manpager for the tool, however, on
  79. failure will output a short tool summary.
  80. This is the same behavior if the "man" option argument is specified,
  81. however if explicit "man" is requested, the tool will provide errors
  82. from man on stderr.
  83. If the "no\-man" option if specified, or the manpager fails, the short
  84. options will be output to stdout.
  85. .RS 2
  86. .PP
  87. To successfully use the manpages feature requires the manpages to be
  88. installed or on \f[I]MANPATH\f[], See man(1) for more details.
  89. .RE
  90. .IP \[bu] 2
  91. \f[B]\-v\f[], \f[B]\-\-version\f[]: Display version information for this
  92. tool, supported tctis and exit.
  93. .IP \[bu] 2
  94. \f[B]\-V\f[], \f[B]\-\-verbose\f[]: Increase the information that the
  95. tool prints to the console during its execution.
  96. When using this option the file and line number are printed.
  97. .IP \[bu] 2
  98. \f[B]\-Q\f[], \f[B]\-\-quiet\f[]: Silence normal tool output to stdout.
  99. .IP \[bu] 2
  100. \f[B]\-Z\f[], \f[B]\-\-enable\-errata\f[]: Enable the application of
  101. errata fixups.
  102. Useful if an errata fixup needs to be applied to commands sent to the
  103. TPM.
  104. Defining the environment TPM2TOOLS_ENABLE_ERRATA is equivalent.
  105. information many users may expect.
  106. .SH TCTI Configuration
  107. .PP
  108. The TCTI or "Transmission Interface" is the communication mechanism with
  109. the TPM.
  110. TCTIs can be changed for communication with TPMs across different
  111. mediums.
  112. .PP
  113. To control the TCTI, the tools respect:
  114. .IP "1." 3
  115. The command line option \f[B]\-T\f[] or \f[B]\-\-tcti\f[]
  116. .IP "2." 3
  117. The environment variable: \f[I]TPM2TOOLS_TCTI\f[].
  118. .PP
  119. \f[B]Note:\f[] The command line option always overrides the environment
  120. variable.
  121. .PP
  122. The current known TCTIs are:
  123. .IP \[bu] 2
  124. tabrmd \- The resource manager, called
  125. tabrmd (https://github.com/tpm2-software/tpm2-abrmd).
  126. Note that tabrmd and abrmd as a tcti name are synonymous.
  127. .IP \[bu] 2
  128. mssim \- Typically used for communicating to the TPM software simulator.
  129. .IP \[bu] 2
  130. device \- Used when talking directly to a TPM device file.
  131. .IP \[bu] 2
  132. none \- Do not initalize a connection with the TPM.
  133. Some tools allow for off\-tpm options and thus support not using a TCTI.
  134. Tools that do not support it will error when attempted to be used
  135. without a TCTI connection.
  136. Does not support \f[I]ANY\f[] options and \f[I]MUST BE\f[] presented as
  137. the exact text of "none".
  138. .PP
  139. The arguments to either the command line option or the environment
  140. variable are in the form:
  141. .PP
  142. \f[C]<tcti\-name>:<tcti\-option\-config>\f[]
  143. .PP
  144. Specifying an empty string for either the \f[C]<tcti\-name>\f[] or
  145. \f[C]<tcti\-option\-config>\f[] results in the default being used for
  146. that portion respectively.
  147. .SS TCTI Defaults
  148. .PP
  149. When a TCTI is not specified, the default TCTI is searched for using
  150. \f[I]dlopen(3)\f[] semantics.
  151. The tools will search for \f[I]tabrmd\f[], \f[I]device\f[] and
  152. \f[I]mssim\f[] TCTIs \f[B]IN THAT ORDER\f[] and \f[B]USE THE FIRST ONE
  153. FOUND\f[].
  154. You can query what TCTI will be chosen as the default by using the
  155. \f[B]\-v\f[] option to print the version information.
  156. The "default\-tcti" key\-value pair will indicate which of the
  157. aforementioned TCTIs is the default.
  158. .SS Custom TCTIs
  159. .PP
  160. Any TCTI that implements the dynamic TCTI interface can be loaded.
  161. The tools internally use \f[I]dlopen(3)\f[], and the raw
  162. \f[I]tcti\-name\f[] value is used for the lookup.
  163. Thus, this could be a path to the shared library, or a library name as
  164. understood by \f[I]dlopen(3)\f[] semantics.
  165. .SH TCTI OPTIONS
  166. .PP
  167. This collection of options are used to configure the various known TCTI
  168. modules available:
  169. .IP \[bu] 2
  170. \f[B]device\f[]: For the device TCTI, the TPM character device file for
  171. use by the device TCTI can be specified.
  172. The default is \f[I]/dev/tpm0\f[].
  173. .RS 2
  174. .PP
  175. Example: \f[B]\-T device:/dev/tpm0\f[] or \f[B]export
  176. \f[I]TPM2TOOLS_TCTI\f[]="device:/dev/tpm0"\f[]
  177. .RE
  178. .IP \[bu] 2
  179. \f[B]mssim\f[]: For the mssim TCTI, the domain name or IP address and
  180. port number used by the simulator can be specified.
  181. The default are 127.0.0.1 and 2321.
  182. .RS 2
  183. .PP
  184. Example: \f[B]\-T mssim:host=localhost,port=2321\f[] or \f[B]export
  185. \f[I]TPM2TOOLS_TCTI\f[]="mssim:host=localhost,port=2321"\f[]
  186. .RE
  187. .IP \[bu] 2
  188. \f[B]abrmd\f[]: For the abrmd TCTI, the configuration string format is a
  189. series of simple key value pairs separated by a \[aq],\[aq] character.
  190. Each key and value string are separated by a \[aq]=\[aq] character.
  191. .RS 2
  192. .IP \[bu] 2
  193. TCTI abrmd supports two keys:
  194. .RS 2
  195. .IP "1." 3
  196. \[aq]bus_name\[aq] : The name of the tabrmd service on the bus (a
  197. string).
  198. .IP "2." 3
  199. \[aq]bus_type\[aq] : The type of the dbus instance (a string) limited to
  200. \[aq]session\[aq] and \[aq]system\[aq].
  201. .RE
  202. .PP
  203. Specify the tabrmd tcti name and a config string of
  204. \f[C]bus_name=com.example.FooBar\f[]:
  205. .PP
  206. \f[C]\\\-\-tcti=tabrmd:bus_name=com.example.FooBar\f[]
  207. .PP
  208. Specify the default (abrmd) tcti and a config string of
  209. \f[C]bus_type=session\f[]:
  210. .PP
  211. \f[C]\\\-\-tcti:bus_type=session\f[]
  212. .PP
  213. \f[B]NOTE\f[]: abrmd and tabrmd are synonymous.
  214. the various known TCTI modules.
  215. .RE
  216. .SH EXAMPLES
  217. .PP
  218. Starts a \f[I]trial\f[] session, builds a PCR policy.
  219. This PCR policy digest is then an input to the
  220. \f[B]tpm2_policyauthorize\f[](1) along with policy qualifier data and a
  221. signer public.
  222. The resultant policy digest is then used in creation of objects.
  223. .PP
  224. Subsequently when the PCR change and so does the PCR policy digest, the
  225. actual policy digest from the \f[B]tpm2_policyauthorize\f[](1) used in
  226. creation of the object will not change.
  227. At runtime the new PCR policy needs to be satisfied along with
  228. verification of the signature on the PCR policy digest using
  229. \f[B]tpm2_policyauthorize\f[](1)
  230. .SS Create a signing authority
  231. .IP
  232. .nf
  233. \f[C]
  234. openssl\ genrsa\ \-out\ signing_key_private.pem\ 2048
  235. openssl\ rsa\ \-in\ signing_key_private.pem\ \-out\ signing_key_public.pem\ \-pubout
  236. tpm2_loadexternal\ \-G\ rsa\ \-C\ o\ \-u\ signing_key_public.pem\ \-c\ signing_key.ctx\ \-n\ signing_key.name
  237. \f[]
  238. .fi
  239. .SS Create a policy to be authorized like a PCR policy
  240. .IP
  241. .nf
  242. \f[C]
  243. tpm2_pcrread\ \-opcr0.sha256\ sha256:0
  244. tpm2_startauthsession\ \-S\ session.ctx
  245. tpm2_policypcr\ \-S\ session.ctx\ \-l\ sha256:0\ \-f\ pcr0.sha256\ \-L\ pcr.policy
  246. tpm2_flushcontext\ session.ctx
  247. \f[]
  248. .fi
  249. .SS Sign the policy
  250. .IP
  251. .nf
  252. \f[C]
  253. openssl\ dgst\ \-sha256\ \-sign\ signing_key_private.pem\ \-out\ pcr.signature\ pcr.policy
  254. \f[]
  255. .fi
  256. .SS Authorize the policy in the policy digest
  257. .IP
  258. .nf
  259. \f[C]
  260. tpm2_startauthsession\ \-S\ session.ctx
  261. tpm2_policyauthorize\ \-S\ session.ctx\ \-L\ authorized.policy\ \-i\ pcr.policy\ \-n\ signing_key.name
  262. tpm2_flushcontext\ session.ctx
  263. \f[]
  264. .fi
  265. .SS Create a TPM object like a sealing object with the authorized policy
  266. based authentication
  267. .IP
  268. .nf
  269. \f[C]
  270. tpm2_createprimary\ \-C\ o\ \-g\ sha256\ \-G\ rsa\ \-c\ prim.ctx
  271. tpm2_create\ \-g\ sha256\ \-u\ sealing_pubkey.pub\ \-r\ sealing_prikey.pub\ \-i\-\ \-C\ prim.ctx\ \-L\ authorized.policy\ <<<\ "secret\ to\ seal"
  272. \f[]
  273. .fi
  274. .SS Satisfy policy and unseal the secret
  275. .IP
  276. .nf
  277. \f[C]
  278. tpm2_verifysignature\ \-c\ signing_key.ctx\ \-g\ sha256\ \-m\ pcr.policy\ \-s\ pcr.signature\ \-t\ verification.tkt\ \-f\ rsassa
  279. tpm2_startauthsession\ \\\-\-policy\-session\ \-S\ session.ctx
  280. tpm2_policypcr\ \-S\ session.ctx\ \-l\ sha256:0\ \-L\ pcr.policy
  281. tpm2_policyauthorize\ \-S\ session.ctx\ \-L\ authorized.policy\ \-i\ pcr.policy\ \-n\ signing_key.name\ \-t\ verification.tkt
  282. tpm2_load\ \-C\ prim.ctx\ \-u\ sealing_pubkey.pub\ \-r\ sealing_prikey.pub\ \-c\ sealing_key.ctx
  283. unsealed=$(tpm2_unseal\ \-p"session:session.ctx"\ \-c\ sealing_key.ctx)
  284. echo\ $unsealed
  285. tpm2_flushcontext\ session.ctx
  286. \f[]
  287. .fi
  288. .SH Returns
  289. .PP
  290. Tools can return any of the following codes:
  291. .IP \[bu] 2
  292. 0 \- Success.
  293. .IP \[bu] 2
  294. 1 \- General non\-specific error.
  295. .IP \[bu] 2
  296. 2 \- Options handling error.
  297. .IP \[bu] 2
  298. 3 \- Authentication error.
  299. .IP \[bu] 2
  300. 4 \- TCTI related error.
  301. .IP \[bu] 2
  302. 5 \- Non supported scheme.
  303. Applicable to tpm2_testparams.
  304. .SH Limitations
  305. .PP
  306. It expects a session to be already established via
  307. \f[B]tpm2_startauthsession\f[](1) and requires one of the following:
  308. .IP \[bu] 2
  309. direct device access
  310. .IP \[bu] 2
  311. extended session support with \f[B]tpm2\-abrmd\f[].
  312. .PP
  313. Without it, most resource managers \f[B]will not\f[] save session state
  314. between command invocations.
  315. .SH BUGS
  316. .PP
  317. Github Issues (https://github.com/tpm2-software/tpm2-tools/issues)
  318. .SH HELP
  319. .PP
  320. See the Mailing List (https://lists.01.org/mailman/listinfo/tpm2)