Git Product home page Git Product logo

tmux-1password's Introduction

tmux-1password

Build Status

Access your 1Password login items within tmux!

tmux-1password-demo.mp4

This plugin allows you to access you 1Password items within tmux, using 1Password's CLI. It works for personal 1Password accounts, as well as teams accounts.

Requirements

This plugin relies on the following:

Key bindings

In any tmux mode:

  • prefix + u - list login items in a bottom pane.

Install

Using Tmux Plugin Manager (recommended)

  1. Add plugin to the list of TPM plugins in .tmux.conf:

    set -g @plugin 'yardnsm/tmux-1password'
    
  2. Hit prefix + I to fetch the plugin and source it. You should now be able to use the plugin.

Manual Installation

  1. Clone this repo:

    $ git clone https://github.com/yardnsm/tmux-1password ~/some/path
  2. Source the plugin in your .tmux.conf by adding the following to the bottom of the file:

    run-shell ~/some/path/plugin.tmux
    
  3. Reload the environment by running:

    $ tmux source-file ~/.tmux.conf

Using older versions of 1Password's CLI

If you're using an older version of the CLI (< 2.0), you can use this plugin via the legacy branch. For example, using TPM:

set -g @plugin 'yardnsm/tmux-1password#legacy'

Usage

Initiate the plugin by using the keybind (prefix + u by default). If you haven't added an account to the 1Password's CLI, the plugin will prompt you to add one. You can also manage your connected accounts manually using the op account command.

Once you have an account, while initiating the plugin a new pane will be opened in the bottom, listing the appropriate login items. Press <Enter> to choose a login item, and its password will automatically be filled.

You can also press Ctrl+u while hovering an item to fill a One-Time Password.

You may be required to perform a re-login (directly in the opened pane) since the 1Password CLI's sessions expires automatically after 30 minutes of inactivity.

Biometric Unlock

For supported systems, you can enable signing in with biometric unlock. When biometric unlock is enabled, you'll be prompted to authorize using it when then plugin is being initiated.

Configuration

Customize this plugin by setting these options in your .tmux.conf file. Make sure to reload the environment afterwards.

Changing the default key-binding for this plugin

set -g @1password-key 'x'

Default: 'u'

Setting the sign-in account

1Password's CLI allows signing in with multiple accounts, while this plugin is able to work against a single one. You can specify which account to use using this option.

As per the documentation, you can use the shorthand, sign-in address, or account ID to refer to a specific account.

set -g @1password-account 'acme'

Default: 'my'

Setting the default vault

set -g @1password-vault 'work'

Default: '' (all vaults)

Copy the password to clipboard

By default, the plugin will use send-keys to send the selected password to the targeted pane. By setting the following, the password will be copied to the system's clipboard, which will be cleared after 30 seconds.

set -g @1password-copy-to-clipboard 'on'

Default: 'off'

Filter items via tags

By default, all of the items will be shown. You can use this option (comma-separated) if you want to list items that has specific tags.

set -g @1password-filter-tags 'development,servers'

Default: '' (no tag filtering)

Debug mode

If you're having any trouble with the plugin and would like to debug it's output in a more convenient way, this option will prevent the pane from being closed.

set -g @1password-debug 'on'

# Or running the following withing tmux:
tmux set-option -g @1password-debug "on"

Prior art

Also see:


License

MIT ยฉ Yarden Sod-Moriah

tmux-1password's People

Contributors

jihbuomj avatar marwing avatar sherrman avatar tapayne88 avatar yardnsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tmux-1password's Issues

Fetching only logins, not passwords

Hi!

I use 1Password to store SSH and GPG keys passwords too. I'm loving the tool, but it is currently only fetching login on websites.

There is any config I should activate to fetch passwords (those items where you store only the password, without any website and login associated to it) too?

Fails to fetch the items

Hey, I didn't manage to launch it with my 1password config, it seems that it crashes with session error, but I am pretty sure that I have op cli session running through CLI.

The question is how do I debug it to provide more info?
I have looked into the source and .op_tmux_token_tmp was empty, but situation didn't change after I filled it with a session from op cli manually.

I have a suspicion that JQ fails to parse the output.
kapture 2018-10-21 at 12 51 27

New sign-in required on every single use

Information

Tmux version: 3.2
1Password CLI version: 2.12.0
Operating system: macOS Catalina 10.15.7 running with iTerm2 or Terminal

Description

Current behavior: On every use of the plugin (prefix + u), the modal dialog pops up 1password is trying to authorize CLI access. You must click to proceed.

Expected behavior: Requesting a password within 10 minutes of the last activity shouldn't force you to reauthorize the CLI.

For me, after opening another window or pane in tmux, reauthorization is immediately required the first time op is used in that tab, including with the plugin. In the same shell/window/pane or a subshell, it is not required for at least 10 minutes.

The developer's guide documents that opening a new terminal will always require reauthorization, but opening a subshell will not. It is not clear how this applies to tmux, or if there is some tmux configuration issue on my side. It's not really usable like this though, since the dialog box requires a click and does not refocus on the terminal afterward, so you have to command-tab to get back.

I suspect this is because it's using a different TTY, and therefore, this might not be working correctly for anybody?

Steps to reproduce

  1. Authorize the CLI once by requesting a password with the plugin, or just typing op item list
  2. Use the plugin again, or manually open a new window/pane in tmux and type op item list
  3. Receive another authorization prompt

Empty password field

I have a 1password entry that breaks main.sh's get_op_item_password(). The JQ_FILTER is setup to check if the item's details.password field exists otherwise find a field with the password designation.

I'm not sure how I this entry got into this state, but it has a details.password field (empty string). The actual password is in one of the fields objects.

op get item "<item uuid>" | jq .details --raw-output:

{
  "fields": [
    {
      "designation": "username",
      "id": ";opid=__0",
      "name": "username",
      "type": "T",
      "value": "[email protected]"
    },
    {
      "designation": "password",
      "id": ";opid=__1",
      "name": "password",
      "type": "P",
      "value": "secretpassword"
    },
    [...]
  ],
  "password": "",
  "passwordHistory": [
    {
      "time": 999999,
      "value": "oldsecretpassword"
    }
  ],
  [...]
}

How should this behave?

(And is this related to the passwordHistory field? I spot checked a few random other entries that work and the others don't have a passwordHistory.)

Would you be ok with a fork for lastpass?

I may not get around to it, but I love the look and idea of this plugin, and it doesn't look too difficult to port to use lastpass instead of onepass. May even be possible to create a generic version that just needs commands plugged in!

Would you be happy with this being done?

Sign in failed due to "Deprecated API"

I'm using op version 0.4, while the latest version is currently 0.5.5. When trying to initiate the plugin and after entering the master password, I'm getting:

tmux-1password: 1Password CLI signin has failed

Running $ op signin my to troubleshoot the issue have resulted in the following error:

$ op signin my
Enter the password for user *********** at my.1password.com:
[LOG] 2019/03/13 14:14:54 (ERROR) 445: Deprecated API. Update to the latest version.

And updating op does solve the issue.

Possible solutions

  • Add a "Troubleshoot" section to the README explaining running op signin my and checking the output.
  • Detect that kind of output and notify the user about upgrading op.

Add debug mode

The idea is to have a configuration variable, for example: @1password-debug, that when set to 'on', the plugin will:

  • Add some extra logging on events.
  • Does not exit immediately when an error is thrown.

Can't get any password

I'm trying to get this plugin to work. I've installed it with tpm and have checked that I've already fzf and jq installed. Also, I have the op cli tool installed and configured (I use it on my shell)

But, everytime I type prefix + u I can't see any password (only an empty list). Also, every time I use the command I need to login again.

Can anyone help me?

Support 1pass

One limitation of the 1Password CLI is that it is DAMN SLOW, as it requires an internet connection to fetch data from your vaults. Also, it uses tokens that expire after 30 minutes.

There is another project called 1pass, which is (according to the README) a caching wrapper for the 1Password CLI.

It would be nice to add support for this wrapper, as it would improve the experience of this plugin, while preserving the support for the official op CLI.

We could have an adapter for each CLI, and the user can configure which adapter to use.

Plugin not using $FZF_DEFAULT_OPTS

๐Ÿ˜ฐ Describe the bug

I've noticed that the plugin only uses $FZF_DEFAULT_OPTS environment variables if it is a string.

๐Ÿง How to reproduce

For example, if I use the following:

export FZF_DEFAULT_OPTS="\
  --ansi \
  --cycle \
  --layout reverse \
  --height 20 \
  --preview '(highlight -O ansi -l {} 2> /dev/null || bat --style=numbers --color=always {} || cat {} || tree -C {}) 2> /dev/null | head -200' \
  --preview-window right:70%:noborder \
  --bind='?:toggle-preview' \
  --bind='tab:down'"

It shows my items in a reverse list with FZF. But, if I change to the following:

export FZF_DEFAULT_OPTS=(
  --ansi
  --cycle
  --layout='reverse'
  --height='20'
  --preview="'(highlight -O ansi -l {} 2> /dev/null || bat --style=numbers --color=always {} || cat {} || tree -C {}) 2> /dev/null | head -200'"
  --preview-window='right:70%:noborder'
  --bind='?:toggle-preview'
  --bind='tab:down'
)

It just stop working, showing a non-reverse list ignoring my other options.

๐ŸŽ‰ Expected behavior

Using () on $FZF_DEFAULT_OPTS should work accordingly as if it were a string.

Didn't work without customisation.

Hello, I've installed this awesome plugin and it didn't work straight away. Needed two tweaks.

At first it was loading only items from "Logins" category, which was not very useful because I keep server passwords used in CLI in "Servers" category. This was solved with
set -g @1password-enabled-url-filter 'off'
and
set -g @1password-items-jq-filter '.[] | [select(.overview.tags | map(select(. == "server")) | length == 1)?] | map([ .overview.title, .uuid ] | join(",")) | .[]'

Then it was fetching the items correctly, but it could not get any passwords, so I had to tweak the jq filter used to get the password value and change it to ".details.sections[].fields[]|select (.n == \"password\").v"

After those two changes it works.

Items not displaying when containing multiple/no websites

It seems that entries only display when they contain a single website. Any entries without a website or multiple websites doesn't show. I can temporarily working around it by splitting out entries but 1Password will gripe about reused passwords and I'd ideally like to converge entries that should share.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.