Coder Social home page Coder Social logo

jle64 / gnome-pass-search-provider Goto Github PK

View Code? Open in Web Editor NEW
79.0 4.0 15.0 17.9 MB

Pass password manager search provider for gnome-shell

License: GNU General Public License v3.0

Python 91.83% Shell 8.17%
password-manager password-store pass gnome gnome-shell-extension gnome-shell bitwarden vaultwarden passwordstore

gnome-pass-search-provider's Introduction

A search provider for GNOME Shell that adds support for searching in:

  • zx2c4/pass
  • compatible alternatives such as gopass
  • or the rbw Bitwarden/Vaultwarden client

Names of entries will show up in GNOME Shell searches, choosing one will copy the corresponding content to the clipboard.

Supports:

  • using the GPaste clipboard manager
  • OTP with the pass-otp extension
  • fields (cf below for syntax)

Sreencapture

Installation

Packaging status

Arch Linux

Install gnome-pass-search-provider-git from the AUR.

Debian, Ubuntu and derivatives

If a package is available for your distribution version (see above for packaging status), just install gnome-pass-search-provider through APT:

apt install gnome-pass-search-provider

Fedora

Copr build status

Enable the copr repo and install the package with DNF:

dnf copr enable jle64/gnome-pass-search-provider
dnf install gnome-pass-search-provider

Manual

Ensure that python>=3.7 as well as the dbus, gobject and thefuzz (formerly fuzzywuzzy, might still be packaged under that name in your distribution) Python modules are installed. They should all be packaged under python-name or python3-name depending on your distribution.

Clone this repository and run the installation script as root:

git clone https://github.com/jle64/gnome-pass-search-provider.git
cd gnome-pass-search-provider
sudo ./install.sh

Post-installation

Log out and reopen your GNOME session.

The search provider will be loaded automatically when doing a search.

You should see it enabled in GNOME Settings, in the Search pane. This is also where you can move it up or down in the list of results relatively to other search providers.

Advanced usage

OTP

The pass-otp extension is supported. Searches starting with otp will copy the otp token to the clipboard.

Fields

To copy other values than the password in the first line from a pass file, start the search with :NAME search.... The field name must be a full but case insensitive match. This requires GPaste.

For example with a pass file like:

SUPERSECRETPASSWORD
user: username
pin: 123456

To copy the pin start the search with :pin and for the username with :user.

Disabling notifications

Set the DISABLE_NOTIFICATIONS environment variable to True.

Alternative password providers

Gopass and other pass-compatible tools

If you want to use gopass or another pass compatible tool instead of pass, you need to set the proper environment variables to point to the executable and password store directory to use.

For example, on a systemd-based OS, you can run systemctl --user edit org.gnome.Pass.SearchProvider.service and add in the file:

[Service]
Environment=PASSWORD_EXECUTABLE=gopass
Environment=PASSWORD_STORE_DIR=/home/jonathan/.local/share/gopass/stores/root

(be careful not leave a trailing "/" at the end of the PASSWORD_STORE_DIR path)

Then save and restart the service with systemctl --user restart org.gnome.Pass.SearchProvider.service.

On other systems, you might want to use ~/.profile or another mechanism to set these environment variables.

Bitwarden/Vaultwarden

To search in Bitwarden/Vaultwarden instead of pass, you will need to setup rbw. You'll also need to install wl-clipboard or another clipboard utility (such as xclip), unless you use GPaste.

You need to set the proper environment variables to point to the executables and specify to operate in Bitwarden mode.

For example, on a systemd-based OS, you can run systemctl --user edit org.gnome.Pass.SearchProvider.service and add in the file:

[Service]
Environment=PASSWORD_EXECUTABLE=rbw
Environment=PASSWORD_MODE=bw
Environment=CLIPBOARD_EXECUTABLE=wl-copy

Then save and restart the service with systemctl --user restart org.gnome.Pass.SearchProvider.service.

On other systems, you might want to use ~/.profile or another mechanism to set these environment variables.

Clipboard managers

By default, passwords are sent to the clipboard using pass -c, which defaults to expiration after 45 seconds.

If GPaste is installed, passwords be sent to it marked as passwords through its API, thus ensuring they are not visible in the UI.

Compatibility

This implements the org.gnome.Shell.SearchProvider2 D-Bus API and has been tested with GNOME Shell 3.22 to 42. This uses the org.gnome.GPaste1 or org.gnome.GPaste2 versions of the GPaste D-Bus API to add passwords to GPaste.

Troubleshooting

Environment variables have no effect

If you are configuring pass using environment variables, such as PASSWORD_STORE_DIR, make sure to set them in a way that will propagate to the search provider executable, not just in your shell.

On systemd-based OSes, you can directly set them in ~/.config/environment.d/*.conf (see man environment.d). On other systems, setting them in ~/.profile should be sufficient, but keep in mind that some shell-specific files such as ~/.bashrc might be only loaded in non-login interactive shells and will thus not propagate to the script.

If your values have no effect, make sure they propagate to the script environment. You can check this by displaying the process environment with ps and looking for your values here:

ps auxeww | grep [g]nome-pass-search-provider.py

Passphrase is not requested to unlock store

If you don't see passphrase prompts when your key is locked, it might be because GPG is not using the right pinentry program. You can force gpg-agent to use pinentry-gnome3 by adding pinentry-program /usr/bin/pinentry-gnome3 to ~/.gnupg/gpg-agent.conf.

Other problems

If you encounter problems, make sure to look in the logs of GNOME and D-Bus. On systems that use systemd, you can do this using journalctl --user.

Don't hesitate to open an issue.

gnome-pass-search-provider's People

Contributors

chrismsnz avatar dmo60 avatar electrickite avatar infeeeee avatar jle64 avatar jnphilipp avatar layerex avatar martinnowak avatar matze avatar mistersmee avatar shtrom 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

Watchers

 avatar  avatar  avatar  avatar

gnome-pass-search-provider's Issues

Pass entries don't show up in search

This seem to be the relevant log lines:

Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating service name='org.gnome.ControlCenter.SearchProvider' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " label="unconfined")
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating service name='org.gnome.Contacts.SearchProvider' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " label="unconfined")
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating service name='org.gnome.Nautilus' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " label="unconfined")
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating service name='org.gnome.Calculator.SearchProvider' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " label="unconfined")
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating service name='org.gnome.Calendar' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " label="unconfined")
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating via systemd: service name='org.gnome.Pass.SearchProvider' unit='org.gnome.Pass.SearchProvider.service' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " 
label="unconfined")
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating service name='org.gnome.seahorse.Application' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " label="unconfined")
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Activating service name='org.gnome.Weather.BackgroundService' requested by ':1.42' (uid=1000 pid=2386 comm="/usr/bin/gnome-shell " label="unconfined")
Jan 25 14:54:17 critter systemd[1550]: Starting Pass search provider for GNOME Shell daemon...
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.ControlCenter.SearchProvider'
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.Pass.SearchProvider'
Jan 25 14:54:17 critter systemd[1550]: Started Pass search provider for GNOME Shell daemon.
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.seahorse.Application'
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.Weather.BackgroundService'
Jan 25 14:54:17 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.Contacts.SearchProvider'
Jan 25 14:54:18 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.Calculator.SearchProvider'
Jan 25 14:54:18 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.Nautilus'
Jan 25 14:54:18 critter dbus-daemon[1569]: [session uid=1000 pid=1569] Successfully activated service 'org.gnome.Calendar'

Jan 25 14:54:18 critter systemd[1550]: Started GnuPG cryptographic agent and passphrase cache.
Jan 25 14:54:18 critter gpg-agent[9696]: gpg-agent (GnuPG) 2.2.20 starting in supervised mode.
Jan 25 14:54:18 critter gpg-agent[9696]: using fd 3 for browser socket (/run/user/1000/gnupg/S.gpg-agent.browser)
Jan 25 14:54:18 critter gpg-agent[9696]: using fd 4 for std socket (/run/user/1000/gnupg/S.gpg-agent)
Jan 25 14:54:18 critter gpg-agent[9696]: using fd 5 for ssh socket (/run/user/1000/gnupg/S.gpg-agent.ssh)
Jan 25 14:54:18 critter gpg-agent[9696]: using fd 6 for extra socket (/run/user/1000/gnupg/S.gpg-agent.extra)
Jan 25 14:54:18 critter gpg-agent[9696]: listening on: std=4 extra=6 browser=3 ssh=5
Jan 25 14:54:18 critter gnome-shell[2386]: Received error from D-Bus search provider org.gnome.seahorse.Application.desktop during GetResultMetas: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.gnome.Shell.SearchProvider2” on object at path /org/gnome/seahorse/Application
Jan 25 14:54:18 critter gnome-shell[2386]: Wrong number of result metas returned by search provider org.gnome.seahorse.Application.desktop: expected 3 but got 0

Is there anything else I can do for further debugging?

Installed version:

gnome-pass-search-provider/groovy,groovy,now 0.0~20191115+da2db41-1 all [installed]

Do not ask for unlock password automatically?

Thank you for this! Works very well, I use this with rbw!

I have one issue:

If I just started the computer, I don't always need my passwords yet, I just want to open a program by searching for its name. Of course pinentry pops up requesting the master password as I start to search. The search is unusable until I unlock the db, the dialog will reopen after each new typed character, even if I close the prompt.

Is it possible to not show up this dialog automatically? Maybe if the db is locked it won't try to search for a password, unless I search for unlock or Pass beforehand?

[Request] Case-insensitive search

I tried to understand how you code works and saw that you're using difflib.SequenceMatcher. I have no idea how the ratio() method works, but to find "ArchLinux/..." I have to type at least "archli". Notice I'm using lower-case. I can get the result faster if I type "Arc", but that's slightly less convenient.

Is there something we can do? Maybe lower (or higher?) the value you compare with ratio() (which is 0.5)?

Doesn't work with 3.34

I have installed gnome 3.34 and gnome-pass-search-provider doesn't seem to work anymore. Results are just not shown.

[whishlist] Add desktop notifications

When a user selects a password and presses enter there is no feedback, maybe a notification saying that the password was copied would be interesting.

Same when pass errors out. For example the gpg key is missing, then no feedback is reported and nothing gets into the clipboard.

Environment variable loading

I'd like to set a environment variable in .bashrc.

export PASSWORD_STORE_DIR=$XDG_DATA_HOME/pass

Then this search provider doesn't work. Please fix it.

Writing an Ebuild for Gentoo

Hello,

i was attempting to write an Ebuild for Gentoo for this extension. I've closely followed the install.sh but i wasn't using it directly. So far, all the files are in their expected places.

Somehow i am still getting this error:

gnome-shell[1283]: Received error from DBus search provider org.gnome.Pass.SearchProvider.desktop: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Pass.SearchProvider was not provided by any .service files

The file itself is there:

-rw-r--r-- 1 root root 198 14. Dez 16:06 /usr/lib/systemd/user/org.gnome.Pass.SearchProvider.service

Is there anything i've missed?

Running Gnome Shell 3.32

Arch Linux: Unable to install due to permissions for /usr/lib/...

I was able to install this package on one of my two machines, but the second machine keeps failing during the installation. I'm using pikaur, but below I'll show you the manual build/install steps that result in the same issue.

$ pikaur -S gnome-pass-search-provider-git
Reading repository package databases...
Reading local package database...
Resolving AUR dependencies...

:: AUR package will be installed:
 gnome-pass-search-provider-git                             -> r9.bed2f59-2

:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> y
looking for conflicting AUR packages...
:: warning: Not showing diff for gnome-pass-search-provider-git package (installing for the first time)
Do you want to edit PKGBUILD for gnome-pass-search-provider-git package? [Y/n] n

:: Downloading the latest sources for a devel package gnome-pass-search-provider-git...

:: Starting the build:
==> Making package: gnome-pass-search-provider-git r49.79a0c36-1 (Fri 31 May 2019 07:44:38 PM EDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating gnome-pass-search-provider git repo...
Fetching origin
==> Validating source files with md5sums...
    gnome-pass-search-provider ... Skipped
==> Extracting sources...
  -> Creating working copy of gnome-pass-search-provider git repo...
Reset branch 'makepkg'
==> Starting pkgver()...
==> Removing existing $pkgdir/ directory...
==> Entering fakeroot environment...
==> Starting package()...
install: cannot create regular file '/usr/lib/gnome-pass-search-provider/gnome-pass-search-provider.py': Permission denied
==> ERROR: A failure occurred in package().
    Aborting...

Command 'makepkg --force' failed to execute.
:: Try recovering?
[R] retry build
[p] PGP check skip
[c] checksums skip
[i] ignore architecture
[d] delete build dir and try again
[e] edit PKGBUILD
------------------------
[s] skip building this package
[a] abort building all the packages

If I instead run sudo pikaur -S ..., I get a different error,

...
==> Entering fakeroot environment...
==> Starting package()...
install: cannot create regular file '/usr/lib/gnome-pass-search-provider/gnome-pass-search-provider.py': Read-only file system
==> ERROR: A failure occurred in package().
    Aborting...
Finished with result: exit-code
Main processes terminated with: code=exited/status=4
Service runtime: 894ms

Command 'systemd-run --pipe --wait -p DynamicUser=yes -p CacheDirectory=pikaur -E HOME=/tmp -p WorkingDirectory=/var/cache/pikaur/build/gnome-pass-search-provider-git makepkg --force' failed to execute.
...

Trying to manually install it,

git clone https://aur.archlinux.org/gnome-pass-search-provider-git.git
cd gnome-pass-...-git.git
makepkg --si

Smiliar issue as previous method.


I did end up getting it to work. I had to modify the PKGBUILD,

 package() {
         cd "$srcdir/$_pkgname"
-         ./install.sh
+        sudo ./install.sh
 }

I don't have any experience creating PKGBUILD files, so I don't know if using sudo here is the correct thing to do.

flatpak build

This seems to be interesting in a Flatpak package.

GPG called two times when gpaste is not installed

Thanks for this great extension!

One minor annoyance I noticed with it is that when gpaste is not installed the extension calls pass (and thus gpg) two times. This is fine for most users, but if you have a smartcard (such as a YubiKey) that requires a physical touch to decrypt each file it gets annoying pretty fast, as you have to touch the smartcard two times each password you decrypt.

Thankfully after taking a look at the source the workaround (just installing gpaste) was trivial, but maybe you could check whether gpaste is available over DBus before choosing which method to copy the password to use?

AttributeError: 'bool' object has no attribute 'lower'

I have this error that makes the service fail to start since a few days. Here's the journal output:

systemd[1174]: Starting Pass and Bitwarden search provider for GNOME Shell daemon...
systemd[1174]: Started Pass and Bitwarden search provider for GNOME Shell daemon.
gnome-pass-search-provider.py[11832]: Traceback (most recent call last):
gnome-pass-search-provider.py[11832]:   File "/usr/lib/gnome-pass-search-provider/gnome-pass-search-provider.py", line 248, in <module>
gnome-pass-search-provider.py[11832]:     SearchPassService()
gnome-pass-search-provider.py[11832]:   File "/usr/lib/gnome-pass-search-provider/gnome-pass-search-provider.py", line 71, in __init__
gnome-pass-search-provider.py[11832]:     getenv("DISABLE_NOTIFICATIONS", False).lower() == "true"
gnome-pass-search-provider.py[11832]: AttributeError: 'bool' object has no attribute 'lower'
systemd[1174]: org.gnome.Pass.SearchProvider.service: Main process exited, code=exited, status=1/FAILURE
systemd[1174]: org.gnome.Pass.SearchProvider.service: Failed with result 'exit-code'.

Fixed with #33

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.