Depolying your own password management tool -- KeeWeb
2019年03月15日
KeeWeb is a web based password managing system. It is compatible with KeePass, which is a very famous .net based software on Windows. KeeWeb basically save all the information into a single database file which have a suffix .kdbx.
Host the static KeeWeb in nginx
We might need some more functions from nginx, so we would better compile the nginx ourself or pull the official docker image with docker pull nginx.
enable nginx webdav function
Noticed that we have give KeeWeb a default WebDav file position, you can use a webdav service or host one with the same nginx.
Always using SSL (ssl_certificate_key) for webdav is a good idea.
The official nginx do not have dav_ext module enabled but [http_dav_module](http://nginx.org/en/docs/http/ngx_http_dav_module.html) is already enough because we not need to list the files or so.
Use a basic auth method (auth_basic_user_file) is crucial for webdav.
The nginx configure file basiclly looks like this:
There are multiple ways to generate the basic auth file. Command echo "${USERNAME}:$(openssl passwd -apr1 -salt ${SALT} ${PASSWORD})" > htpasswd or python3 -c "import passlib.hash as p; print('${USERNAME}:'+p.apr_md5_crypt.encrypt('${PASSWORD}', salt='${SALT}'))" both do the work. The Apache-defined APR1 hashing format (see the $apr1$ inside the file)” is used to include a 48-bit salt value.
For the webdav, we can not list the files, but upload/update/delete should work. curl is a good tool to do this.
Add some password
The next step might be transfer some password into KeeWeb. It seems a XML format document can be imported into KeeWeb but I do not know the correct forma. Another easy way is to use AppleScript to simulate the manually input process.
Like following script,press Command-N to create a new entry and then input the URL, then press TAB, then new information and finally ENTER.