{"id":6379,"date":"2020-07-16T20:50:23","date_gmt":"2020-07-16T17:50:23","guid":{"rendered":"https:\/\/kifarunix.com\/?p=6379"},"modified":"2024-03-14T22:09:04","modified_gmt":"2024-03-14T19:09:04","slug":"install-and-setup-passbolt-password-manager-on-ubuntu","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-passbolt-password-manager-on-ubuntu\/","title":{"rendered":"Install and Setup Passbolt Password Manager on Ubuntu 20.04"},"content":{"rendered":"\n
In this tutorial, you will learn how to install and setup Passbolt password manager on Ubuntu 20.04. Passbolt<\/a> is is a free, open source, self-hosted, extensible, OpenPGP based password manager that enables teams to securely store their personal as well as share their common credentials. It is available both a subscription based and community edition. This tutorial focuses on the setup of community edition.<\/p>\n\n\n\n As of this writing, there is no official guide release for setting up Passbolt on Ubuntu 20.04. As such, we are going to install Passbolt from the source code.<\/p>\n\n\n\n Assuming that the first three prerequisites mentioned above have been met, proceed to install LEMP\/LAMP stack on Ubuntu 20.04 server. Note that Password is written in PHP and hence, it requires either a LEMP or a LAMP stack to run.<\/p>\n\n\n\n NOTE:<\/strong> By default, Ubuntu 20.04 ships with PHP 7.4 in its repos. Passbolt doesn’t fully support PHP 7.4 yet. As such, ensure that you install PHP 7.3. The LAMP\/LEMP guides below uses PHP 7.4. Be sure to install PHP 7.3 and its modules.<\/p>\n\n\n\n To install PHP 7.3, insatll the Ondrej<\/strong> PPAs and install PHP 7.3;<\/p>\n\n\n\n You can then install PHP 7.3;<\/p>\n\n\n\n Follow either of the links below to set up LAMP or LEMP stack on Ubuntu 20.04.<\/p>\n\n\n\n Install LAMP Stack on Ubuntu 20.04<\/a><\/p>\n\n\n\n Install and Setup LEMP Stack on Ubuntu 20.04<\/a><\/p>\n\n\n\n In this tutorial, we are using LAMP stack to run Passbolt.<\/strong><\/p>\n\n\n\n Login to MariaDB\/MySQL database server;<\/p>\n\n\n\n The above assumes that your MySQL\/MariaDB database is using unix_socket for authentication and that you are executing the command as a root user. If you are not root and have sudo rights, simply use; Replace the name of the database, the database user username and password as you see fit.<\/strong><\/p>\n\n\n\n Create Passbolt database that supports non latin characters and emojis.<\/p>\n\n\n\n Create a Passbolt database user and grant all privileges on the Passbolt database.<\/p>\n\n\n\n Reload privileges tables and quit database;<\/p>\n\n\n\n Since we are going to install Passbolt from the source, you need to clone its Gtihub repository to your web root directory.<\/p>\n\n\n\n In this tutorial, we are using Since we are using Apache as the web server, you need to set the ownership (user and group) of the Passbolt web root directory to Apache user and group;<\/p>\n\n\n\n To successfully install and run Passbolt, there are other tools and PHP extensions that are required. Run the command below to install them.<\/p>\n\n\n\n Navigate to Passbolt web root directory and install other required dependencies using Run composer as the non privileged user. In this case, we use the owner of the Passbolt directory<\/p>\n\n\n\n During the installation, you are prompted on whether to adjust directories permissions. Accept and continue.<\/p>\n\n\n\n In order to authenticate and sign outgoing JSON requests, Passbolt API uses PGP keys. Therefore, run the command below to generate the keys;<\/p>\n\n\n\n When prompted for the passphrase, DO NOT<\/strong> set it. Just press ENTER and confirm that you don’t want to set it. Also, do not set the expiration date.<\/strong><\/p>\n\n\n\n Replace YOUR_NAME<\/strong> and YOUR_EMAIL_ID<\/strong> with your name and email id.<\/p>\n\n\n\n Note the Key fingerprint and save it somewhere as it will be needed later in the setup.<\/p>\n\n\n\n Export and store both public and private keys on Passbolt configuration directory.<\/p>\n\n\n\n Next, initialize the gpg keyring for the Apache web server user so that Passbolt authentication can work.<\/p>\n\n\n\n Copy the sample Passbolt configuration file renaming it as follows;<\/p>\n\n\n\n Next, open the configuration file for modification;<\/p>\n\n\n\n Set the application url to the web address for your Passbolt app by replacing the value of the Configure Passbolt database connection settings;<\/p>\n\n\n\n Configure Passbolt Email Server settings. We are using Gmail SMTP as our relay server.<\/p>\n\n\n\n Extract the GPG key fingerprint and set it as the value of the Copy the highlighted string and remove spaces and paste it as the value of the Save and exit the configuration file.<\/p>\n\n\n\n Next, create a dedicated Apache virtual host configuration file for Passbolt.<\/p>\n\n\n\n Save and exit the configuration file.<\/p>\n\n\n\n If you noticed, we enabled HTTP > HTTPS redirection in our configuration. <\/p>\n\n\n\n Obtain your commercially trusted CA certificates and install them on the directories specified on the Apache configuration.<\/p>\n\n\n\n Disable Apache default site;<\/p>\n\n\n\n Enable Passbolt site;<\/p>\n\n\n\n Enable Apache Run Apache configuration syntax check.<\/p>\n\n\n\n If there is no issue, proceed to restart Apache;<\/p>\n\n\n\n Next, execute the Passbolt install script.<\/p>\n\n\n\n By default, when script is run, it prompts you to create an administrative user. We disabled that by adding the Run health check to verify that all is Okay.<\/p>\n\n\n\n You can now finalize the Passbolt setup from browser by following the address Download and install plugin for your specific browser, in this demo, we using Firefox. Therefore, click on Download the plugin<\/strong> to download and install Passbolt Firefox add-on extension.<\/p>\n\n\n\n You can now create Passbolt admin user using the So let us create an admin user;<\/p>\n\n\n\n Copy the link provided upon user registration and use it to finalize the setup of Passbolt on browser.<\/p>\n\n\n\n The link takes you to Welcome page to finalize on the Passbolt setup. If you get a blank page after loading Passbolt URL, then it means you have not installed the Passbolt browser extension<\/strong>.<\/p>\n\n\n\n Confirm that the URL and GPG key fingerprint are okay and click Next<\/strong> to proceed with setup. In the next step, you are required to generate the key. However, simply click import<\/strong> to import the existing keys.<\/p>\n\n\n\n Set a complex passphrase that you can easily remember for protecting you secret key.<\/p>\n\n\n\n Your secret key is now generated and encrypted with your passphrase and it is stored in your Passbolt add-on. Ensure that you make a copy of this key by downloading it and storing it in a different location.<\/p>\n\n\n\n Generate your security token.<\/p>\n\n\n\n You have now successfully set up your Passbolt. Click Next to get to the Login page.<\/p>\n\n\n\n And there you go.<\/p>\n\n\n\n You can now start using Passbolt to store passwords\/share them as you wish.<\/p>\n\n\n\n Last but not least, you can now configure Passbolt to be able to sent email notifications on new password creation, sharing, modification etc.<\/p>\n\n\n\n Before this, ensure that you have configured Passbolt email settings.<\/p>\n\n\n\n When you run the above, you should be able to receive emails on activating your account as well as welcoming you to Passbolt.<\/p>\n\n\n\n Create a cron job to execute this script to have the emails sent automatically.<\/p>\n\n\n\n Install the cron jobs as Apache Web server user, Create a cron job that runs all the time.<\/p>\n\n\n\n Save and exit the cron jobs file.<\/p>\n\n\n\n You can list installed cronjobs;<\/p>\n\n\n\n Your Passbolt password manager is now ready.<\/p>\n\n\n\n Install Passbolt from source<\/a><\/p>\n\n\n\n Install sysPass Password Manager on Ubuntu 18.04<\/a><\/p>\n\n\n\n Install TeamPass Password Manager on Ubuntu 18.04<\/a><\/p>\n\n\n\n Enforce Password Complexity Policy On Ubuntu 18.04<\/a><\/p>\n\n\n\nInstalling Passbolt Password Manager on Ubuntu 20.04<\/h2>\n\n\n\n
Prerequisites<\/h2>\n\n\n\n
\n
Install LAMP\/LEMP Stack on Ubuntu 20.04<\/h3>\n\n\n\n
Install PHP 7.3 on Ubuntu 20.04<\/h4>\n\n\n\n
apt install software-properties-common<\/code><\/pre>\n\n\n\n
add-apt-repository ppa:ondrej\/php --yes<\/code><\/pre>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install php7.3 php7.3-mysql<\/code><\/pre>\n\n\n\n
Create Passbolt Database and Database User<\/h3>\n\n\n\n
mysql<\/code><\/pre>\n\n\n\n
sudo mysql -u root<\/strong><\/code>. Otherwise, you can just use
mysql -u root -p<\/strong><\/code> command.<\/p>\n\n\n\n
CREATE DATABASE passbolt CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;<\/code><\/pre>\n\n\n\n
grant all on passbolt.* to passman@localhost identified by 'p@SSw0rd123';<\/code><\/pre>\n\n\n\n
flush privileges;\nquit<\/code><\/pre>\n\n\n\n
Clone Passbolt Github Repository to Apache Web Root Directory<\/h3>\n\n\n\n
\/var\/www\/passbolt<\/strong><\/code> as the web root directory.<\/p>\n\n\n\n
mkdir \/var\/www\/passbolt<\/code><\/pre>\n\n\n\n
git clone https:\/\/github.com\/passbolt\/passbolt_api.git \/var\/www\/passbolt<\/code><\/pre>\n\n\n\n
chown -R www-data: \/var\/www\/<\/code><\/pre>\n\n\n\n
Install Other Required dependencies and PHP modules\/extensions<\/h3>\n\n\n\n
apt install composer gnupg2 git php7.3-{gnupg,intl,mbstring,gd,imagick,xml,common,curl,json,ldap} zlib1g<\/code><\/pre>\n\n\n\n
composer<\/code>.<\/p>\n\n\n\n
cd \/var\/www\/passbolt<\/code><\/pre>\n\n\n\n
sudo -u www-data composer install --no-dev<\/code><\/pre>\n\n\n\n
> App\\Console\\Installer::postInstall\nCreated `config\/app.php` file\nCreated `\/var\/www\/passbolt\/logs` directory\nCreated `\/var\/www\/passbolt\/tmp\/cache\/models` directory\nCreated `\/var\/www\/passbolt\/tmp\/cache\/persistent` directory\nCreated `\/var\/www\/passbolt\/tmp\/cache\/views` directory\nCreated `\/var\/www\/passbolt\/tmp\/sessions` directory\nCreated `\/var\/www\/passbolt\/tmp\/tests` directory\nSet Folder Permissions ? (Default to Y) [Y,n]? y<\/strong><\/code><\/pre>\n\n\n\n
Generate OpenPGP Key for Authenticating JSON Requests<\/h3>\n\n\n\n
gpg --full-generate-key<\/code><\/pre>\n\n\n\n
Please select what kind of key you want:\n (1) RSA and RSA (default)\n (2) DSA and Elgamal\n (3) DSA (sign only)\n (4) RSA (sign only)\n (14) Existing key from card\nYour selection? 1\nRSA keys may be between 1024 and 4096 bits long.\nWhat keysize do you want? (3072) 4096\nRequested keysize is 4096 bits\nPlease specify how long the key should be valid.\n 0 = key does not expire\n <n> = key expires in n days\n <n>w = key expires in n weeks\n <n>m = key expires in n months\n <n>y = key expires in n years\nKey is valid for? (0) 0\nKey does not expire at all\nIs this correct? (y\/N) y\n\nGnuPG needs to construct a user ID to identify your key.\n\nReal name: YOUR_NAME\nEmail address: ENTER_YOUR_EMAIL_ID\nComment: \nYou selected this USER-ID:\n \"YOUR_NAME <YOUR_EMAIL_ID>\"\n\nChange (N)ame, (C)omment, (E)mail or (O)kay\/(Q)uit? O\n...\ngpg: key 85EB40BA1D5DE890 marked as ultimately trusted\ngpg: revocation certificate stored as '\/root\/.gnupg\/openpgp-revocs.d\/C503E615618B34331BA1D26D85EB40BA1D5DE890.rev'\npublic and secret key created and signed.\n\npub rsa4096 2020-07-15 [SC]\n C503E615618B34331BA1D26D85EB40BA1D5DE890\nuid YOUR_NAME <YOUR_EMAIL_ID>\nsub rsa4096 2020-07-15 [E]<\/code><\/pre>\n\n\n\n
gpg --armor --export-secret-keys YOUR_EMAIL_ID<\/strong> > \/var\/www\/passbolt\/config\/gpg\/serverkey_private.asc<\/code><\/pre>\n\n\n\n
gpg --armor --export YOUR_EMAIL_ID<\/strong> > \/var\/www\/passbolt\/config\/gpg\/serverkey.asc<\/code><\/pre>\n\n\n\n
sudo su -s \/bin\/bash -c \"gpg --list-keys\" www-data<\/code><\/pre>\n\n\n\n
Configuring Passbolt on Ubuntu 20.04<\/h3>\n\n\n\n
cp \/var\/www\/passbolt\/config\/passbolt{.default,}.php<\/code><\/pre>\n\n\n\n
vim \/var\/www\/passbolt\/config\/passbolt.php<\/code><\/pre>\n\n\n\n
Set the Application URL<\/h4>\n\n\n\n
fullBaseUrl<\/strong><\/code> parameter appropriately.<\/p>\n\n\n\n
\/\/ 'fullBaseUrl' => 'https:\/\/www.passbolt.test',\n 'fullBaseUrl' => 'https:\/\/passbolt.kifarunix-demo.com',<\/strong><\/code><\/pre>\n\n\n\n
Define Database Connection settings<\/h4>\n\n\n\n
\/\/ Database configuration.\n 'Datasources' => [\n 'default' => [\n 'host' => 'localhost<\/strong>',\n \/\/'port' => 'non_standard_port_number',\n 'username' => 'passman<\/strong>',\n 'password' => 'p@SSw0rd123<\/strong>',\n 'database' => 'passbolt<\/strong>',\n ],\n ],<\/code><\/pre>\n\n\n\n
Configure Passbolt Email Settings<\/h4>\n\n\n\n
\/\/ Email configuration.\n 'EmailTransport' => [\n 'default' => [\n 'host' => 'smtp.gmail.com',\n 'port' => 587,\n 'username' => 'username@gmail.com',\n 'password' => 'secretpassword',<\/strong>\n \/\/ Is this a secure connection? true if yes, null if no.\n 'tls' => true,\n<\/strong> \/\/'timeout' => 30,\n \/\/'client' => null,\n \/\/'url' => null,\n ],\n ],\n 'Email' => [\n 'default' => [\n \/\/ Defines the default name and email of the sender of the emails.\n 'from' => ['passbolt@kifarunix-demo.com' => 'Kifarunix-demo Passbolt'],\n<\/strong> \/\/'charset' => 'utf-8',\n \/\/'headerCharset' => 'utf-8',\n ],\n ],<\/code><\/pre>\n\n\n\n
Specify the GPG key fingerprint<\/h4>\n\n\n\n
fingerprint<\/code> parameter.<\/p>\n\n\n\n
gpg --list-keys --fingerprint | grep -i -B 2 YOUR_EMAIL_ID<\/strong> <\/code><\/pre>\n\n\n\n
pub rsa4096 2020-07-15 [SC]\n C503 E615 618B 3433 1BA1 D26D 85EB 40BA 1D5D E890\n<\/strong>uid [ultimate] <YOUR_NAME> <YOUR_EMAIL_ID>\nsub rsa4096 2020-07-15 [E]<\/code><\/pre>\n\n\n\n
fingerprint<\/code> parameter. Also, uncomment the public and private lines below the fingerprint by removing the two forward slashes at the beginning of those lines;<\/p>\n\n\n\n
...\n 'serverKey' => [\n \/\/ Server private key fingerprint.\n 'fingerprint' => 'C503E615618B34331BA1D26D85EB40BA1D5DE890<\/strong>',\n 'public' => CONFIG . 'gpg' . DS . 'serverkey.asc',\n 'private' => CONFIG . 'gpg' . DS . 'serverkey_private.asc',\n ],<\/strong><\/code><\/pre>\n\n\n\n
Create Apache VirtualHost Configuration for Passbolt and Enable HTTPS<\/h3>\n\n\n\n
vim \/etc\/apache2\/sites-available\/passbolt.conf <\/code><\/pre>\n\n\n\n
<VirtualHost *:80>\n\n ServerAdmin passbolt.kifarunix-demo.com\n DocumentRoot \/var\/www\/passbolt\n\n\tRedirect \/ https:\/\/passbolt.kifarunix-demo.com\n<\/VirtualHost>\n#SSLStaplingCache \"shmcb:logs\/stapling-cache(150000)\"\nServerSignature Off\nServerTokens Prod\n<VirtualHost _default_:443>\n ServerAdmin passbolt.kifarunix-demo.com\n DocumentRoot \/var\/www\/passbolt\n\n\n ErrorLog ${APACHE_LOG_DIR}\/passbolt_error.log\n CustomLog ${APACHE_LOG_DIR}\/passbolt_access.log combined\n\n\n SSLEngine on\n SSLCertificateFile \/etc\/ssl\/certs\/ssl-cert-passbolt.pem\n SSLCertificateKeyFile \/etc\/ssl\/private\/ssl-cert-passbolt.key\n SSLCACertificateFile \/etc\/ssl\/private\/ssl-cacert-passbolt.pem\n\n SSLCipherSuite EECDH+AESGCM:EDH+AESGCM\n SSLProtocol -all +TLSv1.3 +TLSv1.2\n SSLOpenSSLConfCmd Curves X25519:secp521r1:secp384r1:prime256v1\n SSLHonorCipherOrder On\n Header always set Strict-Transport-Security \"max-age=63072000; includeSubDomains; preload\"\n Header always set X-Frame-Options DENY\n Header always set X-Content-Type-Options nosniff\n SSLCompression off\n #SSLUseStapling on\n SSLSessionTickets Off\n\n\t<Directory \/var\/www\/passbolt\/>\n \t\tOptions FollowSymLinks MultiViews\n \t\tAllowOverride All\n\t\tRequire all granted\n\t<\/Directory>\n\n\n <FilesMatch \"\\.(cgi|shtml|phtml|php)$\">\n SSLOptions +StdEnvVars\n <\/FilesMatch>\n <Directory \/usr\/lib\/cgi-bin>\n SSLOptions +StdEnvVars\n <\/Directory>\n\n<\/VirtualHost><\/code><\/pre>\n\n\n\n
Generate TLS certificates<\/h4>\n\n\n\n
a2dissite 000-default.conf<\/code><\/pre>\n\n\n\n
a2ensite passbolt.conf<\/code><\/pre>\n\n\n\n
rewrite<\/code><\/strong>,
ssl<\/code><\/strong>,
headers<\/strong><\/code> module;<\/p>\n\n\n\n
a2enmod rewrite ssl headers<\/code><\/pre>\n\n\n\n
apachectl -t<\/code><\/pre>\n\n\n\n
Syntax OK<\/code><\/pre>\n\n\n\n
systemctl restart apache2<\/code><\/pre>\n\n\n\n
Run the Passbolt Install Script<\/h3>\n\n\n\n
cd \/var\/www\/passbolt<\/code><\/pre>\n\n\n\n
sudo su -s \/bin\/bash -c \".\/bin\/cake passbolt install --no-admin\" www-data<\/code><\/pre>\n\n\n\n
--no-admin<\/code> option. We will create the admin account later.<\/p>\n\n\n\n
All Done. Took 111.3186s\n\nImport the server private key in the keyring\n---------------------------------------------------------------\nImporting \/var\/www\/passbolt\/config\/gpg\/serverkey_private.asc\nKeyring init OK\n\nPassbolt installation success! Enjoy! \u262e<\/code><\/pre>\n\n\n\n
cd \/var\/www\/passbolt\nsudo su -s \/bin\/bash -c \".\/bin\/cake passbolt healthcheck\" www-data<\/code><\/pre>\n\n\n\n
...\n Application configuration\n\n [PASS] Using latest passbolt version (2.13.1).\n [PASS] Passbolt is configured to force SSL use.\n [PASS] App.fullBaseUrl is set to HTTPS.\n [PASS] Selenium API endpoints are disabled.\n [PASS] Search engine robots are told not to index content.\n [PASS] Registration is closed, only administrators can add users.\n [PASS] Serving the compiled version of the javascript app\n [PASS] All email notifications will be sent.\n\n No error found. Nice one sparky!<\/strong><\/code><\/pre>\n\n\n\n
Finalize Passbolt Setup from Browser<\/h3>\n\n\n\n
https:\/\/<passbolt-server-hostname><\/code>.<\/p>\n\n\n\n
<\/figure>\n\n\n\n
Create Passbolt Administrative User<\/h4>\n\n\n\n
.\/bin\/cake passbolt register_user<\/code> command. Below is the command line options for this command;<\/p>\n\n\n\n
cd \/var\/www\/passbolt<\/code><\/pre>\n\n\n\n
.\/bin\/cake passbolt register_user --help<\/code><\/pre>\n\n\n\n
____ __ ____ \n \/ __ \\____ _____ ____\/ \/_ ____ \/ \/ \/_ \n \/ \/_\/ \/ __ `\/ ___\/ ___\/ __ \\\/ __ \\\/ \/ __\/ \n \/ ____\/ \/_\/ (__ |__ ) \/_\/ \/ \/_\/ \/ \/ \/ \n \/_\/ \\__,_\/____\/____\/_.___\/\\____\/_\/\\__\/ \n\n Open source password manager for teams\n---------------------------------------------------------------\nRegister a new user.\n\nUsage:\ncake passbolt register_user [options]\n\nOptions:\n\n--first-name, -f The user first name\n--help, -h Display this help.\n--interactive, -i Enable interactive mode\n--interactive-loop Enable interactive mode (default:\n 3)\n--last-name, -l The user last name\n--quiet, -q Enable quiet output.\n--role, -r The User role, such as \"admin\" or \"user\"\n--username, -u The user email aka username\n--verbose, -v Enable verbose output.<\/code><\/pre>\n\n\n\n
cd \/var\/www\/passbolt<\/code><\/pre>\n\n\n\n
sudo su -s \/bin\/bash -c \".\/bin\/cake passbolt register_user -u admin@kifarunix-demo.com -f Kifarunix -l Demo -r admin\" www-data<\/code><\/pre>\n\n\n\n
____ __ ____ \n \/ __ \\____ _____ ____\/ \/_ ____ \/ \/ \/_ \n \/ \/_\/ \/ __ `\/ ___\/ ___\/ __ \\\/ __ \\\/ \/ __\/ \n \/ ____\/ \/_\/ (__ |__ ) \/_\/ \/ \/_\/ \/ \/ \/ \n \/_\/ \\__,_\/____\/____\/_.___\/\\____\/_\/\\__\/ \n\n Open source password manager for teams\n---------------------------------------------------------------\nUser saved successfully.\nTo start registration follow the link provided in your mailbox or here: \nhttps:\/\/passbolt.kifarunix-demo.com\/setup\/install\/d4273b45-2728-4538-863a-ff7e58260a0f\/42221ac3-0205-415a-85b2-c8271f8742f7<\/code><\/pre>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
Configure Passbolt to Sent Emails<\/h3>\n\n\n\n
cd \/var\/www\/passbolt<\/code><\/pre>\n\n\n\n
.\/bin\/cake EmailQueue.sender<\/code><\/pre>\n\n\n\n
www-data<\/strong><\/code>.<\/p>\n\n\n\n
crontab -u www-data -e<\/code><\/pre>\n\n\n\n
*<\/strong> *<\/strong> *<\/strong> *<\/strong> *<\/strong> \/var\/www\/passbolt\/bin\/cake EmailQueue.sender >><\/strong> \/var\/log\/passbolt-mails.log<\/code><\/pre>\n\n\n\n
crontab -u www-data -l<\/code><\/pre>\n\n\n\n
Reference<\/h3>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n