Git Product home page Git Product logo

keepass-node's Introduction

KeePass-Node

Node.js with AngularJS implementation of a KeePass2 editor.

Build Status Coverage Status

What?

You should probably know about KeePass as a tool to manage your passwords or other secrets in an encrypted file. Since the default tool to edit and view your passwords is based on .NET you might not be able to use your keys everytime you need them due to missing libraries or a wrong platform (Mono needs to be installed on Linux systems).

KeePass-Node is based on the idea of BrowsePass, which helps you to open a file from your current filesystem or from a URL by using only browser based libraries.

While it's a great step forward to use a browser based KeePass reader, I don't want to save my keepass file in any cloud (I guess I changed my mind - see below for Google Drive sync) or keep it with me on a USB stick all the time. I expect to mostly have internet access, so what about saving my keepass file on my private server and access it by a tool like BrowserPass? For the typical usage of only reading from my keepass file, that would be enough.

To make BrowserPass more convenient, I didn't want to always upload a keepass file. I just wanted to enter a password to see my entries, so I searched for an improved solution. Long story short: I didn't find any, so I build it myself. KeePass-Node was born.

Installation

First, you need Node.js running on your server of choice and navigate to a suitable folder. Then:

~$ git clone https://github.com/gesellix/keepass-node.git
~$ cd keepass-node

You'll find a config template keepass-node-config.template.js which shows you how to configure port (default 8443), an optional context path (also known as base path), https (optional), basic authentication (optional), and Google Drive sync (optional). Optional features are disabled by default.

To give KeePass-Node a minimal config you need to create a file keepass-node-config.js in the project's root folder and paste at least something like this:

module.exports = {
  "port": 8443
};

After changing its content to fit your needs, you can finish the installation and start the KeePass-Node server:

~/keepass-node$ npm install
~/keepass-node$ npm start

NPM should download a small part of the internet for you and start the KeePass-Node server on the configured port. You may now enter the URL into your browser like follows, just replace "localhost" with your hostname: http://localhost:8443/.

KeePass-Node comes with an example.kdbx which should be the already selected database. You have to enter the keepass file password now, the default is password. After a click on load, you should see the familiar tree structure of keepass groups.

How to provide your personal KeePass2 file

Local copy

Then you need to provide your keepass file. KeePass-Node expects any keepass files in the subfolder ./local/. You should find the mentioned example.kdbx there. You can copy your keepass file to that folder or create a symbolic link (Windows users may ignore that hint). Hit CTRL-C if KeePass-Node is still running or use another shell.

~/keepass-node$ cd local
~/keepass-node/local$ ln -s ~/path/to/my/keepass.kdbx keepass.kdbx

Now start the server again (if not still running):

~/keepass-node/local$ cd ..
~/keepass-node$ npm start

Refresh your browser window and you should see your keepass.kdbx in the database dropdown list.

Download from Google Drive

In case you also keep your keepass.kdbx file on Google Drive, you can make KeePass-Node update the local copy by downloading it from Google Drive. I didn't want to publicly share my keepass file, so I configured a web application client for Google Drive at the Google Developers Console. If this is completely new for you, you can find a very short introduction at the Google Drive SDK Quickstart. Essentially, you'll need to go through the setup of a project and application in the Developers Console.

After your application setup, KeePass-Node need the following properties:

"client_id": "123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com",
"client_secret": "aBcDeFgHiJkL987456_01234",
"redirect_uris": ["https://www.example.com:8843/update/oauth2callback"]

Please make sure that the first element in redirect_uris has a path equalling /update/oauth2callback, due to the current implementation. The properties need to be pasted into the config file keepass-node-config.js under googleDrive.clientSecret. Please also provide a googleDrive.fileTitle and change the property googleDrive.enabled to true.

After restarting KeePass-Node, you can enter the following uri in your browser: https://www.example.com:8843/update. It should redirect you to a Google page asking you for permission to make KeePass-Node use your Google Drive in readonly mode. When you accept the permission, you'll be redirected back to KeePass-Node, and it will download the file named like you have configured as fileTitle and save it at .../local/google-drive.kdbx.

A browser refresh later, and you can choose the updated google-drive.kdbx from the KeePass-Node database dropdown.

Next

There already are some ideas on improving this little tool:

Technical details

As mentioned above I wanted to use the BrowserPass concept to read .kdbx files. Well, I tried to use its code and converted it to a little node module. That wasn't much fun and the result wasn't beautiful (you may find it in the commit history), so I searched for an existing node module and found a working one named keepass.io.

The frontend uses AngularJS as application framework, Angular Treeview for the keepass entry navigation, clipboard.js for convenient "copy password", and the Angular Material for the ui and interaction stuff.

Contributing and Contact

Issues and pull requests can be submitted via GitHub. You may contact me via Twitter: @gesellix.

License

See Apache 2 License.

keepass-node's People

Contributors

aruhier avatar bryant1410 avatar gesellix avatar namn 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

Watchers

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

keepass-node's Issues

Basic Authentication Doesn't Work

In server.js, line 30:

app.use(express.basicAuth())

In Express 4, basicAuth() was removed in favor of specific middleware. Perhaps you could implement Passport or some other middleware for authentication. As of now, however, this doesn't work and I get an error with a clean install when I enable Basic Authentication.

When I tried to install middleware of my own (for quick testing, I tried http-auth) and modify this function accordingly, keepass-node asks me to log in and keeps presenting the login box again and again when I enter my username and password.

Very slow

I am trying to read a KeepPass database using keepass.io package but it seems to be taking 4 minutes to open the database. I was wondering if this has anything to do with the message i got during installation DO NOT WORRY ABOUT THESE MESSAGES. KEEPASS.IO WILL FALLBACK TO SLOWER NODE.JS METHODS, SO THERE ARE NO LIMITATIONS EXCEPT SLOWER PERFORMANCE.?

If this is the case, could you please suggest how to install keepass.io so that it runs in maximum performance. I am using Ubuntu 16.04 LTS. The problem seems to be while running node-gyp rebuild 2>&1.

The keepass database file size is 23 KB.

attach is the full log
keepass-error.log

add write support

this feature is being implemented in the write-support branch.

use cases:

  • add a group/subgroup to the selected group
  • add an entry to the selected group
  • modify an existing entry
  • modify an existing group
  • sort groups
  • sort entries

probably necessary:

"No authorization token" behind apache proxypass

hello

thanks for the great tool i've been looking for for a while !
i've just installed all this on a lamp server that runs websites and such, and your app works perfectly locally.
but i'd rather use proxypass to have a nice url and already configured ssl than opening new ports on the server, router, etc.

# keepass-note
ProxyPass /keepass http://localhost:8443/keepass
ProxyPassReverse /keepass http://localhost:8443/keepass
<Proxy https://localhost:8443>
    Require all granted
</Proxy>

usually this setup works fine with node.js but here i run into this error :

UnauthorizedError: No authorization token was found
   at middleware (/var/www/keepass-node/node_modules/express-jwt/lib/index.js:80:21)
   at /var/www/keepass-node/node_modules/express-unless/index.js:47:5
   at Layer.handle [as handle_request] (/var/www/keepass-node/node_modules/express/lib/router/layer.js:95:5)
   at trim_prefix (/var/www/keepass-node/node_modules/express/lib/router/index.js:312:13)
   at /var/www/keepass-node/node_modules/express/lib/router/index.js:280:7
   at Function.process_params (/var/www/keepass-node/node_modules/express/lib/router/index.js:330:12)
   at next (/var/www/keepass-node/node_modules/express/lib/router/index.js:271:10)
   at jsonParser (/var/www/keepass-node/node_modules/body-parser/lib/types/json.js:100:40)
   at Layer.handle [as handle_request] (/var/www/keepass-node/node_modules/express/lib/router/layer.js:95:5)
   at trim_prefix (/var/www/keepass-node/node_modules/express/lib/router/index.js:312:13)

i can't find any information on such an error. do you have any idea why this happens ?

Fails to run.

After 'npm install', These errors come up in the output.

[email protected] install /home/browncoat/keepass-node/node_modules/keepass.io
(node-gyp rebuild 2>&1) || (echo 'DO NOT WORRY ABOUT THESE MESSAGES. KEEPASS.IO WILL FALLBACK TO SLOWER NODE.JS METHODS, SO THERE ARE NO LIMITATIONS EXCEPT SLOWER PERFORMANCE.'; exit 0)

make: Entering directory /home/browncoat/keepass-node/node_modules/keepass.io/build' CXX(target) Release/obj.target/kpion/native/kpion.o ../native/kpion.cc:11:28: fatal error: cryptopp/modes.h: No such file or directory compilation terminated. make: *** [Release/obj.target/kpion/native/kpion.o] Error 1 make: Leaving directory/home/browncoat/keepass-node/node_modules/keepass.io/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Linux 3.2.0-4-amd64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/browncoat/keepass-node/node_modules/keepass.io
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
DO NOT WORRY ABOUT THESE MESSAGES. KEEPASS.IO WILL FALLBACK TO SLOWER NODE.JS METHODS, SO THERE ARE NO LIMITATIONS EXCEPT SLOWER PERFORMANCE.

It says to not worry about the messages, so I moved on to start the package with 'npm start'. Here is the output.

fs.js:438
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory '/home/browncoat/keepass-node/certs/your_private_key.pem'
at Object.fs.openSync (fs.js:438:18)
at Object.fs.readFileSync (fs.js:289:15)
at Object. (/home/browncoat/keepass-node/keepass-node-config.js:8:17)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /home/browncoat/keepass-node/server.js:4:16

npm ERR! [email protected] start: node ./server.js
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the keepass-node package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls keepass-node
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.2.0-4-amd64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! cwd /home/browncoat/keepass-node
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/browncoat/keepass-node/npm-debug.log
npm ERR! not ok code 0

The mentioned npm-debug.log file shows basically the same output as above.

I am unsure if this is an issue with keepass-node or if it is an issue with my environment, but I can say that node and npm are working correctly for other packages.

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.