Skip to content

Instantly share code, notes, and snippets.

@detro
Created August 10, 2015 21:19
Show Gist options
  • Save detro/9d98361a3f4fa1a9aca1 to your computer and use it in GitHub Desktop.
Save detro/9d98361a3f4fa1a9aca1 to your computer and use it in GitHub Desktop.
1PasswordAnywhere + Dropbox + Upstart = 1Password for Ubuntu
description "Starts a SimpleHTTPServer to host 1 Password Anywhere"
author "Ivan De Marino <[email protected]>"
version "1.0.0"
# When to start/stop
start on runlevel [2345]
stop on runlevel [016]
# Keep it running
respawn
# Run as user
setuid YOUR_LOGIN_USERNAME
chdir /home/YOUR_LOGIN_USERNAME/Dropbox/1Password/1Password.agilekeychain/
script
python -m SimpleHTTPServer 8888
end script

Description

1Password doesn't support Linux. But it comes with a very clever HTML page, saved just next to your 1Password keychain. It's called 1PasswordAnywhere.

By default, it's adviced to load that page via Dropbox web interface. But what it actually needs is just to host that directory in a plain webserver somewhere.

So what this Upstart script does, is to launch a Python SimpleHTTPServer at startup, binding it to port 8888 (change that if you want) and runs from your 1Password keychain in Dropbox (make sure that path is correct for you).

Also, I added the use of setuid to ensure the service is run with low permissions. Feel free to improve: I wrote this in like 10 minutes.

Install

  1. Ensure your 1Password keychain is synchronized on Dropbox
  2. Install Dropbox for Linux
  3. Cut & paste the file above at /etc/init/1password.conf
  4. Replace YOUR_LOGIN_USERNAME with the right value (and check the path to your 1Password keychain)
  5. On terminal run:
  • $ initctl reload-configuration
  • $ start 1password
  1. In your browser of choice, go to http://localhost:8888

Note for other Linux distro

The script above is written for Ubuntu Upstart, but it can surely be adapted to other distro easily. I leave it to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment