123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <!DOCTYPE html>
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Create a Secure Web Based Password Vault with Keepass Web</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta charset="UTF-8">
- <meta name="keywords" content="Browser Based,Home Lab,Home Lab Ideas,Install Guide,Self-Hosted,Web Based,Web Based Tools,Debian,Homelab,How To Self-Host Keepass Web,Linux,Password Locker,Password Manager,Password Tracking,Password Vault,Security,How To,Tutorial,i12bretro">
- <meta name="author" content="i12bretro">
- <meta name="description" content="Create a Secure Web Based Password Vault with Keepass Web">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="revised" content="12/10/2023 10:09:10 AM" />
- <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
- <script type="text/javascript" src="includes/js/steps.js"></script>
- <link href="css/steps.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="gridContainer">
- <div class="topMargin"></div>
- <div id="listName" class="topMargin">
- <h1>Create a Secure Web Based Password Vault with Keepass Web</h1>
- </div>
- <div></div>
- <div id="content">
- <ol>
- <li>Log into the Debian device</li>
- <li>Run the following commands in a terminal:
- <div class="codeBlock"># update repositories and install any available software updates<br />
- sudo apt update<br />
- sudo apt upgrade<br />
- # install apache2<br />
- sudo apt install apache2<br />
- # download and extract keepass web<br />
- wget https://github.com/keeweb/keeweb/archive/gh-pages.zip<br />
- sudo unzip gh-pages.zip -d /var/www/html/<br />
- sudo mv /var/www/html/keeweb-gh-pages /var/www/html/keepass<br />
- # create webdav directory and set permissions<br />
- sudo mkdir /var/www/html/webdav<br />
- sudo chown -R www-data:www-data /var/www/html/webdav<br />
- # change permissions on the newly setup application folder<br />
- sudo chown -R www-data:www-data /var/www/html/keepass<br />
- # create a new keepass.conf file to configure the site<br />
- sudo nano /etc/apache2/sites-available/keepass.conf</div>
- </li>
- <li>Paste the following directives into keepass.conf
- <p>DavLockDB "/var/www/html/webdav/DavLock"<br />
- <Location /keepass ><br />
- RewriteEngine on<br />
- RewriteCond %{REQUEST_METHOD} OPTIONS<br />
- RewriteRule ^(.*)$ blank.html [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]<br />
- # Don't require LDAP authentication for a healthcheck<br />
- SetEnvIf Request_URI "^/healhcheck" accessgranted=1<br />
- Order deny,allow<br />
- Satisfy any<br />
- Deny from all<br />
- Allow from env=accessgranted<br />
- AuthType Basic<br />
- AuthBasicProvider ldap<br />
- AuthLDAPURL "ldap://i12bretro.local:389/DC=i12bretro,DC=local?sAMAccountName?sub?(objectClass=user)" NONE<br />
- AuthLDAPBindDN "readonly_svc@i12bretro.local"<br />
- AuthLDAPBindPassword "Read0nly!!"<br />
- AuthName "Restricted Area [i12bretro.local]"<br />
- # to authenticate a domain group, specify the full DN<br />
- AuthLDAPGroupAttributeIsDN on<br />
- require ldap-group CN=WebAuthAccess,CN=Users,DC=i12bretro,DC=local<br />
- </Location> <br />
- <Location "/webdav"><br />
- DAV On<br />
- AuthType "Basic"<br />
- AuthName "webdav"<br />
- Options Indexes<br />
- Header always set Access-Control-Allow-Origin "*"<br />
- Header always set Access-Control-Allow-Headers "origin, content-type, cache-control, accept, authorization, if-match, destination, overwrite"<br />
- Header always set Access-Control-Expose-Headers "ETag"<br />
- Header always set Access-Control-Allow-Methods "GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK"<br />
- Header always set Access-Control-Allow-Credentials "true"<br />
- </Location></p>
- </li>
- <li>Edit the index.html file and modify the kw-config meta tag, setting the value to config.json
- <div class="codeBlock"># <meta name="kw-config" content="config.json"><br />
- sudo nano /var/www/html/keepass/index.html</div>
- </li>
- <li>Press CTRL+O, Enter, CTRL+X to write the changes to index.html</li>
- <li>Create and edit config.json to by running the following command:
- <div class="codeBlock">sudo nano /var/www/html/keepass/config.json</div>
- </li>
- <li>Paste the following in to config.json
- <p>{<br />
- "settings": {<br />
- "theme": "fb",<br />
- "autoSave": true,<br />
- "autoSaveInterval": 1,<br />
- "canOpenDemo": false,<br />
- "dropbox": false,<br />
- "gdrive": false,<br />
- "onedrive": false,<br />
- "canExportXml": true<br />
- },<br />
- "files": [{<br />
- "storage": "webdav",<br />
- "name": "Database",<br />
- "path": "/webdav/database.kdbx"<br />
- }]<br />
- }</p>
- </li>
- <li>Press CTRL+O, Enter, CTRL+X to write the changes to config.json</li>
- <li>Continue by executing the following commands in terminal:
- <div class="codeBlock"># enable the keepass site and required Apache modules<br />
- sudo a2ensite keepass<br />
- sudo a2enmod dav dav_fs ldap authnz_ldap rewrite headers<br />
- # restart apache2 service for the changes to take effect<br />
- sudo systemctl restart apache2</div>
- </li>
- <li>Open a web browser and navigate to http://DNSorIP/keepass</li>
- <li>Authenticate with a valid LDAP user account</li>
- <li>Click the New icon</li>
- <li>Click the New link in the lower left hand corner</li>
- <li>Enter a Master password and re-type it to confirm</li>
- <li>Enter a Name for the keepass database</li>
- <li>Click the Save to... button > File</li>
- <li>Save the database to ~/database.kdbx</li>
- <li>Close the browser</li>
- <li>Continue by executing the following commands in terminal:
- <div class="codeBlock"># copy the keepass database to webdav directory<br />
- sudo mv ~/database.kdbx /var/www/html/webdav/</div>
- </li>
- <li>Open a web browser and navigate to http://DNSorIP/keepass</li>
- <li>Enter the master password created earlier</li>
- <li>Enjoy your web based keepass editor</li>
- </ol> </div>
- </div>
- </body>
- </html>
-
|