ravenac95 / sudolikeaboss

Get 1password access from iterm2
http://sudolikeaboss.com
MIT License
1.51k stars 50 forks source link

non-functional with 1Password 6.3 Beta #19

Closed MarkGriffiths closed 8 years ago

MarkGriffiths commented 8 years ago

1Password 6: Version 6.3.BETA-3 (630003)

I'm so used to sudolikeaboss transparently working that I was certain I had some kind of weird Open Directory issue until I realised that it was just that the 1password popup wasn't appearing.

Looks like Agile are beefing up the protocol in the latest betas.

I get the following in system.log:

Apr  7 14:50:30 red 2BUA8C4S2C.com.agilebits.onepassword4-helper[545]: 630003 [EXT:(Secondary Thread 0x7f9bc6093ed0):<OP4ExtensionHTTPConnection: 0x7f9bc6151cb0>] M webSocketForURI: | [ES4] Extension connected Chrome-Extension 'chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk / (null)'
Apr  7 14:50:30 red 2BUA8C4S2C.com.agilebits.onepassword4-helper[545]: 630003 [EXT:(Secondary Thread 0x7f9bc149a5a0):<OP4ExtensionClient: 0x7f9bc6026e70>] S didOpen | [ES4 0x7f9bc6026e70] Connected 'chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk:51119'
Apr  7 14:50:30 red 2BUA8C4S2C.com.agilebits.onepassword4-helper[545]: 630003 [EXT:(Secondary Thread 0x7f9bc6093ed0):<OP4ExtensionClient: 0x7f9bc6026e70>] E findExtensionProcessForPort: | Failed to find extension process for 'chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk:51119', my PID: 545, invalid output: '545
    23918
    ', apps found: (
    )
Apr  7 14:50:30 red 2BUA8C4S2C.com.agilebits.onepassword4-helper[545]: 630003 [EXT:(Secondary Thread 0x7f9bc6093ed0):<OP4ExtensionClient: 0x7f9bc6026e70>] E findExtensionProcessForPort: | Stopping connection since no PID was found to validate the other side of the connection.
Apr  7 14:50:30 red 2BUA8C4S2C.com.agilebits.onepassword4-helper[545]: 630003 [EXT:(Secondary Thread 0x7f9bc6093ed0):<OP4ExtensionClient: 0x7f9bc6026e70>] S findExtensionProcessForPort: | [ES4 0x7f9bc6026e70] Connected chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk:51119: (null) launched (null)
Apr  7 14:50:30 red 2BUA8C4S2C.com.agilebits.onepassword4-helper[545]: 630003 [EXT:(Secondary Thread 0x7f9bc1775f50):<OP4ExtensionClient: 0x7f9bc6026e70>] S didClose | [ES 0x7f9bc6026e70] Disconnected 'chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk' ((null))
ravenac95 commented 8 years ago

@MarkGriffiths I'm going to try looking into this for the next couple of days. What's strange is that I would think that disabling the Verify Browser Code Signature would make this a non-issue.

MarkGriffiths commented 8 years ago

I did try toggling the Verify Browser Code Signature option in 1password, unbrewing and rebrewing sudolikeaboss, tried the older workaround implementation, fiddled with the workaround until I realised I was barking up the wrong tree so reverted to the vanilla version and tried fiddling with that.

I noticed that the coprocess in iTerm2 (Build 2.9.20160313) was being 'slammed shut' and had a poke around in Wireshark to see if it was something trivial in the websocket/HTTP conversation, but when I saw it was something in the encrypted protocol, I figured it was best to live with typing passwords and concentrating on looming deadlines.

chancez commented 8 years ago

I'm also running into this isssue.

petertwise commented 8 years ago

I'm also not able to get it to work w/ 6.3 Not the end of the world - you don't even have to type the passwords, just look them up and copy and paste from 1password - but would be nice to have those quick keyboard shortcuts back.

soasme commented 8 years ago

Not work for me too..

mhe-de commented 8 years ago

I just updated 1Password to Version 6.3 and run into the same issue. Is a fix in work or do i have to go back to copy / paste my passwords :( Would love to hear that a fix is possible cause i use sudolikeaboss everyday and i love it so much!!! thx for an update

existemi commented 8 years ago

Would also love for this to get sorted out. +1 on thanks for an update.

nzkller commented 8 years ago

Hello guys,

My appstore secretly upgraded 1password to 6.3 and I've lost the possibility to sudolikeaboss.

Is there any investigation going on about this? I get the same errors in the system log

May 30 15:33:59 mco-cdassy 2BUA8C4S2C.com.agilebits.onepassword-osx-helper[2442]: 630031 [EXT:(Secondary Thread 0x7fa6526ad190):<OP4ExtensionClient: 0x7fa65266b9b0>] E findExtensionProcessForPort: | Failed to find extension process for 'chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk:51996', my PID: 2442, invalid output: '2442 2697 ', apps found: ( ) May 30 15:33:59 mco-cdassy 2BUA8C4S2C.com.agilebits.onepassword-osx-helper[2442]: 630031 [EXT:(Secondary Thread 0x7fa6526ad190):<OP4ExtensionClient: 0x7fa65266b9b0>] E findExtensionProcessForPort: | Stopping connection since no PID was found to validate the other side of the connection.

TyBrown commented 8 years ago

I was able to validate that this is an issue with v6.3 of the 1Password app, since I was able to rollback my version to v6.2 and confirm it worked fine then.

Since I'm a user of 1Password for Teams it was pretty easy:

  1. Stop the 1Password Mini app
  2. Delete the files in ~/Library/Application Support/1Password 4/Data
  3. Download and re-install the app bundle from this link
  4. Startup the 1Password app again
  5. Re-login to 1Password for Teams and watch your precious password re-sync.

For anyone using Local/Personal Vaults (a la old style of 1Password), I can't verify if backing up/exporting your data and then re-importing it would work. When I initially tried to just install the older app bundle over top of the existing data in ~/Library/Application Support/1Password 4/Data, I was getting all kinds of errors about the data being newer than the app version and that an upgrade was necessary, so if you are going to try this, make a backup and do so at your own risk!

rickfillion commented 8 years ago

Hello from AgileBits!

You'll need to make sure that your we socket connection is setup such that lsof sees that your pid is associated with that open port.

Rick Fillion 1Password Developer

amaltson commented 8 years ago

Thanks to @TyBrown for the instructions on rolling back, I followed the steps from AgileBits to remove my data. Then, being paranoid (sorry @TyBrown), I went to the 1Password download page and just changed the version number to 6.2, which worked.

sudolikeaboss has become an integral part of my workflow, rolling back is the only way. Thanks again to @ravenac95 for making such an awesome integration ❤️ 👍

bwithem commented 8 years ago

@rickfillion trying to debug the websocket with curl, any advice on what's going wrong here? None of the ws code in sudolikeaboss has changed recently...

curl --verbose -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: sudolikeaboss://local" -H "Origin:chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk" http://127.0.0.1:6263/4
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 6263 (#0)
> GET /4 HTTP/1.1
> Host: sudolikeaboss://local
> User-Agent: curl/7.43.0
> Accept: */*
> Connection: Upgrade
> Upgrade: websocket
> Origin:chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk
>
< HTTP/1.1 101 Web Socket Protocol Handshake
HTTP/1.1 101 Web Socket Protocol Handshake
< WebSocket-Location: ws://sudolikeaboss://local/4
WebSocket-Location: ws://sudolikeaboss://local/4
< Upgrade: WebSocket
Upgrade: WebSocket
< Connection: Upgrade
Connection: Upgrade
< WebSocket-Origin: chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk
WebSocket-Origin: chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk

* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
curl: (52) Empty reply from server

System Log Same erros as others are seeing...

Jun  1 00:29:42 bwithem2-mbp 2BUA8C4S2C.com.agilebits.onepassword4-helper[41316]: 630032 [EXT:(Secondary Thread 0x7faee3c1e600):<OP4ExtensionHTTPConnection: 0x7faee0f53b90>] M webSocketForURI: | [ES4] Extension connected Chrome-Extension 'chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk / (null)'
Jun  1 00:29:42 bwithem2-mbp 2BUA8C4S2C.com.agilebits.onepassword4-helper[41316]: 630032 [EXT:(Secondary Thread 0x7faee413a3a0):<OP4ExtensionClient: 0x7faee0fbc300>] E findExtensionProcessForPort: | Failed to find extension process for 'chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk:58150', my PID: 41316, invalid output: '3130
    41316
    ', apps found: (
    )
Jun  1 00:29:42 bwithem2-mbp 2BUA8C4S2C.com.agilebits.onepassword4-helper[41316]: 630032 [EXT:(Secondary Thread 0x7faee413a3a0):<OP4ExtensionClient: 0x7faee0fbc300>] E findExtensionProcessForPort: | Stopping connection since no PID was found to validate the other side of the connection.
rickfillion commented 8 years ago

@bwithem hrmmmm.... that's curious.

The output there makes it look like lsof is actually seeing your pid. One thing to check is that sudolikeaboss actually shows up as an NSRunningApplication. In our code there's this when processing the pids:

NSRunningApplication *app = [NSRunningApplication runningApplicationWithProcessIdentifier:pid];
if (!app || app.terminated) {
    continue;
}
rickfillion commented 8 years ago

Once this is figured out, Rudy reminded me of another change we did that might end up affecting you. You'll want to make sure you send the Hello, then make sure you don't send anything you don't want dropped until you get the Welcome response. Welcome is currently the sign to use that we've actually accepted the connection.

bwithem commented 8 years ago

@rickfillion well that certainly sounds like it's the culprit... I wonder if the connections are getting dropped so fast the PID doesn't exist anymore. @ravenac95 do you have time to look into this? I see you are sending the hello, but not waiting for the welcome:

https://github.com/ravenac95/sudolikeaboss/blob/master/onepass/client.go#L114

command := client.createCommand("hello", payload)

    response, err := client.SendCommand(command)
    if err != nil {
        return nil, err
    }
    return response, nil
roodkcab commented 8 years ago

Hi, guys

I tried to use hopper debugger and Wireshark to see what's going wrong on 1password 6.3, and make the helper to stop before send welcome, while sudolikeaboss is exit with 1 i.e. the ws socket is disconnected at that time, then when i stepped over send instruction, I got a welcome message in Wireshark.

Then I think it's maybe something wrong with my golang ws package, so I try to use node to communicate with 1password, still without luck, the welcome package seems being corrupted, it only sends a TCP [FIN, ACK] package without any payload

I put the output of whole hello process in Wireshark here

rudyrichter commented 8 years ago

@ravenac95 I'm also around if you have any questions, just @ me.

ravenac95 commented 8 years ago

Hey guys,

I'm very sorry for the late reply. I have been away on vacation until today in a place with very little internet access. I will look into this as it definitely pertains to me so I will see if I can get a fix. Thanks for all the investigations done so far. I will keep you guys posted as I can.

roodkcab commented 8 years ago

As @rickfillion mentioned, sudolikeaboss is a command line tool, [NSRunningApplication runningApplicationWithProcessIdentifier:] returns nil, which lead to a disconnect on websocket

I've tested on my mac with a simple websocket GUI app, and everything is fine then.

Cheers

roodkcab commented 8 years ago

I've made a temp fix for 6.3 at here

Since it seems [NSRunningApplication runningApplicationWithProcessIdentifier:] only return nonnull when it's an NSApp, so I use cgo to create a invisible window in main thread

and dispatch sudolikeaboss to another

replace main.go and compile it using CC=clang go build

ssgelm commented 8 years ago

@shuoshi that's awesome! It works for me. It's not ideal because it adds an icon to the dock but I'll definitely use it for now!

ravenac95 commented 8 years ago

For now it seems like @shuoshi might be the best workaround. I'm trying to see if there's any other solution I can do to make the installation of everything much simpler. I'll continue experimenting if I can't find anything by the weekend I'll package up @shuoshi's fix.

rickfillion commented 8 years ago

You could maybe use the nsapp activation policy setters to make the dock icon go away.

On Jun 2, 2016, at 11:29 PM, roodkcab notifications@github.com wrote:

I've made a temp fix for 6.3 at here

Since it seems [NSRunningApplication runningApplicationWithProcessIdentifier:] only return nonnull when it's an NSApp, so I use cgo to create a invisible window in main thread

and dispatch sudolikeaboss to another

replace main.go and compile it using CC=clang go build

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ssgelm commented 8 years ago

@rickfillion Good call. When I change

[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];

to

[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];

there is no dock icon and everything still works as expected. With that change sudolikeaboss functions exactly as it did before without the launch delay that the dock icon added.

rickfillion commented 8 years ago

Awesome! Good work, @ssgelm. :)

roodkcab commented 8 years ago

Great @ssgelm, gist updated~

nzkller commented 8 years ago

This is great @shuoshi Thanks for the temp fix. Could you please tell me the steps and commands you used to compile sudolikeaboss with your main.go?

Thanks in advance and best regards

roodkcab commented 8 years ago

Hi @nzkller, just type

CC=clang go build

at the root directory of sudolikeaboss

nzkller commented 8 years ago

Thank you very much it worked perfectly!!! @shuoshi Have a great weekend 👍

jasonlfunk commented 8 years ago

Will there be a new release soon that fixes this? I miss being able to use 1password from the terminal.

sillygwailo commented 8 years ago

While we wait for an official release, here's how I got this working:

  1. brew install go
  2. export GOPATH=$HOME/go
  3. mkdir ~/go
  4. go get github.com/jorgelbg/sudolikeaboss
  5. Update the "Run Coprocess" path in the iTerm preference (under the Keys tab) to ~/go/bin/sudolikeaboss

(When there's an official release, you can just remove the go directory and run brew upgrade sudolikeaboss, then update the path to the old path.)

Thanks to @jorgelbg for the fork that incorporates that fix.

jasonlfunk commented 8 years ago

@sillygwailo Works perfectly. Thanks!

wolfg1969 commented 8 years ago

@sillygwailo Thanks!

ravenac95 commented 8 years ago

Merged a fix for this. Will have the official release ready by tomorrow at the latest.