TPM2 (Trusted Platform Module) userspace development
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm at redhat.com>
To: tpm2@lists.01.org
Subject: Re: [tpm2] tpm2-abrmd in a container
Date: Wed, 06 Feb 2019 01:43:25 +0100	[thread overview]
Message-ID: <82fd3a60-780f-ceaf-8ced-cd2b01f55b9e@redhat.com> (raw)
In-Reply-To: CAKrSGQQuBEhFxNXvX_bEOzaG6YOKXVRQSLE5Nxvouqrf4vCZNQ@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 5950 bytes --]

Hello Luke,

On 2/5/19 4:40 PM, Luke Hinds wrote:

[snip]

> Almost have this working now or perhaps getting warmer. I am now looking
> for some advice on what values and arguments I should be using to make sure
> connectivity goes from tpm2-tools > tpm2-abrmd > tpm2 mssim
> 
> Within my container I run:
> 
> mkdir -p /var/run/dbus/
> dbus-daemon --fork --system
> 
> start the simulator:
> 
> tpm_server &
> [1] 24
> [root(a)a2d41fb37bb3 src]# TPM command server listening on port 2321
> Platform server listening on port 2322
> 
> If I now run:
> 
> [root(a)a2d41fb37bb3 src]# /usr/local/sbin/tpm2-abrmd --allow-root
> --tcti=mssim &
> 
> I can see an active bus:
> 
> [root(a)a2d41fb37bb3 src]# dbus-send --system --dest=org.freedesktop.DBus
> --type=method_call --print-reply /org/freedesktop/DBus
> org.freedesktop.DBus.ListNames
> method return time=1549380992.829764 sender=org.freedesktop.DBus ->
> destination=:1.7 serial=3 reply_serial=2
>    array [
>       string "org.freedesktop.DBus"
>       string ":1.7"
>       string "com.intel.tss2.Tabrmd"
>       string ":1.6"
>    ]
> 
> 
> [root(a)a2d41fb37bb3 src]# dbus-send --system --dest=com.intel.tss2.Tabrmd
> --type=method_call --print-reply /com/intel/tss2/Tabrmd/Tcti
> org.freedesktop.DBus.Introspectable.Introspect
> method return time=1549381010.989948 sender=:1.6 -> destination=:1.8
> serial=7 reply_serial=2
>    string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object
> Introspection 1.0//EN"
>                       "
> http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
> <!-- GDBus 2.58.3 -->
> <node>
>   <interface name="org.freedesktop.DBus.Properties">
>     <method name="Get">
>       <arg type="s" name="interface_name" direction="in"/>
>       <arg type="s" name="property_name" direction="in"/>
>       <arg type="v" name="value" direction="out"/>
>     </method>
>     <method name="GetAll">
>       <arg type="s" name="interface_name" direction="in"/>
>       <arg type="a{sv}" name="properties" direction="out"/>
>     </method>
>     <method name="Set">
>       <arg type="s" name="interface_name" direction="in"/>
>       <arg type="s" name="property_name" direction="in"/>
>       <arg type="v" name="value" direction="in"/>
>     </method>
>     <signal name="PropertiesChanged">
>       <arg type="s" name="interface_name"/>
>       <arg type="a{sv}" name="changed_properties"/>
>       <arg type="as" name="invalidated_properties"/>
>     </signal>
>   </interface>
>   <interface name="org.freedesktop.DBus.Introspectable">
>     <method name="Introspect">
>       <arg type="s" name="xml_data" direction="out"/>
>     </method>
>   </interface>
>   <interface name="org.freedesktop.DBus.Peer">
>     <method name="Ping"/>
>     <method name="GetMachineId">
>       <arg type="s" name="machine_uuid" direction="out"/>
>     </method>
>   </interface>
>   <interface name="com.intel.tss2.TctiTabrmd">
>     <method name="CreateConnection">
>       <arg type="ah" name="fds" direction="out"/>
>       <arg type="t" name="id" direction="out"/>
>     </method>
>     <method name="Cancel">
>       <arg type="t" name="id" direction="in"/>
>       <arg type="u" name="return_code" direction="out"/>
>     </method>
>     <method name="SetLocality">
>       <arg type="t" name="id" direction="in"/>
>       <arg type="y" name="locality" direction="in"/>
>       <arg type="u" name="return_code" direction="out"/>
>     </method>
>   </interface>
> </node>
>

I believe the tpm2-abmrd + MSFT simulator part is correct.
 
> The part I am now not sure of, is how to configure TPM2TOOLS_TCTI and what
> args should be used for the RM.
> 
> As it is, its expected with TPM2TOOLS_TCTI undeclared  :
> 
> [root(a)a2d41fb37bb3 src]# tpm2_pcrlist
> ERROR:tcti:src/tss2-tcti/tcti-device.c:399:Tss2_Tcti_Device_Init() Failed
> to open device file /dev/tpm0: No such file or directory
> ERROR: tcti init allocation routine failed for library: "device" options:
> "(null)"
> ERROR: Could not load tcti, got: "device"
> 
> I have then tried different variations:
> 
> export TPM2TOOLS_TCTI="mssim:host=localhost,port=2321"
> export TPM2TOOLS_TCTI="mssim:port=2321"
> export TPM2TOOLS_TCTI="mssim:tcp://127.0.0.1:2321"
>
> I am guessing this would be wrong though? I don't want the tools connecting
> to the mssim, I want them connecting to the resource manager.
>

That's correct. You have to use the abrmd TCTI since the tools don't care that
the abrmd is talking to the simulator instead of a TPM device.

> I should also mention, none of the above work - running `tpm2_pcrlist` just
> results in the command hanging and needing a ctrl c to break out.
> 
> [root(a)a2d41fb37bb3 src]# export
> TPM2TOOLS_TCTI="tabrmd:bus_name=com.intel.tss2.Tabrmd,tabrmd:bus_type=session"
> [root(a)a2d41fb37bb3 src]# tpm2_pcrlist
> ERROR: Could not dlopen library: "tabrmd"
> ERROR: Could not load tcti, got: "tabrmd"
> 
> So I then tried try this:
> 
> [root(a)a2d41fb37bb3 src]# /usr/local/sbin/tpm2-abrmd --allow-root
> --tcti=libtss2-tcti-mssim.so &
> [root(a)a2d41fb37bb3 src]# export TPM2TOOLS_TCTI="mssim:port=2321"
> [root(a)a2d41fb37bb3 src]# tpm2_pcrlist
> 
> Unfortunately the command just hangs, needing a ctrl-c to break the session.
> 
> I am aware I may be "making a pigs ear" of this, if so excuse my
> green'ness.
> 
> If anyone can point me towards what args I should be using for the
> connectivity flow I outlined towards the start of this email, that would be
> great!
>

What's your exact version of the tpm2-abrmd, tpm2-tss and tpm2-tools? Can you
do "export TSS2_LOG=all+TRACE" before executing tpm2_pcrlist to see where the
libraries are hanging?

> Thanks,
> 
> Luke
> 

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat

             reply	other threads:[~2019-02-06  0:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06  0:43 Javier Martinez Canillas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-02-06  7:50 [tpm2] tpm2-abrmd in a container Luke Hinds
2019-02-05 15:40 Luke Hinds
2019-02-04 18:55 Luke Hinds
2019-02-04 18:08 Andersen, John
2019-02-04 16:57 Luke Hinds
2019-02-04 16:11 Roberts, William C
2019-02-04 15:46 Luke Hinds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82fd3a60-780f-ceaf-8ced-cd2b01f55b9e@redhat.com \
    --to=tpm2@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox