Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trezor T asks two times for the passphrase #225

Closed
turcane opened this issue Mar 27, 2018 · 18 comments · Fixed by trezor/python-trezor#241
Closed

Trezor T asks two times for the passphrase #225

turcane opened this issue Mar 27, 2018 · 18 comments · Fixed by trezor/python-trezor#241
Assignees

Comments

@turcane
Copy link

turcane commented Mar 27, 2018

When trying to connect via trezor-agent user@host -c Trezor T asks for a passphrase,
after that it asks if you want to sign login of user@host and asks again for a passphrase.
That can be very annoying and I don't understand the reason for asking two times.

OS: macOS High Sierra
Agent: trezor-agent=0.9.2 libagent=0.11.2
Trezor T: 2.0.6

@romanz
Copy link
Owner

romanz commented Mar 27, 2018

Thanks for reporting this issue!

In TREZOR 1, I was caching the passphrase at the client code:

cached_passphrase_ack = None

In Trezor T, if you can use the device to enter the passphrase - it seems that the passphrase is not being cached between the public key derivate (1st prompt) and the signature (2nd prompt).

Will take a look to understand the issue better.

@romanz
Copy link
Owner

romanz commented Mar 27, 2018

We need to pass the state correctly during initialization.

@romanz
Copy link
Owner

romanz commented Mar 28, 2018

Should be fixed at the latest Git versions trezor/python-trezor@bd3d014 and 7443fc6.
Please take a look :)

@turcane
Copy link
Author

turcane commented Mar 28, 2018

Just pip install --upgrade trezor-agent?

@romanz
Copy link
Owner

romanz commented Mar 28, 2018

It's not released yet, so please use:

$ pip install git+https://github.com/romanz/trezor-agent -U

@turcane
Copy link
Author

turcane commented Mar 28, 2018

Still asks two times for the passphrase :(

> git clone https://github.com/romanz/trezor-agent
> pip3 install --user -e trezor-agent/agents/trezor
> [ ~/Library/Python/3.6/bin ] ./trezor-agent --version
> trezor-agent=0.9.2 libagent=0.11.2

@romanz
Copy link
Owner

romanz commented Mar 28, 2018

This is indeed weird...
Could you please run trezor-agent -vv user@host -c and attach the log?
It should contain a caching state from line:

log.debug('caching state from %r', msg)

@turcane
Copy link
Author

turcane commented Mar 28, 2018

trezor-agent.log

Replaced my user and host by [email protected] and removed some byte arrays

@romanz
Copy link
Owner

romanz commented Mar 28, 2018

It seems that you are using TREZOR Bridge:

2018-03-28 21:11:48,803 DEBUG        http://127.0.0.1:21325 "POST /acquire/web02/null HTTP/1.1" 200 18                                    [connectionpool.py:396]
2018-03-28 21:11:49,113 DEBUG        http://127.0.0.1:21325 "POST /call/101 HTTP/1.1" 200 16                                              [connectionpool.py:396]
2018-03-28 21:11:50,534 DEBUG        http://127.0.0.1:21325 "POST /call/101 HTTP/1.1" 200 16                                              [connectionpool.py:396]
2018-03-28 21:11:55,433 DEBUG        http://127.0.0.1:21325 "POST /call/101 HTTP/1.1" 200 144                                             [connectionpool.py:396]
2018-03-28 21:11:55,433 DEBUG        caching state from <PassphraseStateRequest: {'state': bytearray(b"\xcdz\x8c:\x07\xa2\xb1\x97\xed\xe1\xc1L3\x88\xdb\xc5\xcf\xd4\x14\x99\xde\xe6\xb1\'\x067\xa2[I\xd7\xdc\x11)\x8e<\xa2I\xe4*\x9a\x85\xc1^\xcb\xf2\x06\x98\xbd\x0fFXJ\x83\xef\x9e\xc5\xe0\xdb\xb7\xbf<}P\x9b")}> [trezor.py:83]
2018-03-28 21:11:56,252 DEBUG        http://127.0.0.1:21325 "POST /call/101 HTTP/1.1" 200 406                                             [connectionpool.py:396]
2018-03-28 21:11:56,254 DEBUG        http://127.0.0.1:21325 "POST /release/101 HTTP/1.1" 200 18                                           [connectionpool.py:396]

I guess that the state may be dropped there...
Will take a look at it in the following days.

@turcane
Copy link
Author

turcane commented Mar 28, 2018

Great, thanks!

@romanz
Copy link
Owner

romanz commented Mar 29, 2018

I've built the latest TREZOR daemon (aka Bridge), and it seems to work as intended (asks for passphrase once), so it seems that the state is forwarded correctly to the device.
Could you please update to the latest version from https://github.com/trezor/trezord-go?

BTW, does this also happens when running without a Bridige (i.e. when the communication happens directly via USB HID)?

@turcane
Copy link
Author

turcane commented Mar 29, 2018

Uninstalled bridge and tried without bridge:
Asks two times

Built trezord-go from source, ran it and tried again:
Asks two times

I don't know what I'm doing wrong...

/edit

If I run without installed/running bridge I also get this log message:

2018-03-29 22:32:24,841 DEBUG transports: [<trezorlib.transport_bridge.BridgeTransport object at 0x10574bb38>, <trezorlib.transport_webusb.WebUsbTransport object at 0x105cce048>] [trezor.py:111]

Should that happen?

@turcane
Copy link
Author

turcane commented Mar 29, 2018

Sorry my fault, trezord was still running
Now getting this message:

2018-03-29 22:42:28,830 DEBUG transports: [<trezorlib.transport_webusb.WebUsbTransport object at 0x10c0be0b8>] [trezor.py:111]

But still asks two times.

@romanz
Copy link
Owner

romanz commented Apr 5, 2018

@JediWed Sorry for the delayed response...
Could you please attach the log for the WebUsbTransport case (i.e. when running without trezord)?

@romanz
Copy link
Owner

romanz commented Apr 25, 2018

Ping :)

@turcane
Copy link
Author

turcane commented Apr 25, 2018

I'm very sorry. I was very busy the last few weeks. I will have a look this evening.

@romanz
Copy link
Owner

romanz commented Apr 25, 2018

No worries, I was just curios :)

@romanz
Copy link
Owner

romanz commented May 4, 2018

Please re-open if it still happens.

@romanz romanz closed this as completed May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants