-
Notifications
You must be signed in to change notification settings - Fork 44
Installation
This guide is for new installation. If you want to upgrade from old versions, use upgrade guide
- Install PHP (7.1+), MySQL (MariaDB) and WebServer(IIS, Apache or Nginx) in your server. Make sure PDO is supported
- Create a database in your MySQL server for this password manager
- Import
initial.sql
into that database - Download
src
folder in this repository from newest Release, and editsrc/function/config.php
with your configuration (database and etc., see comments in this file)- Make sure you put $HOSTDOMAIN as https://example.com/ if your domain is example.com. Don't miss the last '/'. Otherwise, https://example.com.attacker.com/ can pass the check.
- Upload files in
src
folder to your web server, along with your editedsrc/function/config.php
- Set up HTTPS (required) and HTTP redirect to HTTPS. Use Let's encrypt if you need a free certificate. Set header
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
on your server if you don't decide to use invalid certificate in the future (e.g. self-signed certificate). If you decide to use invalid certificate, this password manager might work. But no support will be provided for using invalid certificate. - If you enabled file feature, make the maximal allowed POST packet size at least 15MB in
my.cnf
andphp.ini
(post_max_size) andhttpd.conf
(note, you might need to change SecRequestBodyNoFilesLimit in mod_security.conf). The files are posted as a string so changing max upload file size doesn't work. Don't forget to restartmysqld
andhttpd
. - If you enabled email verification feature, make sure your configuration works by testing API using your configuration (https://sendgrid.com/docs/API_Reference/Web_API/mail.html). If you use invalid settings, your email will not be sent out and you will not be able to login.
- Open webpage in web browser
- Click Signup to register an account. (If you don't want others to sign up, just set
$ALLOW_SIGN_UP
tofalse
inconfig.php
after you are done. If you feel insecure, you can further deletesignup.php
andreg.php
but it's not required) - You are done!
- Remember your password to login. No one can recover your data if you lose that!
This is to prevent password leak when the attacker gets control of your server and deploys malicious client-side Javascript code. For example, he can edits the login javascript to directly post your raw password. The solution to this is asking client (web browser) to check the integrity of all javascript / html / css components everytime before visiting password manager.
-
Follow above to complete basic installation.
-
prepare an
absolutely safe host
supporting static web page hosting (Github Pages is a good choice! You can use public repo, no need to hide code). And Associate a domain / subdomain X to that static site (Github pages will provide you with a free subdomain). -
On your main server (where you install password manager), set
Header set Access-Control-Allow-Origin "*"
or instead of*
, include your domain / subdomain X. This is to ensure your web browser can get access to password manager from website X. -
Finish all setup, including import, disabling new sign up etc.
-
file_lists.txt
in this project repository is all the files to check. If you delete some files, you should also delete them on the txt. Alternatively, you can rungenerate_file_lists.py
to generate files that needs to be checked. On your server, suppose your code for password manager lives insrc
, you can runpython generate_file_lists.py
. If it's notsrc
, edit the Python file accordingly. -
Edit
check_website.html
, assign your website URL (including tail/
) to global variableWEBSITE
. -
Upload
check_website.html
andfile_lists.txt
to the safe host at step 2. and visitcheck_website.html
in web browser and you will get error message, where you can see actual MD5 for files. -
Edit
check_website.html
and assign the actual MD5 you got from previous step to global variableCORRECT_MD5
. Re-upload the html. -
Optionally, you can rename
check_website.html
toindex.html
or any name you like.
When you want to visit password manager, always visit X/check_website.html
. It will redirect you to password manager if integrity checks passes. Otherwise, it will show an error and you should check if your server is compromised.
Do NOT put check_website.html
and file_lists.txt
at same host of password manager. Otherwise this check is useless. Remember to change CORRECT_MD5
everytime you make changes to source files (Redo step 8).
If Password Manager doesn't work properly after installation, try following:
- Goto demo site try if your bug can be reproduced there. If so, go to step 3.
- If your bug can't be reproduced in demo site, it's most likely you didn't install password manager correctly. Carefully check
src/function/config.php
to see if you make any mistake there and make sure you didn't edit other files insrc
folder. Then enable PHP debug inphp.ini
and check httpd error log. - submit an issue with steps to reproduce the bug. If your bug can be reproduced in demo site, you don't need to provide any other information. Otherwise, provide error log and PHP debug output.